3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Container main class. * * @author Fabien Potencier */ class Container implements \ArrayAccess { private $values = array(); private $factories; private $protected; private $frozen = array(); private $raw = array(); private $keys = array(); /** * Instantiate the container. * * Objects and parameters can be passed as argument to the constructor. * * @param array $values The parameters or objects. */ public function __construct(array $values = array()) { $this->factories = new \SplObjectStorage(); $this->protected = new \SplObjectStorage(); foreach ($values as $key => $value) { $this->offsetSet($key, $value); } } /** * Sets a parameter or an object. * * Objects must be defined as Closures. * * Allowing any PHP callable leads to difficult to debug problems * as function names (strings) are callable (creating a function with * the same name as an existing parameter would break your container). * * @param string $id The unique identifier for the parameter or object * @param mixed $value The value of the parameter or a closure to define an object * @throws \RuntimeException Prevent override of a frozen service */ public function offsetSet($id, $value) { if (isset($this->frozen[$id])) { throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id)); } $this->values[$id] = $value; $this->keys[$id] = true; } /** * Gets a parameter or an object. * * @param string $id The unique identifier for the parameter or object * * @return mixed The value of the parameter or an object * * @throws \InvalidArgumentException if the identifier is not defined */ public function offsetGet($id) { if (!isset($this->keys[$id])) { throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); } if ( isset($this->raw[$id]) || !is_object($this->values[$id]) || isset($this->protected[$this->values[$id]]) || !method_exists($this->values[$id], '__invoke') ) { return $this->values[$id]; } if (isset($this->factories[$this->values[$id]])) { return $this->values[$id]($this); } $this->frozen[$id] = true; $this->raw[$id] = $this->values[$id]; return $this->values[$id] = $this->values[$id]($this); } /** * Checks if a parameter or an object is set. * * @param string $id The unique identifier for the parameter or object * * @return bool */ public function offsetExists($id) { return isset($this->keys[$id]); } /** * Unsets a parameter or an object. * * @param string $id The unique identifier for the parameter or object */ public function offsetUnset($id) { if (isset($this->keys[$id])) { if (is_object($this->values[$id])) { unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]); } unset($this->values[$id], $this->frozen[$id], $this->raw[$id], $this->keys[$id]); } } /** * Marks a callable as being a factory service. * * @param callable $callable A service definition to be used as a factory * * @return callable The passed callable * * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object */ public function factory($callable) { if (!is_object($callable) || !method_exists($callable, '__invoke')) { throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.'); } $this->factories->attach($callable); return $callable; } /** * Protects a callable from being interpreted as a service. * * This is useful when you want to store a callable as a parameter. * * @param callable $callable A callable to protect from being evaluated * * @return callable The passed callable * * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object */ public function protect($callable) { if (!is_object($callable) || !method_exists($callable, '__invoke')) { throw new \InvalidArgumentException('Callable is not a Closure or invokable object.'); } $this->protected->attach($callable); return $callable; } /** * Gets a parameter or the closure defining an object. * * @param string $id The unique identifier for the parameter or object * * @return mixed The value of the parameter or the closure defining an object * * @throws \InvalidArgumentException if the identifier is not defined */ public function raw($id) { if (!isset($this->keys[$id])) { throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); } if (isset($this->raw[$id])) { return $this->raw[$id]; } return $this->values[$id]; } /** * Extends an object definition. * * Useful when you want to extend an existing object definition, * without necessarily loading that object. * * @param string $id The unique identifier for the object * @param callable $callable A service definition to extend the original * * @return callable The wrapped callable * * @throws \InvalidArgumentException if the identifier is not defined or not a service definition */ public function extend($id, $callable) { if (!isset($this->keys[$id])) { throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); } if (!is_object($this->values[$id]) || !method_exists($this->values[$id], '__invoke')) { throw new \InvalidArgumentException(sprintf('Identifier "%s" does not contain an object definition.', $id)); } if (!is_object($callable) || !method_exists($callable, '__invoke')) { throw new \InvalidArgumentException('Extension service definition is not a Closure or invokable object.'); } $factory = $this->values[$id]; $extended = function ($c) use ($callable, $factory) { return $callable($factory($c), $c); }; if (isset($this->factories[$factory])) { $this->factories->detach($factory); $this->factories->attach($extended); } return $this[$id] = $extended; } /** * Returns all defined value names. * * @return array An array of value names */ public function keys() { return array_keys($this->values); } /** * Registers a service provider. * * @param ServiceProviderInterface $provider A ServiceProviderInterface instance * @param array $values An array of values that customizes the provider * * @return static */ public function register(ServiceProviderInterface $provider, array $values = array()) { $provider->register($this); foreach ($values as $key => $value) { $this[$key] = $value; } return $this; } } $container = new Container(); $foo = new \StdClass(); $foo->bar = 'fiz'; $container['foo'] = $foo; var_dump($container['foo']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QMahl
function name:  (null)
number of ops:  16
compiled vars:  !0 = $container, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'container'
  254     1        NEW                                              $2      'Container'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
  256     4        NEW                                              $5      'StdClass'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
  257     7        ASSIGN_OBJ                                               !1, 'bar'
          8        OP_DATA                                                  'fiz'
  258     9        ASSIGN_DIM                                               !0, 'foo'
         10        OP_DATA                                                  !1
  260    11        INIT_FCALL                                               'var_dump'
         12        FETCH_DIM_R                                      ~10     !0, 'foo'
         13        SEND_VAL                                                 ~10
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FQMahl%3A212%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QMahl
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $c, !1 = $callable, !2 = $factory
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  212     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
  213     3        INIT_DYNAMIC_CALL                                        !1
          4        INIT_DYNAMIC_CALL                                        !2
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $3      
          7        SEND_VAR_NO_REF_EX                                       $3
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $4      
         10      > RETURN                                                   $4
  214    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FQMahl%3A212%240

Class Container:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/QMahl
function name:  __construct
number of ops:  19
compiled vars:  !0 = $values, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV_INIT                                        !0      <array>
   26     1        NEW                                              $4      'SplObjectStorage'
          2        DO_FCALL                                      0          
          3        ASSIGN_OBJ                                               'factories'
          4        OP_DATA                                                  $4
   27     5        NEW                                              $7      'SplObjectStorage'
          6        DO_FCALL                                      0          
          7        ASSIGN_OBJ                                               'protected'
          8        OP_DATA                                                  $7
   29     9      > FE_RESET_R                                       $9      !0, ->17
         10    > > FE_FETCH_R                                       ~10     $9, !1, ->17
         11    >   ASSIGN                                                   !2, ~10
   30    12        INIT_METHOD_CALL                                         'offsetSet'
         13        SEND_VAR_EX                                              !2
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
   29    16      > JMP                                                      ->10
         17    >   FE_FREE                                                  $9
   32    18      > RETURN                                                   null

End of function __construct

Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QMahl
function name:  offsetSet
number of ops:  20
compiled vars:  !0 = $id, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   49     2        FETCH_OBJ_IS                                     ~2      'frozen'
          3        ISSET_ISEMPTY_DIM_OBJ                         0          ~2, !0
          4      > JMPZ                                                     ~3, ->13
   50     5    >   NEW                                              $4      'RuntimeException'
          6        INIT_FCALL                                               'sprintf'
          7        SEND_VAL                                                 'Cannot+override+frozen+service+%22%25s%22.'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        SEND_VAR_NO_REF_EX                                       $5
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $4
   53    13    >   FETCH_OBJ_W                                      $7      'values'
         14        ASSIGN_DIM                                               $7, !0
         15        OP_DATA                                                  !1
   54    16        FETCH_OBJ_W                                      $9      'keys'
         17        ASSIGN_DIM                                               $9, !0
         18        OP_DATA                                                  <true>
   55    19      > RETURN                                                   null

End of function offsetset

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 47) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 47) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
2 jumps found. (Code = 47) Position 1 = 28, Position 2 = 36
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 40
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 52
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 27
Branch analysis from position: 21
filename:       /in/QMahl
function name:  offsetGet
number of ops:  71
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   66     0  E >   RECV                                             !0      
   68     1        FETCH_OBJ_IS                                     ~1      'keys'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->13
   69     5    >   NEW                                              $4      'InvalidArgumentException'
          6        INIT_FCALL                                               'sprintf'
          7        SEND_VAL                                                 'Identifier+%22%25s%22+is+not+defined.'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        SEND_VAR_NO_REF_EX                                       $5
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $4
   73    13    >   FETCH_OBJ_IS                                     ~7      'raw'
         14        ISSET_ISEMPTY_DIM_OBJ                         0  ~8      ~7, !0
         15      > JMPNZ_EX                                         ~8      ~8, ->21
   74    16    >   FETCH_OBJ_R                                      ~9      'values'
         17        FETCH_DIM_R                                      ~10     ~9, !0
         18        TYPE_CHECK                                  256  ~11     ~10
         19        BOOL_NOT                                         ~12     ~11
         20        BOOL                                             ~8      ~12
         21    > > JMPNZ_EX                                         ~8      ~8, ->27
   75    22    >   FETCH_OBJ_R                                      ~14     'values'
         23        FETCH_DIM_R                                      ~15     ~14, !0
         24        FETCH_OBJ_IS                                     ~13     'protected'
         25        ISSET_ISEMPTY_DIM_OBJ                         0  ~16     ~13, ~15
         26        BOOL                                             ~8      ~16
         27    > > JMPNZ_EX                                         ~8      ~8, ->36
   76    28    >   INIT_FCALL                                               'method_exists'
         29        FETCH_OBJ_R                                      ~17     'values'
         30        FETCH_DIM_R                                      ~18     ~17, !0
         31        SEND_VAL                                                 ~18
         32        SEND_VAL                                                 '__invoke'
         33        DO_ICALL                                         $19     
         34        BOOL_NOT                                         ~20     $19
         35        BOOL                                             ~8      ~20
         36    > > JMPZ                                                     ~8, ->40
   78    37    >   FETCH_OBJ_R                                      ~21     'values'
         38        FETCH_DIM_R                                      ~22     ~21, !0
         39      > RETURN                                                   ~22
   81    40    >   FETCH_OBJ_R                                      ~24     'values'
         41        FETCH_DIM_R                                      ~25     ~24, !0
         42        FETCH_OBJ_IS                                     ~23     'factories'
         43        ISSET_ISEMPTY_DIM_OBJ                         0          ~23, ~25
         44      > JMPZ                                                     ~26, ->52
   82    45    >   FETCH_OBJ_R                                      ~27     'values'
         46        FETCH_DIM_R                                      ~28     ~27, !0
         47        INIT_DYNAMIC_CALL                                        ~28
         48        FETCH_THIS                                       $29     
         49        SEND_VAR_EX                                              $29
         50        DO_FCALL                                      0  $30     
         51      > RETURN                                                   $30
   85    52    >   FETCH_OBJ_W                                      $31     'frozen'
         53        ASSIGN_DIM                                               $31, !0
         54        OP_DATA                                                  <true>
   86    55        FETCH_OBJ_R                                      ~35     'values'
         56        FETCH_DIM_R                                      ~36     ~35, !0
         57        FETCH_OBJ_W                                      $33     'raw'
         58        ASSIGN_DIM                                               $33, !0
         59        OP_DATA                                                  ~36
   88    60        FETCH_OBJ_R                                      ~39     'values'
         61        FETCH_DIM_R                                      ~40     ~39, !0
         62        INIT_DYNAMIC_CALL                                        ~40
         63        FETCH_THIS                                       $41     
         64        SEND_VAR_EX                                              $41
         65        DO_FCALL                                      0  $42     
         66        FETCH_OBJ_W                                      $37     'values'
         67        ASSIGN_DIM                                       ~38     $37, !0
         68        OP_DATA                                                  $42
         69      > RETURN                                                   ~38
   89    70*     > RETURN                                                   null

