Passed
Push — master ( ff8f2e...aaaf39 )
by Aimeos
02:27
created

TestHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 27
rs 10
c 4
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bootstrap() 0 7 1
A getAimeos() 0 12 2
1
<?php
2
3
4
/**
5
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
6
 * @copyright Metaways Infosystems GmbH, 2011
7
 * @copyright Aimeos (aimeos.org), 2015-2022
8
 */
9
class TestHelper
10
{
11
	private static $aimeos;
12
13
14
	public static function bootstrap()
15
	{
16
		$aimeos = self::getAimeos();
17
18
		$includepaths = $aimeos->getIncludePaths();
19
		$includepaths[] = get_include_path();
20
		set_include_path( implode( PATH_SEPARATOR, $includepaths ) );
21
	}
22
23
24
	private static function getAimeos()
25
	{
26
		if( !isset( self::$aimeos ) )
27
		{
28
			require_once 'Bootstrap.php';
29
			spl_autoload_register( '\Aimeos\Bootstrap::autoload' );
30
31
			$extdir = dirname( dirname( dirname( __DIR__ ) ) );
32
			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
33
		}
34
35
		return self::$aimeos;
36
	}
37
}
38