Total Complexity | 10 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class Aimeos |
||
15 | { |
||
16 | /** |
||
17 | * @var \Illuminate\Contracts\Config\Repository |
||
18 | */ |
||
19 | private $config; |
||
20 | |||
21 | /** |
||
22 | * @var \Aimeos\Bootstrap |
||
23 | */ |
||
24 | private $object; |
||
25 | |||
26 | |||
27 | /** |
||
28 | * Initializes the object |
||
29 | * |
||
30 | * @param \Illuminate\Contracts\Config\Repository $config Configuration object |
||
31 | */ |
||
32 | public function __construct( \Illuminate\Contracts\Config\Repository $config ) |
||
33 | { |
||
34 | $this->config = $config; |
||
35 | } |
||
36 | |||
37 | |||
38 | /** |
||
39 | * Returns the Aimeos object. |
||
40 | * |
||
41 | * @return \Aimeos\Bootstrap Aimeos bootstrap object |
||
42 | */ |
||
43 | public function get() : \Aimeos\Bootstrap |
||
44 | { |
||
45 | if( $this->object === null ) |
||
46 | { |
||
47 | $dir = base_path( 'ext' ); |
||
48 | |||
49 | if( !is_dir( $dir ) ) { |
||
50 | $dir = dirname( __DIR__, 4 ) . DIRECTORY_SEPARATOR . 'ext'; |
||
51 | } |
||
52 | |||
53 | $extDirs = (array) $this->config->get( 'shop.extdir', $dir ); |
||
54 | $this->object = new \Aimeos\Bootstrap( $extDirs, false ); |
||
55 | } |
||
56 | |||
57 | return $this->object; |
||
58 | } |
||
59 | |||
60 | |||
61 | /** |
||
62 | * Returns the version of the Aimeos package |
||
63 | * |
||
64 | * @return string Version string |
||
65 | */ |
||
66 | public function getVersion() : string |
||
80 | } |
||
81 | } |