Completed
Push — master ( 1debd7...be65da )
by Jeroen
12:58 queued 12s
created

PreSitemapRenderEvent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 33
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getLocale() 0 4 1
A getExtraItems() 0 4 1
A addExtraItem() 0 6 2
1
<?php
2
3
namespace Kunstmaan\SitemapBundle\Event;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\Common\Collections\Collection;
7
use Kunstmaan\SitemapBundle\Model\SitemapUrl;
8
use Symfony\Component\EventDispatcher\Event;
9
10
final class PreSitemapRenderEvent extends Event
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\EventDispatcher\Event has been deprecated with message: since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
11
{
12
    public const NAME = 'sitemap.pre_render';
13
14
    /** @var ArrayCollection */
15
    private $extraItems;
16
17
    /** @var string */
18
    private $locale;
19
20
    public function __construct($locale)
21
    {
22
        $this->extraItems = new ArrayCollection();
23
        $this->locale = $locale;
24
    }
25
26
    public function getLocale(): string
27
    {
28
        return $this->locale;
29
    }
30
31
    public function getExtraItems(): Collection
32
    {
33
        return $this->extraItems;
34
    }
35
36
    public function addExtraItem(SitemapUrl $extraItem): void
37
    {
38
        if (!$this->extraItems->contains($extraItem)) {
39
            $this->extraItems->add($extraItem);
40
        }
41
    }
42
}
43