3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Lädt Klassendefinitionen anhand eines Classmaparrays. * Der Arrayschlüssel entspricht dem Klassennamen und der Arraywert dem Pfad zur Klassendatei. * Alle Arrayschlüssel werden in Kleinbuchstaben gewandelt, um Fehler durch Groß- Kleinschreibung zu vermeiden. * @package Classloader */ class ClassmapAutoloader { /** * Classmap: array("Klassenname" => "Pfad zur Datei mit Klassendefinition"). * @var array */ protected $classmap; /** * Registriert die Funktion "loadClass" als Autoload-Funktion. * @param array Classmap. */ public function __construct(array $classmap = array()) { $this->classmap = array_change_key_case($classmap); spl_autoload_register('self::loadClass'); } /** * Fügt ein Array zur Classmap hinzu. * @param array Classmap. */ public function addClassmap(array $classmap) { $this->classmap = array_merge($this->classmap, array_change_key_case($classmap)); } /** * Includet die Datei, die die Klassendefinition enthält. * @param string Name der Klasse, die geladen werden soll. */ protected function loadClass($class_name) { $class_name = strtolower($class_name); if(isset($this->classmap[$class_name])) include $this->classmap[$class_name]; } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7qMc0
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E > > RETURN                                                   1

Class ClassmapAutoloader:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7qMc0
function name:  __construct
number of ops:  10
compiled vars:  !0 = $classmap
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV_INIT                                        !0      <array>
   23     1        INIT_FCALL                                               'array_change_key_case'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN_OBJ                                               'classmap'
          5        OP_DATA                                                  $2
   24     6        INIT_FCALL                                               'spl_autoload_register'
          7        SEND_VAL                                                 'self%3A%3AloadClass'
          8        DO_ICALL                                                 
   25     9      > RETURN                                                   null

End of function __construct

Function addclassmap:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7qMc0
function name:  addClassmap
number of ops:  12
compiled vars:  !0 = $classmap
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   33     1        INIT_FCALL                                               'array_merge'
          2        FETCH_OBJ_R                                      ~2      'classmap'
          3        SEND_VAL                                                 ~2
          4        INIT_FCALL                                               'array_change_key_case'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                         $4      
          9        ASSIGN_OBJ                                               'classmap'
         10        OP_DATA                                                  $4
   34    11      > RETURN                                                   null

End of function addclassmap

Function loadclass:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/7qMc0
function name:  loadClass
number of ops:  12
compiled vars:  !0 = $class_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
   42     1        INIT_FCALL                                               'strtolower'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   43     5        FETCH_OBJ_IS                                     ~3      'classmap'
          6        ISSET_ISEMPTY_DIM_OBJ                         0          ~3, !0
          7      > JMPZ                                                     ~4, ->11
   44     8    >   FETCH_OBJ_R                                      ~5      'classmap'
          9        FETCH_DIM_R                                      ~6      ~5, !0
         10        INCLUDE_OR_EVAL                                          ~6, INCLUDE
   45    11    > > RETURN                                                   null

End of function loadclass

End of class ClassmapAutoloader.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.03 ms | 1400 KiB | 21 Q