Passed
Pull Request — master (#58)
by
unknown
02:54
created

SubscribeDoctrineEvents::__construct()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 12
rs 10
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\Attribute;
13
14
/**
15
 * Attribute for ORM Subscribed Event.
16
 *
17
 * @author Roni Saha <[email protected]>
18
 */
19
20
#[\Attribute(\Attribute::TARGET_CLASS)]
21
/* @final */ class SubscribeDoctrineEvents
22
{
23
    public $events = array();
24
25
    public function __construct(array $values)
26
    {
27
        if (isset($values['value'])) {
28
            $values['events'] = $values['value'];
29
        }
30
        if (!isset($values['events'])) {
31
            return;
32
        }
33
34
        $this->events = is_array($values['events']) ? $values['events'] : array_map('trim', explode(',', $values['events']));
35
36
        $this->events = array_filter($this->events);
37
    }
38
}
39