3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Validator { private array $rules; public function __construct(array $rules) { $this->rules = $rules; } public function validate (Enrollee $enrollee): ErrorList { $errorList = new ErrorList(); foreach ($this->rules as $fieldName => $checklist) { foreach ($checklist as $rule) { $result = $rule($enrollee->get($fieldName)); if ($result) { $errorList->add($fieldName, $result); } } } return $errorList; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g8uRs
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E > > RETURN                                                       1

Class Validator:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g8uRs
function name:  __construct
number of ops:  4
compiled vars:  !0 = $rules
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    9     1        ASSIGN_OBJ                                                   'rules'
          2        OP_DATA                                                      !0
   10     3      > RETURN                                                       null

End of function __construct

Function validate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 25
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 25
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 23
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 23
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 23
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/g8uRs
function name:  validate
number of ops:  30
compiled vars:  !0 = $enrollee, !1 = $errorList, !2 = $checklist, !3 = $fieldName, !4 = $rule, !5 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   14     1        NEW                                                  $6      'ErrorList'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $6
   16     4        FETCH_OBJ_R                                          ~9      'rules'
          5      > FE_RESET_R                                           $10     ~9, ->25
          6    > > FE_FETCH_R                                           ~11     $10, !2, ->25
          7    >   ASSIGN                                                       !3, ~11
   18     8      > FE_RESET_R                                           $13     !2, ->23
          9    > > FE_FETCH_R                                                   $13, !4, ->23
   20    10    >   INIT_DYNAMIC_CALL                                            !4
         11        INIT_METHOD_CALL                                             !0, 'get'
         12        SEND_VAR_EX                                                  !3
         13        DO_FCALL                                          0  $14     
         14        SEND_VAR_NO_REF_EX                                           $14
         15        DO_FCALL                                          0  $15     
         16        ASSIGN                                                       !5, $15
   21    17      > JMPZ                                                         !5, ->22
   22    18    >   INIT_METHOD_CALL                                             !1, 'add'
         19        SEND_VAR_EX                                                  !3
         20        SEND_VAR_EX                                                  !5
         21        DO_FCALL                                          0          
   18    22    > > JMP                                                          ->9
         23    >   FE_FREE                                                      $13
   16    24      > JMP                                                          ->6
         25    >   FE_FREE                                                      $10
   26    26        VERIFY_RETURN_TYPE                                           !1
         27      > RETURN                                                       !1
   27    28*       VERIFY_RETURN_TYPE                                           
         29*     > RETURN                                                       null

End of function validate

End of class Validator.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
153.65 ms | 1580 KiB | 13 Q