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/FNev1
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 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 44
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 44
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 41
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 41
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
Branch analysis from position: 7
Found catch point at position: 46
Branch analysis from position: 46
2 jumps found. (Code = 107) Position 1 = 47, Position 2 = -2
Branch analysis from position: 47
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/FNev1
function name:  map
number of ops:  53
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        BEGIN_SILENCE                                    ~5      
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !0, 'protocol_id'
          3        END_SILENCE                                              ~5
          4      > JMPZ                                                     ~6, ->7
   17     5    >   INIT_ARRAY                                       ~7      !0
          6        ASSIGN                                                   !0, ~7
   20     7    >   ASSIGN                                                   !1, <array>
   24     8      > FE_RESET_R                                       $10     !0, ->44
          9    > > FE_FETCH_R                                               $10, !2, ->44
   25    10    >   NEW                                              $11     'Protocol'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !3, $11
   27    13        INIT_METHOD_CALL                                         !3, 'setProtocolId'
         14        CHECK_FUNC_ARG                                           
         15        FETCH_DIM_FUNC_ARG                               $14     !2, 'protocol_id'
         16        SEND_FUNC_ARG                                            $14
         17        DO_FCALL                                      0  $15     
   28    18        INIT_METHOD_CALL                                         $15, 'setCreationDate'
         19        NEW                                              $16     'DateTime'
         20        CHECK_FUNC_ARG                                           
         21        FETCH_DIM_FUNC_ARG                               $17     !2, 'creation_date'
         22        SEND_FUNC_ARG                                            $17
         23        NEW                                              $18     'DateTimeZone'
         24        SEND_VAL_EX                                              'UTC'
         25        DO_FCALL                                      0          
         26        SEND_VAR_NO_REF_EX                                       $18
         27        DO_FCALL                                      0          
         28        SEND_VAR_NO_REF_EX                                       $16
         29        DO_FCALL                                      0          
   30    30        ISSET_ISEMPTY_DIM_OBJ                         1  ~22     !2, 'fleet_id'
         31        BOOL_NOT                                         ~23     ~22
         32      > JMPZ                                                     ~23, ->41
   31    33    >   INIT_METHOD_CALL                                         !3, 'setFleet'
         34        NEW                                              $24     'Fleet'
         35        CHECK_FUNC_ARG                                           
         36        FETCH_DIM_FUNC_ARG                               $25     !2, 'fleet_id'
         37        SEND_FUNC_ARG                                            $25
         38        DO_FCALL                                      0          
         39        SEND_VAR_NO_REF_EX                                       $24
         40        DO_FCALL                                      0          
   34    41    >   ASSIGN_DIM                                               !1
         42        OP_DATA                                                  !3
   24    43      > JMP                                                      ->9
         44    >   FE_FREE                                                  $10
         45      > JMP                                                      ->52
   37    46  E > > CATCH                                       last         'Exception'
   38    47    >   ECHO                                                     !4
   39    48        NEW                                              $29     'Exception'
         49        SEND_VAL_EX                                              'Error+when+trying+to+map+result+into+Protocol+object'
         50        DO_FCALL                                      0          
         51      > THROW                                         0          $29
   41    52    > > 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/FNev1
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/FNev1
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/FNev1
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:
148.05 ms | 1403 KiB | 13 Q