Completed
Push — master ( 05a043...a79f71 )
by Tim
15:11
created

DatabaseTable::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace HDNET\Autoloader\Annotation;
6
7
/**
8
 * @Annotation
9
 * @Target({"CLASS"})
10
 */
11
class DatabaseTable
12
{
13
    /**
14
     * @var string
15
     */
16
    public $tableName;
17
18
    /**
19
     * @throws \InvalidArgumentException
20
     */
21
    public function __construct(array $values)
22
    {
23
        if (isset($values['value'])) {
24
            $this->argumentName = $values['value'];
0 ignored issues
show
Bug introduced by
The property argumentName does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
25
        } elseif (isset($values['argumentName'])) {
26
            $this->argumentName = $values['argumentName'];
27
        }
28
    }
29
30
    public function __toString()
31
    {
32
        return (string)$this->tableName;
33
    }
34
}
35