Completed
Push — master ( a79f71...19c9d7 )
by Tim
12:15
created

DatabaseKey   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 3
A __toString() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace HDNET\Autoloader\Annotation;
6
7
/**
8
 * @Annotation
9
 * @Target({"CLASS"})
10
 */
11
class DatabaseKey
12
{
13
    /**
14
     * @var string
15
     */
16
    public $key;
17
18
    /**
19
     * @throws \InvalidArgumentException
20
     */
21
    public function __construct(array $values)
22
    {
23
        if (isset($values['value'])) {
24
            $this->key = $values['value'];
25
        } elseif (isset($values['argumentName'])) {
26
            $this->key = $values['argumentName'];
27
        }
28
    }
29
30
    public function __toString()
31
    {
32
        return (string)$this->key;
33
    }
34
}
35