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
Next revision Both sides next revision
rfc:splclassloader [2011/11/09 01:21]
guilhermeblanco Removed constructor prototype and created setMode
rfc:splclassloader [2012/06/29 06:53]
laruence
Line 145: Line 145:
  
 <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 155:
  
 <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 197:
  *  *
  * 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 365:
      */      */
     private function getResourceAbsolutePath($resourceName)     private function getResourceAbsolutePath($resourceName)
 +    {
         $resourceRelativePath = $this->getResourceRelativePath($resourceName);         $resourceRelativePath = $this->getResourceRelativePath($resourceName);
                  
Line 437: Line 442:
 ===== 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 450:
   * 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.txt · Last modified: 2017/09/22 13:28 (external edit)