3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DIContainer1 implements ArrayAccess { private array $registered; private array $created; public function offsetSet(mixed $offset, mixed $value): void { if (is_null($offset)) { throw new DIContainerException('Обязательно должен быть указан ключ.'); } if (array_key_exists($offset, $this->registered)) { throw new DIContainerException('Нельзя использовать один и тот же ключ для нескольких элементов.'); } $this->registered[$offset] = $value; } public function offsetExists(mixed $offset): bool { return isset($this->registered[$offset]); } public function offsetUnset(mixed $offset): void { unset($this->registered[$offset]); unset($this->created[$offset]); } public function offsetGet(mixed $offset): mixed { if (array_key_exists($offset, $this->created)) { return $this->created[$offset]; } elseif (array_key_exists($offset, $this->registered)) { $object = $this->registered[$offset]($this); $this->created[$offset] = $object; return $object; } else { throw new DIContainerException('Элемент с таким ключом не зарегистрирован.'); } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yhuue
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'dicontainer1'
   44     1      > RETURN                                                   1

Class DIContainer1:
Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
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
filename:       /in/Yhuue
function name:  offsetSet
number of ops:  19
compiled vars:  !0 = $offset, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        TYPE_CHECK                                    2          !0
          3      > JMPZ                                                     ~2, ->8
   11     4    >   NEW                                              $3      'DIContainerException'
          5        SEND_VAL_EX                                              '%D0%9E%D0%B1%D1%8F%D0%B7%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE+%D0%B4%D0%BE%D0%BB%D0%B6%D0%B5%D0%BD+%D0%B1%D1%8B%D1%82%D1%8C+%D1%83%D0%BA%D0%B0%D0%B7%D0%B0%D0%BD+%D0%BA%D0%BB%D1%8E%D1%87.'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $3
   14     8    >   FETCH_OBJ_R                                      ~5      'registered'
          9        ARRAY_KEY_EXISTS                                         !0, ~5
         10      > JMPZ                                                     ~6, ->15
   15    11    >   NEW                                              $7      'DIContainerException'
         12        SEND_VAL_EX                                              '%D0%9D%D0%B5%D0%BB%D1%8C%D0%B7%D1%8F+%D0%B8%D1%81%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D1%8C+%D0%BE%D0%B4%D0%B8%D0%BD+%D0%B8+%D1%82%D0%BE%D1%82+%D0%B6%D0%B5+%D0%BA%D0%BB%D1%8E%D1%87+%D0%B4%D0%BB%D1%8F+%D0%BD%D0%B5%D1%81%D0%BA%D0%BE%D0%BB%D1%8C%D0%BA%D0%B8%D1%85+%D1%8D%D0%BB%D0%B5%D0%BC%D0%B5%D0%BD%D1%82%D0%BE%D0%B2.'
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $7
   18    15    >   FETCH_OBJ_W                                      $9      'registered'
         16        ASSIGN_DIM                                               $9, !0
         17        OP_DATA                                                  !1
   19    18      > RETURN                                                   null

End of function offsetset

Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yhuue
function name:  offsetExists
number of ops:  7
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        FETCH_OBJ_IS                                     ~1      'registered'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
   24     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function offsetexists

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yhuue
function name:  offsetUnset
number of ops:  6
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   28     1        FETCH_OBJ_UNSET                                  $1      'registered'
          2        UNSET_DIM                                                $1, !0
   29     3        FETCH_OBJ_UNSET                                  $2      'created'
          4        UNSET_DIM                                                $2, !0
   30     5      > RETURN                                                   null

End of function offsetunset

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 23
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/Yhuue
function name:  offsetGet
number of ops:  29
compiled vars:  !0 = $offset, !1 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   34     1        FETCH_OBJ_R                                      ~2      'created'
          2        ARRAY_KEY_EXISTS                                         !0, ~2
          3      > JMPZ                                                     ~3, ->8
   35     4    >   FETCH_OBJ_R                                      ~4      'created'
          5        FETCH_DIM_R                                      ~5      ~4, !0
          6      > RETURN                                                   ~5
   34     7*       JMP                                                      ->27
   36     8    >   FETCH_OBJ_R                                      ~6      'registered'
          9        ARRAY_KEY_EXISTS                                         !0, ~6
         10      > JMPZ                                                     ~7, ->23
   37    11    >   FETCH_OBJ_R                                      ~8      'registered'
         12        FETCH_DIM_R                                      ~9      ~8, !0
         13        INIT_DYNAMIC_CALL                                        ~9
         14        FETCH_THIS                                       $10     
         15        SEND_VAR_EX                                              $10
         16        DO_FCALL                                      0  $11     
         17        ASSIGN                                                   !1, $11
   38    18        FETCH_OBJ_W                                      $13     'created'
         19        ASSIGN_DIM                                               $13, !0
         20        OP_DATA                                                  !1
   39    21      > RETURN                                                   !1
   36    22*       JMP                                                      ->27
   41    23    >   NEW                                              $15     'DIContainerException'
         24        SEND_VAL_EX                                              '%D0%AD%D0%BB%D0%B5%D0%BC%D0%B5%D0%BD%D1%82+%D1%81+%D1%82%D0%B0%D0%BA%D0%B8%D0%BC+%D0%BA%D0%BB%D1%8E%D1%87%D0%BE%D0%BC+%D0%BD%D0%B5+%D0%B7%D0%B0%D1%80%D0%B5%D0%B3%D0%B8%D1%81%D1%82%D1%80%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD.'
         25        DO_FCALL                                      0          
         26      > THROW                                         0          $15
   43    27*       VERIFY_RETURN_TYPE                                       
         28*     > RETURN                                                   null

End of function offsetget

End of class DIContainer1.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.05 ms | 1004 KiB | 13 Q