Completed
Push — master ( 22c257...e714e6 )
by Gabriel
13:14 queued 10:09
created

src/Extensions/Helpers/HelpersExtension.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Nip\View\Extensions\Helpers;
4
5
use Nip\View;
6
use Nip\View\Extensions\AbstractExtension;
7
use Nip\View\Helpers\HelpersCollection;
8
use Nip\View\Traits\HasMethodsTrait;
9
use Nip\View\Traits\MethodsOverloadingTrait;
10
use Nip\View\ViewInterface;
11
12
/**
13
 * Class HelpersExtension
14
 * @package Nip\View\Extensions\Helpers
15
 */
16
class HelpersExtension extends AbstractExtension
17
{
18
19
    /**
20
     * @param ViewInterface|MethodsOverloadingTrait|HasMethodsTrait|View $view
21
     * @return void
22
     */
23 6
    public function register(ViewInterface $view)
24
    {
25 6
        $view->getCallPipelineBuilder()->add(new HelpersPipelineStage());
0 ignored issues
show
The method getCallPipelineBuilder() does not exist on Nip\View\ViewInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to Nip\View\ViewInterface. ( Ignorable by Annotation )

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

25
        $view->/** @scrutinizer ignore-call */ 
26
               getCallPipelineBuilder()->add(new HelpersPipelineStage());
Loading history...
26 6
        HelpersCollection::getInstance()->setEngine($view);
27
28 6
        $view->addMethod('getHelper', function ($name) {
0 ignored issues
show
The method addMethod() does not exist on Nip\View\ViewInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to Nip\View\ViewInterface. ( Ignorable by Annotation )

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

28
        $view->/** @scrutinizer ignore-call */ 
29
               addMethod('getHelper', function ($name) {
Loading history...
29 1
            return HelpersCollection::getInstance()->getHelper($name);
30 6
        });
31
32 6
        $view->addMethod('hasHelper', function ($name) {
33 1
            return HelpersCollection::getInstance()->hasHelper($name);
34 6
        });
35 6
    }
36
}
37