Completed
Push — master ( e75413...39c194 )
by Roni
14:44 queued 13:17
created

SubscribeDoctrineEvents::__construct()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
c 0
b 0
f 0
rs 9.8333
cc 4
nc 6
nop 1
1
<?php
2
3
/*
4
 * This file is part of the XiideaEasyAuditBundle package.
5
 *
6
 * (c) Xiidea <http://www.xiidea.net>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Xiidea\EasyAuditBundle\Annotation;
13
14
/**
15
 * Annotation for ORM Subscribed Event.
16
 *
17
 * @Annotation
18
 * @Target({"CLASS"})
19
 *
20
 * @author Roni Saha <[email protected]>
21
 */
22
/* @final */ class SubscribeDoctrineEvents
23
{
24
    public $events = array();
25
26
    public function __construct(array $values)
27
    {
28
        if (isset($values['value'])) {
29
            $values['events'] = $values['value'];
30
        }
31
        if (!isset($values['events'])) {
32
            return;
33
        }
34
35
        $this->events = is_array($values['events']) ? $values['events'] : array_map('trim', explode(',', $values['events']));
36
37
        $this->events = array_filter($this->events);
38
    }
39
}
40