3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class AbstractRouter { protected function match() { throw new \RuntimeException('This method ca\'nt be called directly'); } } class UrlMatcher extends AbstractRouter { protected function match() { return 'blablabla'; } } //middleware class Router extends AbstractRouter { private $matcher; public function __construct($matcher) { $this->matcher = $matcher; } public function process() { return $this->matcher->match(); } } $router = new Router(new urlMatcher()); echo $router->process();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GZEXt
function name:  (null)
number of ops:  10
compiled vars:  !0 = $router
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $1      'Router'
          1        NEW                                              $2      'urlMatcher'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   35     6        INIT_METHOD_CALL                                         !0, 'process'
          7        DO_FCALL                                      0  $6      
          8        ECHO                                                     $6
          9      > RETURN                                                   1

Class AbstractRouter:
Function match:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/GZEXt
function name:  match
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $0      'RuntimeException'
          1        SEND_VAL_EX                                              'This+method+ca%27nt+be+called+directly'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $0
    8     4*     > RETURN                                                   null

End of function match

End of class AbstractRouter.

Class UrlMatcher:
Function match:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GZEXt
function name:  match
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > RETURN                                                   'blablabla'
   16     1*     > RETURN                                                   null

End of function match

End of class UrlMatcher.

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

End of function __construct

Function process:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GZEXt
function name:  process
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   FETCH_OBJ_R                                      ~0      'matcher'
          1        INIT_METHOD_CALL                                         ~0, 'match'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
   31     4*     > RETURN                                                   null

End of function process

Function match:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/GZEXt
function name:  match
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $0      'RuntimeException'
          1        SEND_VAL_EX                                              'This+method+ca%27nt+be+called+directly'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $0
    8     4*     > RETURN                                                   null

End of function match

End of class Router.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.53 ms | 1007 KiB | 13 Q