Completed
Push — master ( 5534f4...2bcb5e )
by Peter
05:17
created

Get::registr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
8
 */
9
namespace AnimeDb\Bundle\AppBundle\Event\Widget;
10
11
use Symfony\Component\EventDispatcher\Event;
12
use AnimeDb\Bundle\AppBundle\Service\WidgetsContainer;
13
14
/**
15
 * Event thrown when a widgets container get a list of widgets for place.
16
 */
17
class Get extends Event
18
{
19
    /**
20
     * @var WidgetsContainer
21
     */
22
    protected $container;
23
24
    /**
25
     * @var string
26
     */
27
    protected $place;
28
29
    /**
30
     * @param WidgetsContainer $container
31
     * @param string $place
32
     */
33 4
    public function __construct(WidgetsContainer $container, $place)
34
    {
35 4
        $this->container = $container;
36 4
        $this->place = $place;
37 4
    }
38
39
    /**
40
     * @return WidgetsContainer
41
     */
42 1
    public function getWidgetsContainer()
43
    {
44 1
        return $this->container;
45
    }
46
47
    /**
48
     * @return string
49
     */
50 1
    public function getPlace()
51
    {
52 1
        return $this->place;
53
    }
54
55
    /**
56
     * Regist widget.
57
     *
58
     * Controller example:
59
     *   AcmeDemoBundle:Welcome:index
60
     *   AcmeArticleBundle:Article:show
61
     *
62
     * @param string $controller
63
     *
64
     * @return bool
65
     */
66 1
    public function registr($controller)
67
    {
68 1
        return $this->container->registr($this->place, $controller);
69
    }
70
71
    /**
72
     * @param string $controller
73
     *
74
     * @return bool
75
     */
76 1
    public function unregistr($controller)
77
    {
78 1
        return $this->container->unregistr($this->place, $controller);
79
    }
80
}
81