3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CommandHandler { public function handle($cmd) { //... $this->eventBus->dispatch($events); } } interface EventBus { public function registerListener(Listener $listener); public function dispatch($events); // foreach $event traverse listeners calling when($event) } abstract class Listener { public function __construct(EventBus $bus) { $bus->registerListener($this); } public function when($event) { // call $this->onEvent() if it exsits } } class SomeListener { public function onSomeEvent($event) { // do something } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vXO9f
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E > > RETURN                                                   1

Class CommandHandler:
Function handle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vXO9f
function name:  handle
number of ops:  6
compiled vars:  !0 = $cmd, !1 = $events
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    7     1        FETCH_OBJ_R                                      ~2      'eventBus'
          2        INIT_METHOD_CALL                                         ~2, 'dispatch'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
    8     5      > RETURN                                                   null

End of function handle

End of class CommandHandler.

Class EventBus:
Function registerlistener:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vXO9f
function name:  registerListener
number of ops:  2
compiled vars:  !0 = $listener
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function registerlistener

Function dispatch:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vXO9f
function name:  dispatch
number of ops:  2
compiled vars:  !0 = $events
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function dispatch

End of class EventBus.

Class Listener:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vXO9f
function name:  __construct
number of ops:  6
compiled vars:  !0 = $bus
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        INIT_METHOD_CALL                                         !0, 'registerListener'
          2        FETCH_THIS                                       $1      
          3        SEND_VAR_EX                                              $1
          4        DO_FCALL                                      0          
   22     5      > RETURN                                                   null

End of function __construct

Function when:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vXO9f
function name:  when
number of ops:  2
compiled vars:  !0 = $event
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   27     1      > RETURN                                                   null

End of function when

End of class Listener.

Class SomeListener:
Function onsomeevent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vXO9f
function name:  onSomeEvent
number of ops:  2
compiled vars:  !0 = $event
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
   35     1      > RETURN                                                   null

End of function onsomeevent

End of class SomeListener.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.03 ms | 1390 KiB | 13 Q