3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Magnus; class ObjectDispatch { public function routeIterator(&$path) { while (!empty($path)) { yield end($path); array_pop($path); /* This prevents having to put back a value in the event of a * readjustment in the dispatch path. * Testing indicates that it's better to do array maninpulation than it is * to implement SplDoublyLinkedList for deque behavior. Likewise, * simply tracking the index is a bit slower and can add complexity * when dealing with reorients/redispatches. */ } } public function __invoke($context, $root) { $log = $context->getLogger(); $path = $context->getRequestPath(); $last = ''; $parent = null; $current = $root; $controllerPrefix = $context->getControllerPrefix(); if ($context->getAppMode() === 'DEBUG' && $log !== null) { $log->addDebug('Starting Object Dispatch', [ 'request' => $context->getRequestURI(), 'path' => var_export($path, true), 'root' => var_export($root, true) ]); } foreach ($this->routeIterator($path) as $chunk) { if ($context->getAppMode() === 'DEBUG' && $log !== null) { $log->addDebug('Beginning dispatch step.', [ 'chunk' => $chunk, 'path' => var_export($path, true), 'current' => var_export($current, true) ]); } if (!is_object($current) || class_exists($controllerPrefix . $current)) { if ($context->getAppMode() === 'DEBUG' && $log !== null) { $log->addDebug('Instantiating current class', [ 'request' => $context->getRequestURI(), 'current' => $current ]); } $resolvedClass = $controllerPrefix . $current; $current = new $resolvedClass($context); } if (is_object($current)) { $parent = $current; } if (in_array($chunk, get_class_methods($parent))) { if ($context->getAppMode() === 'DEBUG' && $log !== null) { $log->addDebug('Found an endpoint', [ 'request' => $context->getRequestURI(), 'isEndpoint' => true, 'parent' => var_export($parent, true), 'handler' => $chunk, 'arguments' => var_export($path, true) ]); } yield array($parent, $chunk, $path, true); } elseif (in_array($chunk, get_object_vars($parent))) { if ($context->getAppMode() === 'DEBUG' && $log !== null) { $log->addDebug('Found a property', [ 'request' => $context->getRequestURI(), 'property' => $chunk, 'parent' => var_export($parent, true) ]); } $current = $parent->chunk; } elseif (method_exists($parent, 'lookup')) { try { list($current, $consumed) = $parent->lookup($path); $chunk = implode('/', $consumed); $path = array_slice($path, 0, count($path) - count($consumed)); } catch (Exception $e) { throw new HTTPNotFound(); } } else { throw new HTTPNotFound(); } yield array(explode('/', $last), $parent, false); $last = $chunk; } if ($context->getAppMode() === 'DEBUG' && $log !== null) { $log->addDebug('No endpoint found', [ 'request' => $context->getRequestURI(), 'current' => var_export($current), 'parent' => var_export($parent) ]); } if (!is_object($current) && class_exists($controllerPrefix . $current)) { $resolvedClass = $controllerPrefix . $current; $current = new $resolvedClass($context); } if (is_callable($current)) { yield array($current, $chunk, $path, true); } elseif (is_callable($parent)) { yield array($parent, $chunk, $path, true); } } } class Context { protected $requestURI; protected $requestPath; protected $appMode; protected $logger; protected $controllerPrefix; public function __construct(Array $config) { $this->requestURI = isset($config['requestURI']) ? $config['requestURI'] : '/'; $this->appMode = isset($config['appMode']) ? $config['appMode'] : 'DEVELOPMENT'; $this->logger = isset($config['logger']) ? $config['logger'] : null; $this->controllerPrefix = isset($config['controllerPrefix']) ? $config['controllerPrefix'] : __NAMESPACE__ . '\\'; $this->requestPath = explode('/', str_replace('\\', '/', $this->requestURI)); if (end($this->requestPath) === '') { array_pop($this->requestPath); } $this->requestPath = array_reverse($this->requestPath); if (end($this->requestPath) === '') { array_pop($this->requestPath); } } public function getRequestURI() { return $this->requestURI; } public function getRequestPath() { return $this->requestPath; } public function getAppMode() { return $this->appMode; } public function getLogger() { return $this->logger; } public function getControllerPrefix() { return $this->controllerPrefix; } } class ScreenLog { public function __call($methodName, $args) { echo var_export($args, true) . "\n"; } } class RootController { public $home = 'homeController'; public function __invoke($args = array()) { return "Root controller index"; } } $context = new Context([ 'requestURI' => '/', 'logger' => new ScreenLog() ]); $dispatch = new ObjectDispatch(); foreach ($dispatch($context, 'RootController') as $signal) { list($object, $chunk, $path, $isEndpoint) = $signal; if ($isEndpoint) { echo $object->$chunk($path); } }
based on 2Yu0W
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 20, Position 2 = 35
Branch analysis from position: 20
Jump found. Position 1 = 21, Position 2 = 35
Branch analysis from position: 21
Jump found. Position 1 = 30, Position 2 = 34
Branch analysis from position: 30
Jump found. Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 34
Branch analysis from position: 35
Jump found. Position 1 = -2
Branch analysis from position: 35
filename:       /in/ONGbJ
function name:  (null)
number of ops:  37
compiled vars:  !0 = $context, !1 = $dispatch, !2 = $signal, !3 = $object, !4 = $chunk, !5 = $path, !6 = $isEndpoint
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   NOP                                                      
 126     1        NOP                                                      
 172     2        NOP                                                      
 178     3        NOP                                                      
 187     4        NEW                                              $11     :-6
 188     5        INIT_ARRAY                                       ~12     '%2F', 'requestURI'
 189     6        NEW                                              $13     :-2
         7        DO_FCALL                                      0          
         8        ADD_ARRAY_ELEMENT                                ~12     $13, 'logger'
         9        SEND_VAL_EX                                              ~12
        10        DO_FCALL                                      0          
        11        ASSIGN                                                   !0, $11
 192    12        NEW                                              $17     :1
        13        DO_FCALL                                      0          
        14        ASSIGN                                                   !1, $17
 194    15        INIT_DYNAMIC_CALL                                        !1
        16        SEND_VAR_EX                                              !0
        17        SEND_VAL_EX                                              'RootController'
        18        DO_FCALL                                      0  $20     
        19      > FE_RESET_R                                       $21     $20, ->35
        20    > > FE_FETCH_R                                               $21, !2, ->35
 195    21    >   FETCH_LIST                                       $22     !2, 0
        22        ASSIGN                                                   !3, $22
        23        FETCH_LIST                                       $24     !2, 1
        24        ASSIGN                                                   !4, $24
        25        FETCH_LIST                                       $26     !2, 2
        26        ASSIGN                                                   !5, $26
        27        FETCH_LIST                                       $28     !2, 3
        28        ASSIGN                                                   !6, $28
 196    29      > JMPZ                                                     !6, ->34
 197    30    >   INIT_METHOD_CALL                                         !3, !4
        31        SEND_VAR_EX                                              !5
        32        DO_FCALL                                      0  $30     
        33        ECHO                                                     $30
        34    > > JMP                                                      ->20
        35    >   FE_FREE                                                  $21
        36      > RETURN                                                   1

