3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Container// implements \ArrayAccess { protected $values; protected function __construct (array $values = array()) { $this->values = $values; } /* ... */ } class ServiceContainer extends Container { protected static $instance; protected $storage; protected function __construct($storage) { $this->storage = $storage; } public static function init(ServiceStorageInterface $storage) { return static::$instance = new static($storage); } public static function getInstance() { if ( ! isset(static::$instance)) { throw new Exception('ServiceContainer is not initialized'); } return static::$instance; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oSEWV
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E > > RETURN                                                   1

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

End of function __construct

End of class Container.

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

End of function __construct

Function init:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oSEWV
function name:  init
number of ops:  8
compiled vars:  !0 = $storage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   25     1        NEW                          static              $2      
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN_STATIC_PROP                               ~1      'instance'
          5        OP_DATA                                                  $2
          6      > RETURN                                                   ~1
   26     7*     > RETURN                                                   null

End of function init

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oSEWV
function name:  getInstance
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~0      'instance'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->7
   31     3    >   NEW                                              $2      'Exception'
          4        SEND_VAL_EX                                              'ServiceContainer+is+not+initialized'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
   33     7    >   FETCH_STATIC_PROP_R          unknown             ~4      'instance'
          8      > RETURN                                                   ~4
   34     9*     > RETURN                                                   null

End of function getinstance

End of class ServiceContainer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.91 ms | 1399 KiB | 13 Q