rfc:splclassloader
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:splclassloader [2011/11/08 16:13] – guilhermeblanco | rfc:splclassloader [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2010-03-22 | * Date: 2010-03-22 | ||
* Author: Guilherme Blanco < | * Author: Guilherme Blanco < | ||
- | * Status: Voting at https:// | + | * Status: |
+ | * Voting | ||
* First Published at: http:// | * First Published at: http:// | ||
Line 77: | Line 78: | ||
| | ||
/** | /** | ||
- | | + | |
* | * | ||
* @param integer $mode Autoloader work mode. | * @param integer $mode Autoloader work mode. | ||
*/ | */ | ||
- | public function | + | public function |
| | ||
/** | /** | ||
Line 145: | Line 146: | ||
<code php> | <code php> | ||
- | $classLoader = new \SplClassLoader(\SplClassLoader:: | + | $classLoader = new \SplClassLoader(); |
+ | $classLoader-> | ||
$classLoader-> | $classLoader-> | ||
$classLoader-> | $classLoader-> | ||
Line 154: | Line 156: | ||
<code php> | <code php> | ||
- | $classLoader = new \SplClassLoader(\SplClassLoader:: | + | $classLoader = new \SplClassLoader(); |
+ | $classLoader-> | ||
$classLoader-> | $classLoader-> | ||
$classLoader-> | $classLoader-> | ||
Line 195: | Line 198: | ||
* | * | ||
* Example usage: | * Example usage: | ||
+ | * | ||
+ | | ||
* | * | ||
| | ||
- | | + | |
* | * | ||
| | ||
Line 246: | Line 251: | ||
* @var integer | * @var integer | ||
*/ | */ | ||
- | private $mode; | + | private $mode = self:: |
/** | /** | ||
- | | + | |
- | * | + | |
- | | + | |
*/ | */ | ||
- | public function | + | public function |
{ | { | ||
if ($mode & self:: | if ($mode & self:: | ||
- | throw new \InvalidArgumentException( | + | |
- | | + | |
- | ); | + | |
} | } | ||
| | ||
Line 336: | Line 339: | ||
| | ||
switch (true) { | switch (true) { | ||
- | case ($this-> | + | |
- | | + | if ($resourceAbsolutePath !== false) { |
- | | + | require $resourceAbsolutePath; |
- | | + | } |
- | | + | break; |
| | ||
case ($this-> | case ($this-> | ||
Line 349: | Line 352: | ||
| | ||
if ($this-> | if ($this-> | ||
- | throw new \RuntimeException( | + | |
- | sprintf(' | + | sprintf(' |
- | ); | + | ); |
} | } | ||
} | } | ||
Line 363: | Line 366: | ||
*/ | */ | ||
private function getResourceAbsolutePath($resourceName) | private function getResourceAbsolutePath($resourceName) | ||
+ | { | ||
$resourceRelativePath = $this-> | $resourceRelativePath = $this-> | ||
| | ||
Line 380: | Line 384: | ||
| | ||
if ($this-> | if ($this-> | ||
- | return $resourceAbsolutePath; | + | |
} | } | ||
| | ||
Line 439: | 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: Updated SplClassLoader implementation. | * 2011-11-08 Guilherme Blanco: Updated SplClassLoader implementation. | ||
* 2011-11-07 Guilherme Blanco: Expanded extended rules. | * 2011-11-07 Guilherme Blanco: Expanded extended rules. | ||
Line 445: | 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:// |
rfc/splclassloader.1320768808.txt.gz · Last modified: 2017/09/22 13:28 (external edit)