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

ODMSubscribedEvents   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 4
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