Passed
Push — master ( 12ed59...661264 )
by Julien
05:22
created

Modules::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 3
c 2
b 0
f 0
dl 0
loc 9
ccs 4
cts 4
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * This file is part of the Zemit Framework.
4
 *
5
 * (c) Zemit Team <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE.txt
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Zemit\Bootstrap;
12
13
use Phalcon\Application\AbstractApplication;
14
15
/**
16
 * Class Modules
17
 * Registering a list of module
18
 *
19
 * @author Julien Turbide <[email protected]>
20
 * @copyright Zemit Team <[email protected]>
21
 *
22
 * @since 1.0
23
 * @version 1.0
24
 *
25
 * @package Zemit\Bootstrap
26
 */
27
class Modules
28
{
29
    public $modulesDir;
30
    
31 7
    public function __construct(AbstractApplication $application = null)
32
    {
33
        /**
34
         * Register application modules
35
         */
36 7
        $config = $application->getDI()->get('config');
0 ignored issues
show
Bug introduced by
The method getDI() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
        $config = $application->/** @scrutinizer ignore-call */ getDI()->get('config');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37 7
        $application->registerModules($config->modules->toArray());
38
//        $application->registerModules($config->core->modules->toArray(), true); // @todo disable router for these default modules as it may cause security issues, therefor we should consider only allowing dispatching
39 7
        $application->setDefaultModule($config->router->defaults->module);
40
    }
41
}
42