3v4l.org

run code in 500+ PHP versions simultaneously
<?php class ErrorList { private array $errors; public function add (string $fieldName, ValidationError $validationError): void { $this->errors[$fieldName][] = $validationError; } public function getListOfFieldErrors (string $fieldName): array { $result = $this->errors[$fieldName] ?? null; if (!$result) { throw new ArrayNotExistsException("Массива под таким ключом не существует. "); } foreach ($result as $key => $error) { $result [$key] = $error->get("text"); } return $result; } public function isEmpty (): bool { return empty($this->errors); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5cntA
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E > > RETURN                                                       1

Class ErrorList:
Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5cntA
function name:  add
number of ops:  7
compiled vars:  !0 = $fieldName, !1 = $validationError
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    9     2        FETCH_OBJ_W                                          $2      'errors'
          3        FETCH_DIM_W                                          $3      $2, !0
          4        ASSIGN_DIM                                                   $3
          5        OP_DATA                                                      !1
   10     6      > RETURN                                                       null

End of function add

Function getlistoffielderrors:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 21
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/5cntA
function name:  getListOfFieldErrors
number of ops:  26
compiled vars:  !0 = $fieldName, !1 = $result, !2 = $error, !3 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   14     1        FETCH_OBJ_IS                                         ~4      'errors'
          2        FETCH_DIM_IS                                         ~5      ~4, !0
          3        COALESCE                                             ~6      ~5
          4        QM_ASSIGN                                            ~6      null
          5        ASSIGN                                                       !1, ~6
   16     6        BOOL_NOT                                             ~8      !1
          7      > JMPZ                                                         ~8, ->12
   18     8    >   NEW                                                  $9      'ArrayNotExistsException'
          9        SEND_VAL_EX                                                  '%D0%9C%D0%B0%D1%81%D1%81%D0%B8%D0%B2%D0%B0+%D0%BF%D0%BE%D0%B4+%D1%82%D0%B0%D0%BA%D0%B8%D0%BC+%D0%BA%D0%BB%D1%8E%D1%87%D0%BE%D0%BC+%D0%BD%D0%B5+%D1%81%D1%83%D1%89%D0%B5%D1%81%D1%82%D0%B2%D1%83%D0%B5%D1%82.+'
         10        DO_FCALL                                          0          
         11      > THROW                                             0          $9
   21    12    > > FE_RESET_R                                           $11     !1, ->21
         13    > > FE_FETCH_R                                           ~12     $11, !2, ->21
         14    >   ASSIGN                                                       !3, ~12
   23    15        INIT_METHOD_CALL                                             !2, 'get'
         16        SEND_VAL_EX                                                  'text'
         17        DO_FCALL                                          0  $15     
         18        ASSIGN_DIM                                                   !1, !3
         19        OP_DATA                                                      $15
   21    20      > JMP                                                          ->13
         21    >   FE_FREE                                                      $11
   25    22        VERIFY_RETURN_TYPE                                           !1
         23      > RETURN                                                       !1
   26    24*       VERIFY_RETURN_TYPE                                           
         25*     > RETURN                                                       null

End of function getlistoffielderrors

Function isempty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5cntA
function name:  isEmpty
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   ISSET_ISEMPTY_PROP_OBJ                               ~0      'errors'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   31     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function isempty

End of class ErrorList.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.85 ms | 1580 KiB | 13 Q