3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Traverse\Test { interface MyTypeInterface { function getPropertyA(); function getPropertyB(); } class MyType implements MyTypeInterface { private $_propertyA; private $_propertyB; final public function getPropertyA() { return $this->_propertyA; } final public function getPropertyB() { return $this->_propertyB; } final private function setPropertyA($propertyA) { // $propertyA assertions $this->_propertyA = $propertyA; } final private function setPropertyB($propertyB) { // $propertyB assertions $this->_propertyB = $propertyB; } public function __construct(MyTypeInterface $myType) { $this->setPropertyA($myType->getPropertyA()); $this->setPropertyB($myType->getPropertyB()); } } class MyTypeBuilder implements MyTypeInterface { private $_propertyA; private $_propertyB; public function getPropertyA() { return $this->_propertyA; } public function setPropertyA($propertyA) { $this->_propertyA = $propertyA; } public function getPropertyB() { return $this->_propertyB; } public function setPropertyB($propertyB) { $this->_propertyB = $propertyB; } } $myTypeBuilder = new MyTypeBuilder(); $myTypeBuilder->setPropertyA('foo'); $myTypeBuilder->setPropertyB('bar'); $myType = new MyType($myTypeBuilder); var_dump($myTypeBuilder, $myType); /* object(Traverse\Test\MyTypeBuilder)#1 (2) { ["_propertyA":"Traverse\Test\MyTypeBuilder":private]=> string(3) "foo" ["_propertyB":"Traverse\Test\MyTypeBuilder":private]=> string(3) "bar" } object(Traverse\Test\MyType)#2 (2) { ["_propertyA":"Traverse\Test\MyType":private]=> string(3) "foo" ["_propertyB":"Traverse\Test\MyType":private]=> string(3) "bar" } */ }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  (null)
number of ops:  20
compiled vars:  !0 = $myTypeBuilder, !1 = $myType
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_CLASS                                            'traverse%5Ctest%5Cmytype'
   43     1        DECLARE_CLASS                                            'traverse%5Ctest%5Cmytypebuilder'
   66     2        NEW                                              $2      'Traverse%5CTest%5CMyTypeBuilder'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   67     5        INIT_METHOD_CALL                                         !0, 'setPropertyA'
          6        SEND_VAL_EX                                              'foo'
          7        DO_FCALL                                      0          
   68     8        INIT_METHOD_CALL                                         !0, 'setPropertyB'
          9        SEND_VAL_EX                                              'bar'
         10        DO_FCALL                                      0          
   69    11        NEW                                              $7      'Traverse%5CTest%5CMyType'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $7
   71    15        INIT_NS_FCALL_BY_NAME                                    'Traverse%5CTest%5Cvar_dump'
         16        SEND_VAR_EX                                              !0
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0          
   88    19      > RETURN                                                   1

Class Traverse\Test\MyTypeInterface:
Function getpropertya:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  getPropertyA
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   null

End of function getpropertya

Function getpropertyb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  getPropertyB
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E > > RETURN                                                   null

End of function getpropertyb

End of class Traverse\Test\MyTypeInterface.

Class Traverse\Test\MyType:
Function getpropertya:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  getPropertyA
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      '_propertyA'
          1      > RETURN                                                   ~0
   20     2*     > RETURN                                                   null

End of function getpropertya

Function getpropertyb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  getPropertyB
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   FETCH_OBJ_R                                      ~0      '_propertyB'
          1      > RETURN                                                   ~0
   24     2*     > RETURN                                                   null

End of function getpropertyb

Function setpropertya:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  setPropertyA
number of ops:  4
compiled vars:  !0 = $propertyA
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   28     1        ASSIGN_OBJ                                               '_propertyA'
          2        OP_DATA                                                  !0
   29     3      > RETURN                                                   null

End of function setpropertya

Function setpropertyb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  setPropertyB
number of ops:  4
compiled vars:  !0 = $propertyB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   33     1        ASSIGN_OBJ                                               '_propertyB'
          2        OP_DATA                                                  !0
   34     3      > RETURN                                                   null

End of function setpropertyb

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  __construct
number of ops:  12
compiled vars:  !0 = $myType
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
   37     1        INIT_METHOD_CALL                                         'setPropertyA'
          2        INIT_METHOD_CALL                                         !0, 'getPropertyA'
          3        DO_FCALL                                      0  $1      
          4        SEND_VAR                                                 $1
          5        DO_FCALL                                      0          
   38     6        INIT_METHOD_CALL                                         'setPropertyB'
          7        INIT_METHOD_CALL                                         !0, 'getPropertyB'
          8        DO_FCALL                                      0  $3      
          9        SEND_VAR                                                 $3
         10        DO_FCALL                                      0          
   39    11      > RETURN                                                   null

End of function __construct

End of class Traverse\Test\MyType.

Class Traverse\Test\MyTypeBuilder:
Function getpropertya:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  getPropertyA
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   FETCH_OBJ_R                                      ~0      '_propertyA'
          1      > RETURN                                                   ~0
   50     2*     > RETURN                                                   null

End of function getpropertya

Function setpropertya:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  setPropertyA
number of ops:  4
compiled vars:  !0 = $propertyA
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E >   RECV                                             !0      
   53     1        ASSIGN_OBJ                                               '_propertyA'
          2        OP_DATA                                                  !0
   54     3      > RETURN                                                   null

End of function setpropertya

Function getpropertyb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  getPropertyB
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   FETCH_OBJ_R                                      ~0      '_propertyB'
          1      > RETURN                                                   ~0
   58     2*     > RETURN                                                   null

End of function getpropertyb

Function setpropertyb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Qe8d7
function name:  setPropertyB
number of ops:  4
compiled vars:  !0 = $propertyB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   RECV                                             !0      
   61     1        ASSIGN_OBJ                                               '_propertyB'
          2        OP_DATA                                                  !0
   62     3      > RETURN                                                   null

End of function setpropertyb

End of class Traverse\Test\MyTypeBuilder.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.97 ms | 1404 KiB | 15 Q