Completed
Pull Request — master (#86)
by Vladimir
08:24
created

RouteSubscriber::getSubscribedEvents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @copyright 2018 Vladimir Jimenez
5
 * @license   https://github.com/stakx-io/stakx/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\stakx\EventSubscriber;
9
10
use allejo\stakx\Event\PageViewAdded;
11
use allejo\stakx\Server\RouteMapper;
12
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
13
14
class RouteSubscriber implements EventSubscriberInterface
15
{
16
    private $routerMapping;
17
18
    public function __construct(RouteMapper $routerMapping)
19
    {
20
        $this->routerMapping = $routerMapping;
21
    }
22
23
    public function registerPageView(PageViewAdded $event)
24
    {
25
        $this->routerMapping->registerPageView($event->getPageView());
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public static function getSubscribedEvents()
32
    {
33
        return [
34
            PageViewAdded::NAME => 'registerPageView',
35
        ];
36
    }
37
}
38