Class Magnus\ObjectDispatch:
Function routeiterator:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 9
Branch analysis from position: 9
Jump found. Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
Jump found. Position 1 = -2
Branch analysis from position: 2
Jump found. Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
Branch analysis from position: 2
filename:       /in/ONGbJ
function name:  routeIterator
number of ops:  13
compiled vars:  !0 = $path
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   6     0  E >   RECV                                             !0      
   7     1      > JMP                                                      ->9
   8     2    >   INIT_NS_FCALL_BY_NAME                                    
         3        SEND_VAR_EX                                              !0
         4        DO_FCALL                                      0  $1      
         5        YIELD                                                    $1
   9     6        INIT_NS_FCALL_BY_NAME                                    
         7        SEND_VAR_EX                                              !0
         8        DO_FCALL                                      0          
   7     9    >   ISSET_ISEMPTY_VAR                           293601280  ~4      !0
        10        BOOL_NOT                                         ~5      ~4
        11      > JMPNZ                                                    ~5, ->2
  18    12    > > GENERATOR_RETURN                                         

End of function routeiterator

Function __invoke:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
Jump found. Position 1 = 21, Position 2 = 38
Branch analysis from position: 21
Jump found. Position 1 = 42, Position 2 = 224
Branch analysis from position: 42
Jump found. Position 1 = 43, Position 2 = 224
Branch analysis from position: 43
Jump found. Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
Jump found. Position 1 = 50, Position 2 = 65
Branch analysis from position: 50
Jump found. Position 1 = 70, Position 2 = 75
Branch analysis from position: 70
Jump found. Position 1 = 76, Position 2 = 98
Branch analysis from position: 76
Jump found. Position 1 = 80, Position 2 = 82
Branch analysis from position: 80
Jump found. Position 1 = 83, Position 2 = 91
Branch analysis from position: 83
Jump found. Position 1 = 102, Position 2 = 103
Branch analysis from position: 102
Jump found. Position 1 = 111, Position 2 = 143
Branch analysis from position: 111
Jump found. Position 1 = 115, Position 2 = 117
Branch analysis from position: 115
Jump found. Position 1 = 118, Position 2 = 137
Branch analysis from position: 118
Jump found. Position 1 = 214
Branch analysis from position: 214
Jump found. Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 137
Branch analysis from position: 117
Branch analysis from position: 143
Jump found. Position 1 = 151, Position 2 = 174
Branch analysis from position: 151
Jump found. Position 1 = 155, Position 2 = 157
Branch analysis from position: 155
Jump found. Position 1 = 158, Position 2 = 171
Branch analysis from position: 158
Jump found. Position 1 = 214
Branch analysis from position: 214
Branch analysis from position: 171
Branch analysis from position: 157
Branch analysis from position: 174
Jump found. Position 1 = 179, Position 2 = 211
Branch analysis from position: 179
Jump found. Position 1 = 210
Branch analysis from position: 210
Jump found. Position 1 = 214
Branch analysis from position: 214
Branch analysis from position: 211
Jump found. Position 1 = -2
Branch analysis from position: 103
Branch analysis from position: 91
Branch analysis from position: 82
Branch analysis from position: 98
Branch analysis from position: 75
Branch analysis from position: 65
Branch analysis from position: 49
Branch analysis from position: 224
Jump found. Position 1 = 229, Position 2 = 231
Branch analysis from position: 229
Jump found. Position 1 = 232, Position 2 = 247
Branch analysis from position: 232
Jump found. Position 1 = 252, Position 2 = 257
Branch analysis from position: 252
Jump found. Position 1 = 258, Position 2 = 265
Branch analysis from position: 258
Jump found. Position 1 = 269, Position 2 = 275
Branch analysis from position: 269
Jump found. Position 1 = 284
Branch analysis from position: 284
Jump found. Position 1 = -2
Branch analysis from position: 275
Jump found. Position 1 = 279, Position 2 = 284
Branch analysis from position: 279
Jump found. Position 1 = -2
Branch analysis from position: 284
Branch analysis from position: 265
Branch analysis from position: 257
Branch analysis from position: 247
Branch analysis from position: 231
Branch analysis from position: 224
Branch analysis from position: 38
Branch analysis from position: 20
Found catch point at position: 206
Branch analysis from position: 206
Jump found. Position 1 = 207, Position 2 = -2
Branch analysis from position: 207
Jump found. Position 1 = -2
filename:       /in/ONGbJ
function name:  __invoke
number of ops:  285
compiled vars:  !0 = $context, !1 = $root, !2 = $log, !3 = $path, !4 = $last, !5 = $parent, !6 = $current, !7 = $controllerPrefix, !8 = $chunk, !9 = $resolvedClass, !10 = $consumed, !11 = $e
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  20     0  E >   RECV                                             !0      
         1        RECV                                             !1      
  21     2        INIT_METHOD_CALL                                         !0, 'getLogger'
         3        DO_FCALL                                      0  $12     
         4        ASSIGN                                                   !2, $12
  22     5        INIT_METHOD_CALL                                         !0, 'getRequestPath'
         6        DO_FCALL                                      0  $14     
         7        ASSIGN                                                   !3, $14
  23     8        ASSIGN                                                   !4, ''
  24     9        ASSIGN                                                   !5, null
  25    10        ASSIGN                                                   !6, !1
  26    11        INIT_METHOD_CALL                                         !0, 'getControllerPrefix'
        12        DO_FCALL                                      0  $19     
        13        ASSIGN                                                   !7, $19
  28    14        INIT_METHOD_CALL                                         !0, 'getAppMode'
        15        DO_FCALL                                      0  $21     
        16        IS_IDENTICAL                                     ~22     $21, 'DEBUG'
        17      > JMPZ_EX                                          ~22     ~22, ->20
        18    >   IS_NOT_IDENTICAL                                 ~23     !2, null
        19        BOOL                                             ~22     ~23
        20    > > JMPZ                                                     ~22, ->38
  29    21    >   INIT_METHOD_CALL                                         !2, 'addDebug'
        22        SEND_VAL_EX                                              'Starting+Object+Dispatch'
  30    23        INIT_METHOD_CALL                                         !0, 'getRequestURI'
        24        DO_FCALL                                      0  $24     
        25        INIT_ARRAY                                       ~25     $24, 'request'
  31    26        INIT_NS_FCALL_BY_NAME                                    
        27        SEND_VAR_EX                                              !3
        28        SEND_VAL_EX                                              <true>
        29        DO_FCALL                                      0  $26     
        30        ADD_ARRAY_ELEMENT                                ~25     $26, 'path'
  32    31        INIT_NS_FCALL_BY_NAME                                    
        32        SEND_VAR_EX                                              !1
        33        SEND_VAL_EX                                              <true>
        34        DO_FCALL                                      0  $27     
        35        ADD_ARRAY_ELEMENT                                ~25     $27, 'root'
        36        SEND_VAL_EX                                              ~25
        37        DO_FCALL                                      0          
  36    38    >   INIT_METHOD_CALL                                         'routeIterator'
        39        SEND_VAR_EX                                              !3
        40        DO_FCALL                                      0  $29     
        41      > FE_RESET_R                                       $30     $29, ->224
        42    > > FE_FETCH_R                                               $30, !8, ->224
  37    43    >   INIT_METHOD_CALL                                         !0, 'getAppMode'
        44        DO_FCALL                                      0  $31     
        45        IS_IDENTICAL                                     ~32     $31, 'DEBUG'
        46      > JMPZ_EX                                          ~32     ~32, ->49
        47    >   IS_NOT_IDENTICAL                                 ~33     !2, null
        48        BOOL                                             ~32     ~33
        49    > > JMPZ                                                     ~32, ->65
  38    50    >   INIT_METHOD_CALL                                         !2, 'addDebug'
        51        SEND_VAL_EX                                              'Beginning+dispatch+step.'
  39    52        INIT_ARRAY                                       ~34     !8, 'chunk'
  40    53        INIT_NS_FCALL_BY_NAME                                    
        54        SEND_VAR_EX                                              !3
        55        SEND_VAL_EX                                              <true>
        56        DO_FCALL                                      0  $35     
        57        ADD_ARRAY_ELEMENT                                ~34     $35, 'path'
  41    58        INIT_NS_FCALL_BY_NAME                                    
        59        SEND_VAR_EX                                              !6
        60        SEND_VAL_EX                                              <true>
        61        DO_FCALL                                      0  $36     
        62        ADD_ARRAY_ELEMENT                                ~34     $36, 'current'
        63        SEND_VAL_EX                                              ~34
        64        DO_FCALL                                      0          
  45    65    >   INIT_NS_FCALL_BY_NAME                                    
        66        SEND_VAR_EX                                              !6
        67        DO_FCALL                                      0  $38     
        68        BOOL_NOT                                         ~39     $38
        69      > JMPNZ_EX                                         ~39     ~39, ->75
        70    >   INIT_NS_FCALL_BY_NAME                                    
        71        CONCAT                                           ~40     !7, !6
        72        SEND_VAL_EX                                              ~40
        73        DO_FCALL                                      0  $41     
        74        BOOL                                             ~39     $41
        75    > > JMPZ                                                     ~39, ->98
  46    76    >   INIT_METHOD_CALL                                         !0, 'getAppMode'
        77        DO_FCALL                                      0  $42     
        78        IS_IDENTICAL                                     ~43     $42, 'DEBUG'
        79      > JMPZ_EX                                          ~43     ~43, ->82
        80    >   IS_NOT_IDENTICAL                                 ~44     !2, null
        81        BOOL                                             ~43     ~44
        82    > > JMPZ                                                     ~43, ->91
  47    83    >   INIT_METHOD_CALL                                         !2, 'addDebug'
        84        SEND_VAL_EX                                              'Instantiating+current+class'
  48    85        INIT_METHOD_CALL                                         !0, 'getRequestURI'
        86        DO_FCALL                                      0  $45     
        87        INIT_ARRAY                                       ~46     $45, 'request'
  49    88        ADD_ARRAY_ELEMENT                                ~46     !6, 'current'
        89        SEND_VAL_EX                                              ~46
        90        DO_FCALL                                      0          
  53    91    >   CONCAT                                           ~48     !7, !6
        92        ASSIGN                                                   !9, ~48
  54    93        FETCH_CLASS                                 512  :50     !9
        94        NEW                                              $51     :50
        95        SEND_VAR_EX                                              !0
        96        DO_FCALL                                      0          
        97        ASSIGN                                                   !6, $51
  57    98    >   INIT_NS_FCALL_BY_NAME                                    
        99        SEND_VAR_EX                                              !6
       100        DO_FCALL                                      0  $54     
       101      > JMPZ                                                     $54, ->103
  58   102    >   ASSIGN                                                   !5, !6
  61   103    >   INIT_NS_FCALL_BY_NAME                                    
       104        SEND_VAR_EX                                              !8
       105        INIT_NS_FCALL_BY_NAME                                    
       106        SEND_VAR_EX                                              !5
       107        DO_FCALL                                      0  $56     
       108        SEND_VAR_NO_REF                               4          $56
       109        DO_FCALL                                      0  $57     
       110      > JMPZ                                                     $57, ->143
  62   111    >   INIT_METHOD_CALL                                         !0, 'getAppMode'
       112        DO_FCALL                                      0  $58     
       113        IS_IDENTICAL                                     ~59     $58, 'DEBUG'
       114      > JMPZ_EX                                          ~59     ~59, ->117
       115    >   IS_NOT_IDENTICAL                                 ~60     !2, null
       116        BOOL                                             ~59     ~60
       117    > > JMPZ                                                     ~59, ->137
  63   118    >   INIT_METHOD_CALL                                         !2, 'addDebug'
       119        SEND_VAL_EX                                              'Found+an+endpoint'
  64   120        INIT_METHOD_CALL                                         !0, 'getRequestURI'
       121        DO_FCALL                                      0  $61     
       122        INIT_ARRAY                                       ~62     $61, 'request'
       123        ADD_ARRAY_ELEMENT                                ~62     <true>, 'isEndpoint'
  66   124        INIT_NS_FCALL_BY_NAME                                    
       125        SEND_VAR_EX                                              !5
       126        SEND_VAL_EX                                              <true>
       127        DO_FCALL                                      0  $63     
       128        ADD_ARRAY_ELEMENT                                ~62     $63, 'parent'
  67   129        ADD_ARRAY_ELEMENT                                ~62     !8, 'handler'
  68   130        INIT_NS_FCALL_BY_NAME                                    
       131        SEND_VAR_EX                                              !3
       132        SEND_VAL_EX                                              <true>
       133        DO_FCALL                                      0  $64     
       134        ADD_ARRAY_ELEMENT                                ~62     $64, 'arguments'
       135        SEND_VAL_EX                                              ~62
       136        DO_FCALL                                      0          
  72   137    >   INIT_ARRAY                                       ~66     !5
       138        ADD_ARRAY_ELEMENT                                ~66     !8
       139        ADD_ARRAY_ELEMENT                                ~66     !3
       140        ADD_ARRAY_ELEMENT                                ~66     <true>
       141        YIELD                                                    ~66
       142      > JMP                                                      ->214
  74   143    >   INIT_NS_FCALL_BY_NAME                                    
       144        SEND_VAR_EX                                              !8
       145        INIT_NS_FCALL_BY_NAME                                    
       146        SEND_VAR_EX                                              !5
       147        DO_FCALL                                      0  $68     
       148        SEND_VAR_NO_REF                               4          $68
       149        DO_FCALL                                      0  $69     
       150      > JMPZ                                                     $69, ->174
  75   151    >   INIT_METHOD_CALL                                         !0, 'getAppMode'
       152        DO_FCALL                                      0  $70     
       153        IS_IDENTICAL                                     ~71     $70, 'DEBUG'
       154      > JMPZ_EX                                          ~71     ~71, ->157
       155    >   IS_NOT_IDENTICAL                                 ~72     !2, null
       156        BOOL                                             ~71     ~72
       157    > > JMPZ                                                     ~71, ->171
  76   158    >   INIT_METHOD_CALL                                         !2, 'addDebug'
       159        SEND_VAL_EX                                              'Found+a+property'
  77   160        INIT_METHOD_CALL                                         !0, 'getRequestURI'
       161        DO_FCALL                                      0  $73     
       162        INIT_ARRAY                                       ~74     $73, 'request'
  78   163        ADD_ARRAY_ELEMENT                                ~74     !8, 'property'
  79   164        INIT_NS_FCALL_BY_NAME                                    
       165        SEND_VAR_EX                                              !5
       166        SEND_VAL_EX                                              <true>
       167        DO_FCALL                                      0  $75     
       168        ADD_ARRAY_ELEMENT                                ~74     $75, 'parent'
       169        SEND_VAL_EX                                              ~74
       170        DO_FCALL                                      0          
  83   171    >   FETCH_OBJ_R                                      $77     !5, 'chunk'
       172        ASSIGN                                                   !6, $77
       173      > JMP                                                      ->214
  85   174    >   INIT_NS_FCALL_BY_NAME                                    
       175        SEND_VAR_EX                                              !5
       176        SEND_VAL_EX                                              'lookup'
       177        DO_FCALL                                      0  $79     
       178      > JMPZ                                                     $79, ->211
  87   179    >   INIT_METHOD_CALL                                         !5, 'lookup'
       180        SEND_VAR_EX                                              !3
       181        DO_FCALL                                      0  $80     
       182        FETCH_LIST                                       $81     $80, 0
       183        ASSIGN                                                   !6, $81
       184        FETCH_LIST                                       $83     $80, 1
       185        ASSIGN                                                   !10, $83
       186        FREE                                                     $80
  88   187        INIT_NS_FCALL_BY_NAME                                    
       188        SEND_VAL_EX                                              '%2F'
       189        SEND_VAR_EX                                              !10
       190        DO_FCALL                                      0  $85     
       191        ASSIGN                                                   !8, $85
  89   192        INIT_NS_FCALL_BY_NAME                                    
       193        SEND_VAR_EX                                              !3
       194        SEND_VAL_EX                                              0
       195        INIT_NS_FCALL_BY_NAME                                    
       196        SEND_VAR_EX                                              !3
       197        DO_FCALL                                      0  $87     
       198        INIT_NS_FCALL_BY_NAME                                    
       199        SEND_VAR_EX                                              !10
       200        DO_FCALL                                      0  $88     
       201        SUB                                              ~89     $87, $88
       202        SEND_VAL_EX                                              ~89
       203        DO_FCALL                                      0  $90     
       204        ASSIGN                                                   !3, $90
       205      > JMP                                                      ->210
  90   206  E > > CATCH                                                    'Magnus%5CException', !11
  91   207    >   NEW                                              $92     :139
       208        DO_FCALL                                      0          
       209      > THROW                                         0          $92
       210    > > JMP                                                      ->214
  95   211    >   NEW                                              $94     :141
       212        DO_FCALL                                      0          
       213      > THROW                                         0          $94
  98   214    >   INIT_NS_FCALL_BY_NAME                                    
       215        SEND_VAL_EX                                              '%2F'
       216        SEND_VAR_EX                                              !4
       217        DO_FCALL                                      0  $96     
       218        INIT_ARRAY                                       ~97     $96
       219        ADD_ARRAY_ELEMENT                                ~97     !5
       220        ADD_ARRAY_ELEMENT                                ~97     <false>
       221        YIELD                                                    ~97
  99   222        ASSIGN                                                   !4, !8
       223      > JMP                                                      ->42
       224    >   FE_FREE                                                  $30
 103   225        INIT_METHOD_CALL                                         !0, 'getAppMode'
       226        DO_FCALL                                      0  $100    
       227        IS_IDENTICAL                                     ~101    $100, 'DEBUG'
       228      > JMPZ_EX                                          ~101    ~101, ->231
       229    >   IS_NOT_IDENTICAL                                 ~102    !2, null
       230        BOOL                                             ~101    ~102
       231    > > JMPZ                                                     ~101, ->247
 104   232    >   INIT_METHOD_CALL                                         !2, 'addDebug'
       233        SEND_VAL_EX                                              'No+endpoint+found'
 105   234        INIT_METHOD_CALL                                         !0, 'getRequestURI'
       235        DO_FCALL                                      0  $103    
       236        INIT_ARRAY                                       ~104    $103, 'request'
 106   237        INIT_NS_FCALL_BY_NAME                                    
       238        SEND_VAR_EX                                              !6
       239        DO_FCALL                                      0  $105    
       240        ADD_ARRAY_ELEMENT                                ~104    $105, 'current'
 107   241        INIT_NS_FCALL_BY_NAME                                    
       242        SEND_VAR_EX                                              !5
       243        DO_FCALL                                      0  $106    
       244        ADD_ARRAY_ELEMENT                                ~104    $106, 'parent'
       245        SEND_VAL_EX                                              ~104
       246        DO_FCALL                                      0          
 111   247    >   INIT_NS_FCALL_BY_NAME                                    
       248        SEND_VAR_EX                                              !6
       249        DO_FCALL                                      0  $108    
       250        BOOL_NOT                                         ~109    $108
       251      > JMPZ_EX                                          ~109    ~109, ->257
       252    >   INIT_NS_FCALL_BY_NAME                                    
       253        CONCAT                                           ~110    !7, !6
       254        SEND_VAL_EX                                              ~110
       255        DO_FCALL                                      0  $111    
       256        BOOL                                             ~109    $111
       257    > > JMPZ                                                     ~109, ->265
 112   258    >   CONCAT                                           ~112    !7, !6
       259        ASSIGN                                                   !9, ~112
 113   260        FETCH_CLASS                                 512  :114    !9
       261        NEW                                              $115    :114
       262        SEND_VAR_EX                                              !0
       263        DO_FCALL                                      0          
       264        ASSIGN                                                   !6, $115
 116   265    >   INIT_NS_FCALL_BY_NAME                                    
       266        SEND_VAR_EX                                              !6
       267        DO_FCALL                                      0  $118    
       268      > JMPZ                                                     $118, ->275
 117   269    >   INIT_ARRAY                                       ~119    !6
       270        ADD_ARRAY_ELEMENT                                ~119    !8
       271        ADD_ARRAY_ELEMENT                                ~119    !3
       272        ADD_ARRAY_ELEMENT                                ~119    <true>
       273        YIELD                                                    ~119
       274      > JMP                                                      ->284
 118   275    >   INIT_NS_FCALL_BY_NAME                                    
       276        SEND_VAR_EX                                              !5
       277        DO_FCALL                                      0  $121    
       278      > JMPZ                                                     $121, ->284
 119   279    >   INIT_ARRAY                                       ~122    !5
       280        ADD_ARRAY_ELEMENT                                ~122    !8
       281        ADD_ARRAY_ELEMENT                                ~122    !3
       282        ADD_ARRAY_ELEMENT                                ~122    <true>
       283        YIELD                                                    ~122
 122   284    > > GENERATOR_RETURN                                         

End of 

Generated using Vulcan Logic Dumper, using php 7.3.0