End of function offsetget

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QMahl
function name:  offsetExists
number of ops:  5
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   98     0  E >   RECV                                             !0      
  100     1        FETCH_OBJ_IS                                     ~1      'keys'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3      > RETURN                                                   ~2
  101     4*     > RETURN                                                   null

End of function offsetexists

Function offsetunset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 24
filename:       /in/QMahl
function name:  offsetUnset
number of ops:  25
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  108     0  E >   RECV                                             !0      
  110     1        FETCH_OBJ_IS                                     ~1      'keys'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, !0
          3      > JMPZ                                                     ~2, ->24
  111     4    >   FETCH_OBJ_R                                      ~3      'values'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6        TYPE_CHECK                                  256          ~4
          7      > JMPZ                                                     ~5, ->16
  112     8    >   FETCH_OBJ_R                                      ~7      'values'
          9        FETCH_DIM_R                                      ~8      ~7, !0
         10        FETCH_OBJ_UNSET                                  $6      'factories'
         11        UNSET_DIM                                                $6, ~8
         12        FETCH_OBJ_R                                      ~10     'values'
         13        FETCH_DIM_R                                      ~11     ~10, !0
         14        FETCH_OBJ_UNSET                                  $9      'protected'
         15        UNSET_DIM                                                $9, ~11
  115    16    >   FETCH_OBJ_UNSET                                  $12     'values'
         17        UNSET_DIM                                                $12, !0
         18        FETCH_OBJ_UNSET                                  $13     'frozen'
         19        UNSET_DIM                                                $13, !0
         20        FETCH_OBJ_UNSET                                  $14     'raw'
         21        UNSET_DIM                                                $14, !0
         22        FETCH_OBJ_UNSET                                  $15     'keys'
         23        UNSET_DIM                                                $15, !0
  117    24    > > RETURN                                                   null

