ComposerUtility::checkContribLibs()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 22
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 22
rs 9.2
cc 3
eloc 13
nc 3
nop 0
1
<?php
2
/**
3
 * ComposerUtility
4
 *
5
 * @author  Tim Lochmüller
6
 */
7
8
namespace FRUIT\Shopize\Utility;
9
10
use FRUIT\Shopize\Exception;
11
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
12
use TYPO3\CMS\Core\Utility\GeneralUtility;
13
14
/**
15
 * ComposerUtility
16
 */
17
class ComposerUtility
18
{
19
20
    /**
21
     * @throws Exception
22
     */
23
    public static function checkContribLibs()
24
    {
25
        // avoid diuble class
26
        static $done = false;
27
        if ($done === true) {
28
            return;
29
        }
30
        $done = true;
31
32
        // include libs loader
33
        $autoloaderFile = ExtensionManagementUtility::extPath(
34
            'shopize',
35
            'Resources/Private/Contrib/vendor/autoload.php'
36
        );
37
        if (!is_file($autoloaderFile)) {
38
            throw new Exception(
39
                'You have to run "cd typo3conf/ext/shopize/Resources/Private/Contrib/ && composer install"!',
40
                12367812
41
            );
42
        }
43
        GeneralUtility::requireFile($autoloaderFile);
44
    }
45
}
46