-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsvn-buddy_autoloader.php
54 lines (43 loc) · 1.29 KB
/
svn-buddy_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
<?php
/**
* This file is part of the SVN-Buddy library.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @copyright Alexander Obuhovich <[email protected]>
* @link https://github.com/console-helpers/svn-buddy
*/
namespace ConsoleHelpers\SVNBuddy;
use Aura\Sql\Profiler\ProfilerInterface;
if ( \class_exists('ConsoleHelpers\SVNBuddy\Autoload', false) === false ) {
/**
* Custom autoloader.
*/
final class Autoload
{
/**
* Loads a class.
*
* @param string $class_name The name of the class to load.
*
* @return boolean
*/
public static function load($class_name)
{
// Only load classes belonging to this library.
if ( \stripos($class_name, 'ConsoleHelpers\SVNBuddy\Database\TStatementProfiler') !== 0 ) {
return false;
}
$method = new \ReflectionMethod(ProfilerInterface::class, 'setActive');
$method_parameters = $method->getParameters();
if ( PHP_VERSION_ID >= 70000 && $method_parameters[0]->hasType() ) {
require_once __DIR__ . '/src/SVNBuddy/Database/TStatementProfiler7.php';
}
else {
require_once __DIR__ . '/src/SVNBuddy/Database/TStatementProfiler5.php';
}
return true;
}
}
\spl_autoload_register(__NAMESPACE__ . '\Autoload::load');
}