-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathautoloader.php
62 lines (52 loc) · 1.24 KB
/
autoloader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace mageekguy\atoum\ruler;
use mageekguy\atoum;
$vendorDirectory = __DIR__ . '/vendor';
if (is_dir($vendorDirectory) === false)
{
$vendorDirectory = __DIR__ . '/../..';
}
$hoa = array(
'hoa/core' => 'Core.php',
'hoa/consistency' => 'Prelude.php',
'hoa/protocol' => 'Wrapper.php',
'hoa/compiler' => null,
'hoa/event' => null,
'hoa/exception' => null,
'hoa/file' => null,
'hoa/iterator' => null,
'hoa/math' => null,
'hoa/regex' => null,
'hoa/ruler' => null,
'hoa/stream' => null,
'hoa/string' => null,
'hoa/ustring' => null,
'hoa/visitor' => null,
'hoa/zformat' => null
);
foreach ($hoa as $library => $file)
{
$parts = explode('/', $library);
$parts = array_map('ucfirst', $parts);
$namespace = implode('\\', $parts);
$root = $vendorDirectory . DIRECTORY_SEPARATOR . $library;
if (is_dir($root))
{
if (null === $file)
{
atoum\autoloader::get()->addDirectory($namespace, $root);
}
else
{
if (file_exists($root . DIRECTORY_SEPARATOR . $file))
{
atoum\autoloader::get()->addDirectory($namespace, $root);
require_once $root . DIRECTORY_SEPARATOR . $file;
}
}
}
}
atoum\autoloader::get()
->addNamespaceAlias('atoum\ruler', __NAMESPACE__)
->addDirectory(__NAMESPACE__, __DIR__ . '/classes')
;