autoload.php | ||||
![]() | ||||
|
||||
![]() |
Coverage | ||||||||||
Classes | Functions / Methods | Lines | ||||||||
Total |
|
0.00% | 0 / 1 |
|
50.00% | 2 / 4 | CRAP |
|
71.43% | 10 / 14 |
AutoLoad |
|
0.00% | 0 / 1 |
|
50.00% | 2 / 4 | 6.84 |
|
71.43% | 10 / 14 |
setClassPath($namespace, $path) |
|
0.00% | 0 / 1 | 2 |
|
0.00% | 0 / 2 | |||
getClassPath() |
|
100.00% | 1 / 1 | 1 |
|
100.00% | 1 / 1 | |||
__construct() |
|
0.00% | 0 / 1 | 2 |
|
0.00% | 0 / 2 | |||
loadClass($className) |
|
100.00% | 1 / 1 | 3 |
|
100.00% | 9 / 9 |
1 : <?php 2 : namespace phMagick\Core; 3 : 4 : class AutoLoad 5 : { 6 : 7 : private $classPath = array(); 8 : 9 : public function setClassPath($namespace, $path) 10 : { 11 0 : $this->classPath[$namespace] = $path; 12 0 : } 13 : 14 : public function getClassPath() 15 : { 16 5 : return $this->classPath; 17 : } 18 : 19 : public function __construct() 20 : { 21 0 : spl_autoload_register(array($this, 'loadClass')); 22 0 : } 23 : 24 : public function loadClass($className) 25 : { 26 : 27 5 : $paths = $this->getClassPath(); 28 5 : foreach($paths as $ns => $path) { 29 5 : $className = str_replace($ns, $path, $className); 30 5 : } 31 : 32 5 : $file = str_replace('\\', '/', $className) . '.php'; 33 : 34 5 : if (file_exists($file)) { 35 5 : require_once $file; 36 5 : } 37 5 : } |
![]() |
Generated by PHP_CodeCoverage 1.1.1 using PHP 5.3.10 and PHPUnit 3.6.7 at Fri Apr 20 19:24:32 CEST 2012. |