Passed
Push — master ( 69a393...54385f )
by Pedro
02:00
created

Event::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 13
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Application\View\Helper;
4
5
use Zend\View\Helper\AbstractHelper;
6
use Application\Service\BotParser;
7
8
class Event extends AbstractHelper
9
{
10
    private $nicks;
11
12
    public function __construct(array $nicks)
13
    {
14
        $this->nicks = $nicks;
15
    }
16
17
    public function __invoke(string $event)
18
    {
19
        $url = $this->getView()->plugin('url');
0 ignored issues
show
Bug introduced by
The method plugin() does not exist on Zend\View\Renderer\RendererInterface. It seems like you code against a sub-type of Zend\View\Renderer\RendererInterface such as Zend\View\Renderer\PhpRenderer. ( Ignorable by Annotation )

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

19
        $url = $this->getView()->/** @scrutinizer ignore-call */ plugin('url');
Loading history...
20
21
        foreach ($this->nicks as $nick) {
22
            $event = str_replace(
23
                $nick,
24
                '<a href="' . $url('player-info', ['nick' => $nick]) . '">'. $nick .'</a>',
25
                $event
26
            );
27
        }
28
29
        return $event;
30
    }
31
}
32