Completed
Push — master ( 9ad3a8...8db695 )
by Vitaly
03:33
created

Module::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 4
1
<?php
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 21.02.16 at 14:14
5
 */
6
namespace samsonphp\view;
7
8
use samsonframework\core\ResourcesInterface;
9
use samsonframework\core\SystemInterface;
10
use samsonframework\view\Generator;
11
12
/**
13
 * SamsonPHP view module
14
 * @package samsonphp\view
15
 */
16
class Module extends \samson\core\ExternalModule
17
{
18
    /** @var Generator */
19
    protected $generator;
20
21
    /**
22
     * Module constructor.
23
     *
24
     * @param string             $path
25
     * @param ResourcesInterface $resources
26
     * @param SystemInterface    $system
27
     * @param Generator          $generator
28
     */
29
    public function __construct($path, ResourcesInterface $resources, SystemInterface $system, Generator $generator = null)
30
    {
31
        $this->generator = $generator;
32
33
        parent::__construct($path, $resources, $system);
34
    }
35
36
    /**
37
     * Module preparation stage.
38
     * This function called after module instance creation but before
39
     * initialization stage.
40
     *
41
     * @param array $params Preparation stage parameters
42
     *
43
     * @return bool|void Preparation stage result
44
     */
45
    public function prepare(array $params = array())
46
    {
47
        $signature = md5('sdfsdfsdf');
48
        if ($this->cache_refresh($signature)) {
49
50
        }
51
52
        $this->generator = new Generator(new \samsonphp\generator\Generator(), 'view');
0 ignored issues
show
Unused Code introduced by
The call to Generator::__construct() has too many arguments starting with new \samsonphp\generator\Generator().

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
53
        $this->generator->scan(__SAMSON_CWD__.'/src');
0 ignored issues
show
Bug introduced by
The method scan() does not seem to exist on object<samsonframework\view\Generator>.

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...
54
        $this->generator->generate($this->cache_path);
0 ignored issues
show
Bug introduced by
The method generate() does not seem to exist on object<samsonframework\view\Generator>.

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...
55
56
        return parent::prepare($params);
0 ignored issues
show
Unused Code introduced by
The call to ExternalModule::prepare() has too many arguments starting with $params.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
57
    }
58
}
59