Volt::initCompiler()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.552
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Volt
5
 * @copyright Copyright (c) 2011 - 2014 Aleksandr Torosh (http://wezoom.com.ua)
6
 * @author Aleksandr Torosh <[email protected]>
7
 */
8
9
namespace Application\Mvc\View\Engine;
10
11
class Volt extends \Phalcon\Mvc\View\Engine\Volt
12
{
13
14
    public function initCompiler()
15
    {
16
        $compiler = $this->getCompiler();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $compiler is correct as $this->getCompiler() (which targets Phalcon\Mvc\View\Engine\Volt::getCompiler()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
17
18
        $compiler->addFunction('helper', function () {
0 ignored issues
show
Bug introduced by
The method addFunction cannot be called on $compiler (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
19
            return '$this->helper';
20
        });
21
        $compiler->addFunction('translate', function ($resolvedArgs) {
0 ignored issues
show
Bug introduced by
The method addFunction cannot be called on $compiler (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
22
            return '$this->helper->translate(\'.$resolvedArgs.\')';
23
        });
24
        $compiler->addFunction('langUrl', function ($resolvedArgs) {
0 ignored issues
show
Bug introduced by
The method addFunction cannot be called on $compiler (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
25
            return '$this->helper->langUrl(' . $resolvedArgs . ')';
26
        });
27
        $compiler->addFunction('image', function ($resolvedArgs) {
0 ignored issues
show
Bug introduced by
The method addFunction cannot be called on $compiler (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
28
            return '(new \Image\Storage(' . $resolvedArgs . '))';
29
        });
30
        $compiler->addFunction('widget', function ($resolvedArgs) {
0 ignored issues
show
Bug introduced by
The method addFunction cannot be called on $compiler (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
31
            return '(new \Application\Widget\Proxy(' . $resolvedArgs . '))';
32
        });
33
34
        $compiler->addFunction('substr', 'substr');
0 ignored issues
show
Bug introduced by
The method addFunction cannot be called on $compiler (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
35
36
    }
37
38
}
39