rfc:splclassloader

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:splclassloader [2011/11/09 01:21]
guilhermeblanco Removed constructor prototype and created setMode
rfc:splclassloader [2017/09/22 13:28] (current)
Line 3: Line 3:
   * Date: 2010-03-22   * Date: 2010-03-22
   * Author: Guilherme Blanco <guilhermeblanco@hotmail.com>   * Author: Guilherme Blanco <guilhermeblanco@hotmail.com>
-  * Status: Voting at https://wiki.php.net/rfc/splclassloader/vote +  * Status: Declined 
 +  * Voting results at https://wiki.php.net/rfc/splclassloader/vote 
   * First Published at: http://wiki.php.net/rfc/splclassloader   * First Published at: http://wiki.php.net/rfc/splclassloader
  
Line 145: Line 146:
  
 <code php> <code php>
-$classLoader = new \SplClassLoader(\SplClassLoader::MODE_SILENT);+$classLoader = new \SplClassLoader(); 
 +$classLoader->setMode(\SplClassLoader::MODE_SILENT);
 $classLoader->setIncludePathLookup(true); $classLoader->setIncludePathLookup(true);
 $classLoader->add('PEAR'); $classLoader->add('PEAR');
Line 154: Line 156:
  
 <code php> <code php>
-$classLoader = new \SplClassLoader(\SplClassLoader::MODE_NORMAL | \SplClassLoader::MODE_DEBUG);+$classLoader = new \SplClassLoader(); 
 +$classLoader->setMode(\SplClassLoader::MODE_NORMAL | \SplClassLoader::MODE_DEBUG);
 $classLoader->add('Symfony', '/path/to/symfony'); $classLoader->add('Symfony', '/path/to/symfony');
 $classLoader->add('Zend', '/path/to/zf'); $classLoader->add('Zend', '/path/to/zf');
Line 195: Line 198:
  *  *
  * Example usage:  * Example usage:
 + *
 +     $classLoader = new \SplClassLoader();
  *  *
      // Configure the SplClassLoader to act normally or silently      // Configure the SplClassLoader to act normally or silently
-     $classLoader = new \SplClassLoader(\SplClassLoader::MODE_NORMAL);+     $classLoader->setMode(\SplClassLoader::MODE_NORMAL);
  *  *
      // Add a namespace of classes      // Add a namespace of classes
Line 361: Line 366:
      */      */
     private function getResourceAbsolutePath($resourceName)     private function getResourceAbsolutePath($resourceName)
 +    {
         $resourceRelativePath = $this->getResourceRelativePath($resourceName);         $resourceRelativePath = $this->getResourceRelativePath($resourceName);
                  
Line 437: Line 443:
 ===== Changelog ===== ===== Changelog =====
  
 +  * 2011-11-09 Christian Kaps: Update examples to use the new interface(setMode)
   * 2011-11-08 Guilherme Blanco: Removed constructor prototype and created setMode.   * 2011-11-08 Guilherme Blanco: Removed constructor prototype and created setMode.
   * 2011-11-08 Guilherme Blanco: Updated SplClassLoader implementation.   * 2011-11-08 Guilherme Blanco: Updated SplClassLoader implementation.
Line 444: Line 451:
   * 2010-03-22 Guilherme Blanco: Initial RFC creation.   * 2010-03-22 Guilherme Blanco: Initial RFC creation.
  
 +===== Comments =====
 +  * laruence : I have already got a similar loader implemented in Yaf, called Yaf_Loader, you can found the source here: [[http://svn.php.net/viewvc/pecl/yaf/trunk/yaf_loader.c?view=markup]]
rfc/splclassloader.1320801666.txt.gz · Last modified: 2017/09/22 13:28 (external edit)