@@ -23,7 +23,7 @@ class Psr4Autoloader
2323 */
2424 public function register ()
2525 {
26- spl_autoload_register ([$ this , 'loadClass ' ]);
26+ \ spl_autoload_register ([$ this , 'loadClass ' ]);
2727 }
2828
2929 /**
@@ -40,10 +40,10 @@ public function register()
4040 public function addNamespace ($ prefix , $ baseDir , $ prepend = false )
4141 {
4242 // normalize namespace prefix
43- $ prefix = trim ($ prefix , '\\' ) . '\\' ;
43+ $ prefix = \ trim ($ prefix , '\\' ) . '\\' ;
4444
4545 // normalize the base directory with a trailing separator
46- $ baseDir = rtrim ($ baseDir , DIRECTORY_SEPARATOR ) . '/ ' ;
46+ $ baseDir = \ rtrim ($ baseDir , DIRECTORY_SEPARATOR ) . '/ ' ;
4747
4848 // initialize the namespace prefix array
4949 if (isset ($ this ->prefixes [$ prefix ]) === false ) {
@@ -52,9 +52,9 @@ public function addNamespace($prefix, $baseDir, $prepend = false)
5252
5353 // retain the base directory for the namespace prefix
5454 if ($ prepend ) {
55- array_unshift ($ this ->prefixes [$ prefix ], $ baseDir );
55+ \ array_unshift ($ this ->prefixes [$ prefix ], $ baseDir );
5656 } else {
57- array_push ($ this ->prefixes [$ prefix ], $ baseDir );
57+ \ array_push ($ this ->prefixes [$ prefix ], $ baseDir );
5858 }
5959 }
6060
@@ -72,12 +72,12 @@ public function loadClass($class)
7272
7373 // work backwards through the namespace names of the fully-qualified
7474 // class name to find a mapped file name
75- while (($ pos = strrpos ($ prefix , '\\' )) !== false ) {
75+ while (($ pos = \ strrpos ($ prefix , '\\' )) !== false ) {
7676 // retain the trailing namespace separator in the prefix
77- $ prefix = substr ($ class , 0 , $ pos + 1 );
77+ $ prefix = \ substr ($ class , 0 , $ pos + 1 );
7878
7979 // the rest is the relative class name
80- $ relativeClass = substr ($ class , $ pos + 1 );
80+ $ relativeClass = \ substr ($ class , $ pos + 1 );
8181
8282 // try to load a mapped file for the prefix and relative class
8383 $ mappedFile = $ this ->loadMappedFile ($ prefix , $ relativeClass );
@@ -87,7 +87,7 @@ public function loadClass($class)
8787
8888 // remove the trailing namespace separator for the next iteration
8989 // of strrpos()
90- $ prefix = rtrim ($ prefix , '\\' );
90+ $ prefix = \ rtrim ($ prefix , '\\' );
9191 }
9292
9393 // never found a mapped file
@@ -115,7 +115,7 @@ protected function loadMappedFile($prefix, $relativeClass)
115115 // replace namespace separators with directory separators
116116 // in the relative class name, append with .php
117117 $ file = $ baseDir
118- . str_replace ('\\' , '/ ' , $ relativeClass )
118+ . \ str_replace ('\\' , '/ ' , $ relativeClass )
119119 . '.php ' ;
120120
121121 // if the mapped file exists, require it
@@ -137,7 +137,7 @@ protected function loadMappedFile($prefix, $relativeClass)
137137 */
138138 protected function requireFile ($ file )
139139 {
140- if (file_exists ($ file )) {
140+ if (\ file_exists ($ file )) {
141141 require $ file ;
142142
143143 return true ;
0 commit comments