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

Event   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 10
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 13 2
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