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

PreSitemapRenderEvent::getLocale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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