3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Protocol { public function setProtocolId($id) {return $this;} public function setCreationDate($id) {return $this;} public function setFleet($fleet) { return $this;} } class Fleet {} $data = array('status_date' => 'abc'); map($data); function map(Array $data) { 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) { echo $e; throw new Exception('Error when trying to map result into Protocol object'); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r3On2
function name:  (null)
number of ops:  5
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL_BY_NAME                                       'map'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   41     4      > RETURN                                                   1

Function map:
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 = 50
Branch analysis from position: 50
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/r3On2
function name:  map
number of ops:  51
compiled vars:  !0 = $data, !1 = $protocols, !2 = $_data, !3 = $protocol, !4 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 'protocol_id'
          2      > JMPZ                                                     ~5, ->5
   17     3    >   INIT_ARRAY                                       ~6      !0
          4        ASSIGN                                                   !0, ~6
   20     5    >   ASSIGN                                                   !1, <array>
   24     6      > FE_RESET_R                                       $9      !0, ->42
          7    > > FE_FETCH_R                                               $9, !2, ->42
   25     8    >   NEW                                              $10     'Protocol'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !3, $10
   27    11        INIT_METHOD_CALL                                         !3, 'setProtocolId'
         12        CHECK_FUNC_ARG                                           
         13        FETCH_DIM_FUNC_ARG                               $13     !2, 'protocol_id'
         14        SEND_FUNC_ARG                                            $13
         15        DO_FCALL                                      0  $14     
   28    16        INIT_METHOD_CALL                                         $14, 'setCreationDate'
         17        NEW                                              $15     'DateTime'
         18        CHECK_FUNC_ARG                                           
         19        FETCH_DIM_FUNC_ARG                               $16     !2, 'creation_date'
         20        SEND_FUNC_ARG                                            $16
         21        NEW                                              $17     'DateTimeZone'
         22        SEND_VAL_EX                                              'UTC'
         23        DO_FCALL                                      0          
         24        SEND_VAR_NO_REF_EX                                       $17
         25        DO_FCALL                                      0          
         26        SEND_VAR_NO_REF_EX                                       $15
         27        DO_FCALL                                      0          
   30    28        ISSET_ISEMPTY_DIM_OBJ                         1  ~21     !2, 'fleet_id'
         29        BOOL_NOT                                         ~22     ~21
         30      > JMPZ                                                     ~22, ->39
   31    31    >   INIT_METHOD_CALL                                         !3, 'setFleet'
         32        NEW                                              $23     'Fleet'
         33        CHECK_FUNC_ARG                                           
         34        FETCH_DIM_FUNC_ARG                               $24     !2, 'fleet_id'
         35        SEND_FUNC_ARG                                            $24
         36        DO_FCALL                                      0          
         37        SEND_VAR_NO_REF_EX                                       $23
         38        DO_FCALL                                      0          
   34    39    >   ASSIGN_DIM                                               !1
         40        OP_DATA                                                  !3
   24    41      > JMP                                                      ->7
         42    >   FE_FREE                                                  $9
         43      > JMP                                                      ->50
   37    44  E > > CATCH                                       last         'Exception'
   38    45    >   ECHO                                                     !4
   39    46        NEW                                              $28     'Exception'
         47        SEND_VAL_EX                                              'Error+when+trying+to+map+result+into+Protocol+object'
         48        DO_FCALL                                      0          
         49      > THROW                                         0          $28
   41    50    > > RETURN                                                   null

End of function map

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

End of function setcreationdate

Function setfleet:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r3On2
function name:  setFleet
number of ops:  4
compiled vars:  !0 = $fleet
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        FETCH_THIS                                       ~1      
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function setfleet

End of class Protocol.

Class Fleet: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.36 ms | 1403 KiB | 13 Q