ComposerUtility   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 3
c 3
b 1
f 0
lcom 0
cbo 3
dl 0
loc 29
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkContribLibs() 0 22 3
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