End of function offsetunset

Function factory:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/QMahl
function name:  factory
number of ops:  21
compiled vars:  !0 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  128     0  E >   RECV                                             !0      
  130     1        TYPE_CHECK                                  256  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPNZ_EX                                         ~2      ~2, ->10
          4    >   INIT_FCALL                                               'method_exists'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 '__invoke'
          7        DO_ICALL                                         $3      
          8        BOOL_NOT                                         ~4      $3
          9        BOOL                                             ~2      ~4
         10    > > JMPZ                                                     ~2, ->15
  131    11    >   NEW                                              $5      'InvalidArgumentException'
         12        SEND_VAL_EX                                              'Service+definition+is+not+a+Closure+or+invokable+object.'
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $5
  134    15    >   FETCH_OBJ_R                                      ~7      'factories'
         16        INIT_METHOD_CALL                                         ~7, 'attach'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0          
  136    19      > RETURN                                                   !0
  137    20*     > RETURN                                                   null

End of function factory

Function protect:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/QMahl
function name:  protect
number of ops:  21
compiled vars:  !0 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  150     0  E >   RECV                                             !0      
  152     1        TYPE_CHECK                                  256  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPNZ_EX                                         ~2      ~2, ->10
          4    >   INIT_FCALL                                               'method_exists'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 '__invoke'
          7        DO_ICALL                                         $3      
          8        BOOL_NOT                                         ~4      $3
          9        BOOL                                             ~2      ~4
         10    > > JMPZ                                                     ~2, ->15
  153    11    >   NEW                                              $5      'InvalidArgumentException'
         12        SEND_VAL_EX                                              'Callable+is+not+a+Closure+or+invokable+object.'
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $5
  156    15    >   FETCH_OBJ_R                                      ~7      'protected'
         16        INIT_METHOD_CALL                                         ~7, 'attach'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0          
  158    19      > RETURN                                                   !0
  159    20*     > RETURN                                                   null

