Autoloader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 4 1
A autoload() 0 9 2
1
<?php
2
/**
3
 * KumbiaPHP web & app Framework.
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the new BSD license that is bundled
8
 * with this package in the file LICENSE.txt.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://wiki.kumbiaphp.com/Licencia
11
 * If you did not receive a copy of the license and are unable to
12
 * obtain it through the world-wide-web, please send an email
13
 * to [email protected] so we can send you a copy immediately.
14
 *
15
 * @category   Kumbia
16
 *
17
 * @copyright  2005 - 2016  Kumbia Team (http://www.kumbiaphp.com)
18
 * @license    http://wiki.kumbiaphp.com/Licencia     New BSD License
19
 */
20
namespace Kumbia\ActiveRecord;
21
22
/**
23
 * Autoload de las clases.
24
 */
25
class Autoloader
26
{
27
    /**
28
     * Registra el autoloader.
29
     *
30
     * @param bool $prepend
31
     */
32
    public static function register($prepend = false)
33
    {
34
        \spl_autoload_register([__CLASS__, 'autoload'], true, $prepend);
35
    }
36
37
    /**
38
     * @param string $className
39
     */
40
    public static function autoload($className)
41
    {
42
        if (0 !== \strpos($className, 'Kumbia\\ActiveRecord')) {
43
            return;
44
        }
45
        $className = \substr($className, 19);
46
        $fileName = \str_replace(['_', '\\'], \DIRECTORY_SEPARATOR, $className).'.php';
47
        require __DIR__.$fileName;
48
    }
49
}
50