Completed
Push — master ( 4c844b...e7ad9f )
by Josh
147:47 queued 144:54
created

autoloader.php ➔ autoload()   B

Complexity

Conditions 6
Paths 4

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 6

Importance

Changes 0
Metric Value
cc 6
eloc 9
nc 4
nop 1
dl 0
loc 18
ccs 14
cts 14
cp 1
crap 6
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
/**
4
* @package   s9e\TextFormatter
5
* @copyright Copyright (c) 2010-2016 The s9e Authors
6
* @license   http://www.opensource.org/licenses/mit-license.php The MIT License
7
*/
8
namespace s9e\TextFormatter;
9
10
function autoload($className)
11
{
12 5
	if (strpos($className, 's9e\\TextFormatter\\') === 0
13 5
	 && strpos($className, '.') === false)
14 5
	{
15 5
		$path = __DIR__ . strtr(substr($className, 17), '\\', '/') . '.php';
16
17 5
		if (file_exists($path))
18 5
		{
19 4
			include $path;
20 4
		}
21 1
		elseif (!class_exists('s9e\\TextFormatter\\Configurator', false)
22 1
			 && strpos($className, 's9e\\TextFormatter\\Configurator\\') === 0)
23
		{
24 1
			include __DIR__ . '/Configurator.php';
25 1
		}
26 5
	}
27 5
}
28
29
spl_autoload_register('s9e\\TextFormatter\\autoload');