End of function protect

Function raw:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QMahl
function name:  raw
number of ops:  23
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  170     0  E >   RECV                                             !0      
  172     1        FETCH_OBJ_IS                                     ~1      'keys'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->13
  173     5    >   NEW                                              $4      'InvalidArgumentException'
          6        INIT_FCALL                                               'sprintf'
          7        SEND_VAL                                                 'Identifier+%22%25s%22+is+not+defined.'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        SEND_VAR_NO_REF_EX                                       $5
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $4
  176    13    >   FETCH_OBJ_IS                                     ~7      'raw'
         14        ISSET_ISEMPTY_DIM_OBJ                         0          ~7, !0
         15      > JMPZ                                                     ~8, ->19
  177    16    >   FETCH_OBJ_R                                      ~9      'raw'
         17        FETCH_DIM_R                                      ~10     ~9, !0
         18      > RETURN                                                   ~10
  180    19    >   FETCH_OBJ_R                                      ~11     'values'
         20        FETCH_DIM_R                                      ~12     ~11, !0
         21      > RETURN                                                   ~12
  181    22*     > RETURN                                                   null

End of function raw

Function extend:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 47) Position 1 = 19, Position 2 = 27
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 36
Branch analysis from position: 28
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 36
2 jumps found. (Code = 47) Position 1 = 39, Position 2 = 45
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 50
Branch analysis from position: 46
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 60, Position 2 = 68
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 68
Branch analysis from position: 45
Branch analysis from position: 27
filename:       /in/QMahl
function name:  extend
number of ops:  73
compiled vars:  !0 = $id, !1 = $callable, !2 = $factory, !3 = $extended
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  196     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  198     2        FETCH_OBJ_IS                                     ~4      'keys'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      ~4, !0
          4        BOOL_NOT                                         ~6      ~5
          5      > JMPZ                                                     ~6, ->14
  199     6    >   NEW                                              $7      'InvalidArgumentException'
          7        INIT_FCALL                                               'sprintf'
          8        SEND_VAL                                                 'Identifier+%22%25s%22+is+not+defined.'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $8      
         11        SEND_VAR_NO_REF_EX                                       $8
         12        DO_FCALL                                      0          
         13      > THROW                                         0          $7
  202    14    >   FETCH_OBJ_R                                      ~10     'values'
         15        FETCH_DIM_R                                      ~11     ~10, !0
         16        TYPE_CHECK                                  256  ~12     ~11
         17        BOOL_NOT                                         ~13     ~12
         18      > JMPNZ_EX                                         ~13     ~13, ->27
         19    >   INIT_FCALL                                               'method_exists'
         20        FETCH_OBJ_R                                      ~14     'values'
         21        FETCH_DIM_R                                      ~15     ~14, !0
         22        SEND_VAL                                                 ~15
         23        SEND_VAL                                                 '__invoke'
         24        DO_ICALL                                         $16     
         25        BOOL_NOT                                         ~17     $16
         26        BOOL                                             ~13     ~17
         27    > > JMPZ                                                     ~13, ->36
  203    28    >   NEW                                              $18     'InvalidArgumentException'
         29        INIT_FCALL                                               'sprintf'
         30        SEND_VAL                                                 'Identifier+%22%25s%22+does+not+contain+an+object+definition.'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $19     
         33        SEND_VAR_NO_REF_EX                                       $19
         34        DO_FCALL                                      0          
         35      > THROW                                         0          $18
  206    36    >   TYPE_CHECK                                  256  ~21     !1
         37        BOOL_NOT                                         ~22     ~21
         38      > JMPNZ_EX                                         ~22     ~22, ->45
         39    >   INIT_FCALL                                               'method_exists'
         40        SEND_VAR                                                 !1
         41        SEND_VAL                                                 '__invoke'
         42        DO_ICALL                                         $23     
         43        BOOL_NOT                                         ~24     $23
         44        BOOL                                             ~22     ~24
         45    > > JMPZ                                                     ~22, ->50
  207    46    >   NEW                                              $25     'InvalidArgumentException'
         47        SEND_VAL_EX                                              'Extension+service+definition+is+not+a+Closure+or+invokable+object.'
         48        DO_FCALL                                      0          
         49      > THROW                                         0          $25
  210    50    >   FETCH_OBJ_R                                      ~27     'values'
         51        FETCH_DIM_R                                      ~28     ~27, !0
         52        ASSIGN                                                   !2, ~28
  212    53        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FQMahl%3A212%240'
         54        BIND_LEXICAL                                             ~30, !1
         55        BIND_LEXICAL                                             ~30, !2
         56        ASSIGN                                                   !3, ~30
  216    57        FETCH_OBJ_IS                                     ~32     'factories'
         58        ISSET_ISEMPTY_DIM_OBJ                         0          ~32, !2
         59      > JMPZ                                                     ~33, ->68
  217    60    >   FETCH_OBJ_R                                      ~34     'fact

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.4 ms | 1428 KiB | 19 Q