Completed
Pull Request — master (#34)
by
unknown
13:06
created

ODMSubscribedEvents::__construct()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
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 ODM Subscribed Event.
16
 *
17
 * @Annotation
18
 * @Target({"CLASS"})
19
 *
20
 * @author Roni Saha <[email protected]>
21
 */
22
final class ODMSubscribedEvents
23
{
24
    public $events = [];
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(
36
            'trim',
37
            explode(',', $values['events'])
38
        );
39
40
        $this->events = array_filter($this->events);
41
    }
42
}
43