/**
  * Constructor.
  *
  * @param callable|object $classLoader Passing an object is @deprecated since version 2.5 and support for it will be removed in 3.0
  */
 public function __construct($classLoader)
 {
     $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
     if ($this->wasFinder) {
         @trigger_error('The ' . __METHOD__ . ' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
         $this->classLoader = array($classLoader, 'loadClass');
         $this->isFinder = true;
     } else {
         $this->classLoader = $classLoader;
         $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
     }
     if (!isset(self::$caseCheck)) {
         $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
         $i = strrpos($file, DIRECTORY_SEPARATOR);
         $dir = substr($file, 0, 1 + $i);
         $file = substr($file, 1 + $i);
         $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
         $test = realpath($dir . $test);
         if (false === $test || false === $i) {
             // filesystem is case sensitive
             self::$caseCheck = 0;
         } elseif (substr($test, -strlen($file)) === $file) {
             // filesystem is case insensitive and realpath() normalizes the case of characters
             self::$caseCheck = 1;
         } elseif (false !== stripos(PHP_OS, 'darwin')) {
             // on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
             self::$caseCheck = 2;
         } else {
             // filesystem case checks failed, fallback to disabling them
             self::$caseCheck = 0;
         }
     }
 }
Example #2
0
 /**
  * Constructor.
  *
  * @param callable $classLoader A class loader
  */
 public function __construct(callable $classLoader)
 {
     $this->classLoader = $classLoader;
     $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
     if (!isset(self::$caseCheck)) {
         $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
         $i = strrpos($file, DIRECTORY_SEPARATOR);
         $dir = substr($file, 0, 1 + $i);
         $file = substr($file, 1 + $i);
         $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
         $test = realpath($dir . $test);
         if (false === $test || false === $i) {
             // filesystem is case sensitive
             self::$caseCheck = 0;
         } elseif (substr($test, -strlen($file)) === $file) {
             // filesystem is case insensitive and realpath() normalizes the case of characters
             self::$caseCheck = 1;
         } elseif (false !== stripos(PHP_OS, 'darwin')) {
             // on MacOSX, HFS+ is case insensitive but realpath() doesn't normalize the case of characters
             self::$caseCheck = 2;
         } else {
             // filesystem case checks failed, fallback to disabling them
             self::$caseCheck = 0;
         }
     }
 }
 /**
  * Constructor.
  *
  * @param callable $classLoader A class loader
  */
 public function __construct(callable $classLoader)
 {
     $this->classLoader = $classLoader;
     $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
     if (!isset(self::$caseCheck)) {
         self::$caseCheck = false !== stripos(PHP_OS, 'win') ? false !== stripos(PHP_OS, 'darwin') ? 2 : 1 : 0;
     }
 }
Example #4
0
 /**
  * Constructor.
  *
  * @param callable|object $classLoader
  *
  * @api
  * @deprecated since 2.5, passing an object is deprecated and support for it will be removed in 3.0
  */
 public function __construct($classLoader)
 {
     $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
     if ($this->wasFinder) {
         $this->classLoader = array($classLoader, 'loadClass');
         $this->isFinder = true;
     } else {
         $this->classLoader = $classLoader;
         $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
     }
     if (!isset(self::$caseCheck)) {
         self::$caseCheck = false !== stripos(PHP_OS, 'win') ? false !== stripos(PHP_OS, 'darwin') ? 2 : 1 : 0;
     }
 }
 /**
  * Constructor.
  *
  * @param callable|object $classLoader Passing an object is @deprecated since version 2.5 and support for it will be removed in 3.0
  */
 public function __construct($classLoader)
 {
     $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
     if ($this->wasFinder) {
         @trigger_error('The ' . __METHOD__ . ' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
         $this->classLoader = array($classLoader, 'loadClass');
         $this->isFinder = true;
     } else {
         $this->classLoader = $classLoader;
         $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
     }
     if (!isset(self::$caseCheck)) {
         self::$caseCheck = false !== stripos(PHP_OS, 'win') ? false !== stripos(PHP_OS, 'darwin') ? 2 : 1 : 0;
     }
 }
 /**
  * Constructor.
  *
  * @param callable|object $classLoader Passing an object is @deprecated since version 2.5 and support for it will be removed in 3.0
  */
 public function __construct($classLoader)
 {
     $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
     if ($this->wasFinder) {
         @trigger_error('The ' . __METHOD__ . ' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
         $this->classLoader = array($classLoader, 'loadClass');
         $this->isFinder = true;
     } else {
         $this->classLoader = $classLoader;
         $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
     }
     if (!isset(self::$caseCheck)) {
         if (!file_exists(strtolower(__FILE__))) {
             // filesystem is case sensitive
             self::$caseCheck = 0;
         } elseif (realpath(strtolower(__FILE__)) === __FILE__) {
             // filesystem is not case sensitive
             self::$caseCheck = 1;
         } else {
             // filesystem is not case sensitive AND realpath() fails to normalize case
             self::$caseCheck = 2;
         }
     }
 }