3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Protocol { public function setProtocolId($id) {} public function setCreationDate($id) {} } $data = array('status_date' => 'abc'); if (isset($data['protocol_id'])) { $data = array($data); } $protocols = array(); try { foreach ($data as $_data) { $protocol = new Protocol(); $protocol->setProtocolId($_data['protocol_id']) ->setCreationDate(new \DateTime($_data['creation_date'], new \DateTimeZone('UTC'))); if (!empty($_data['fleet_id'])) { $protocol->setFleet(new Fleet($_data['fleet_id'])); } $protocols[] = $protocol; } } catch (\Exception $e) { throw new \IllegalArgumentException('Error when trying to map result into Protocol object'); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 42
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 42
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 39
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 39
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
Branch analysis from position: 5
Found catch point at position: 44
Branch analysis from position: 44
2 jumps found. (Code = 107) Position 1 = 45, Position 2 = -2
Branch analysis from position: 45
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/uuDpW
function name:  (null)
number of ops:  50
compiled vars:  !0 = $data, !1 = $protocols, !2 = $_data, !3 = $protocol, !4 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
   10     1        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 'protocol_id'
          2      > JMPZ                                                     ~6, ->5
   11     3    >   INIT_ARRAY                                       ~7      !0
          4        ASSIGN                                                   !0, ~7
   14     5    >   ASSIGN                                                   !1, <array>
   18     6      > FE_RESET_R                                       $10     !0, ->42
          7    > > FE_FETCH_R                                               $10, !2, ->42
   19     8    >   NEW                                              $11     'Protocol'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !3, $11
   21    11        INIT_METHOD_CALL                                         !3, 'setProtocolId'
         12        CHECK_FUNC_ARG                                           
         13        FETCH_DIM_FUNC_ARG                               $14     !2, 'protocol_id'
         14        SEND_FUNC_ARG                                            $14
         15        DO_FCALL                                      0  $15     
   22    16        INIT_METHOD_CALL                                         $15, 'setCreationDate'
         17        NEW                                              $16     'DateTime'
         18        CHECK_FUNC_ARG                                           
         19        FETCH_DIM_FUNC_ARG                               $17     !2, 'creation_date'
         20        SEND_FUNC_ARG                                            $17
         21        NEW                                              $18     'DateTimeZone'
         22        SEND_VAL_EX                                              'UTC'
         23        DO_FCALL                                      0          
         24        SEND_VAR_NO_REF_EX                                       $18
         25        DO_FCALL                                      0          
         26        SEND_VAR_NO_REF_EX                                       $16
         27        DO_FCALL                                      0          
   24    28        ISSET_ISEMPTY_DIM_OBJ                         1  ~22     !2, 'fleet_id'
         29        BOOL_NOT                                         ~23     ~22
         30      > JMPZ                                                     ~23, ->39
   25    31    >   INIT_METHOD_CALL                                         !3, 'setFleet'
         32        NEW                                              $24     'Fleet'
         33        CHECK_FUNC_ARG                                           
         34        FETCH_DIM_FUNC_ARG                               $25     !2, 'fleet_id'
         35        SEND_FUNC_ARG                                            $25
         36        DO_FCALL                                      0          
         37        SEND_VAR_NO_REF_EX                                       $24
         38        DO_FCALL                                      0          
   28    39    >   ASSIGN_DIM                                               !1
         40        OP_DATA                                                  !3
   18    41      > JMP                                                      ->7
         42    >   FE_FREE                                                  $10
         43      > JMP                                                      ->49
   31    44  E > > CATCH                                       last         'Exception'
   32    45    >   NEW                                              $29     'IllegalArgumentException'
         46        SEND_VAL_EX                                              'Error+when+trying+to+map+result+into+Protocol+object'
         47        DO_FCALL                                      0          
         48      > THROW                                         0          $29
   33    49    > > RETURN                                                   1

Class Protocol:
Function setprotocolid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uuDpW
function name:  setProtocolId
number of ops:  2
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function setprotocolid

Function setcreationdate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uuDpW
function name:  setCreationDate
number of ops:  2
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function setcreationdate

End of class Protocol.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.96 ms | 1390 KiB | 13 Q