GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — 3.0 ( 700313...58bd2d )
by Vermeulen
01:18
created

ComposerLoader   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A obtainVendorDir() 0 5 1
A getLoader() 0 3 1
A __construct() 0 7 1
A __invoke() 0 3 1
A addComposerNamespaces() 0 3 1
1
<?php
2
3
namespace BFW\Core\AppSystems;
4
5
class ComposerLoader extends AbstractSystem
6
{
7
    /**
8
     * @var \Composer\Autoload\ClassLoader $loader Composer auto-loader
9
     */
10
    protected $loader;
11
    
12
    /**
13
     * Define loader property and add all namespaces
14
     */
15
    public function __construct()
16
    {
17
        $this->loader = require(
18
            $this->obtainVendorDir().'autoload.php'
19
        );
20
21
        $this->addComposerNamespaces();
22
    }
23
    
24
    /**
25
     * {@inheritdoc}
26
     * 
27
     * @return \Composer\Autoload\ClassLoader
28
     */
29
    public function __invoke()
30
    {
31
        return $this->loader;
32
    }
33
    
34
    /**
35
     * Getter accessor to property loader
36
     * 
37
     * @return \Composer\Autoload\ClassLoader
38
     */
39
    public function getLoader()
40
    {
41
        return $this->loader;
42
    }
43
    
44
    /**
45
     * Return the path to the vendor directory
46
     * 
47
     * @return string
48
     */
49
    protected function obtainVendorDir(): string
50
    {
51
        return \BFW\Application::getInstance()
52
            ->getOptions()
53
            ->getValue('vendorDir')
54
        ;
55
    }
56
57
    /**
58
     * Add namespaces used by a BFW Application to composer
59
     * 
60
     * @return void
61
     */
62
    protected function addComposerNamespaces()
63
    {
64
        $this->loader->addPsr4('Modules\\', MODULES_ENABLED_DIR);
0 ignored issues
show
Bug introduced by
The constant BFW\Core\AppSystems\MODULES_ENABLED_DIR was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
65
    }
66
}
67