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

SubscribeDoctrineEvents   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 9
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

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