Completed
Push — master ( d10f54...00ced4 )
by
unknown
05:32
created

PropertyDefinition::toPropertyMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 5
cp 0
cc 1
eloc 5
nc 1
nop 1
crap 2
1
<?php declare(strict_types = 1);
2
/**
3
 * Created by PhpStorm.
4
 * User: root
5
 * Date: 02.08.16
6
 * Time: 0:46.
7
 */
8
namespace samsonframework\container\definition;
9
10
use samsonframework\container\definition\reference\ReferenceInterface;
11
12
/**
13
 * Class PropertyDefinition
14
 *
15
 * @package samsonframework\container\definition
16
 */
17
class PropertyDefinition extends AbstractPropertyDefinition implements PropertyBuilderInterface
18
{
19
    /** @var string Property name */
20
    protected $propertyName;
21
    /** @var bool Flag that property is public */
22
    public $isPublic = false;
23
    /** @var int Property modifiers */
24
    public $modifiers = 0;
25
26
    /**
27
     * Define dependency
28
     *
29
     * @param ReferenceInterface $dependency
30
     * @return PropertyBuilderInterface
31
     */
32 8
    public function defineDependency(ReferenceInterface $dependency): PropertyBuilderInterface
33
    {
34 8
        $this->dependency = $dependency;
35
36 8
        return $this;
37
    }
38
39
    /**
40
     * @return string
41
     */
42 2
    public function getPropertyName(): string
43
    {
44 2
        return $this->propertyName;
45
    }
46
47
    /**
48
     * @param string $propertyName
49
     * @return PropertyDefinition
50
     */
51 10
    public function setPropertyName(string $propertyName): PropertyDefinition
52
    {
53 10
        $this->propertyName = $propertyName;
54
55 10
        return $this;
56
    }
57
58
    /**
59
     * @return int
60
     */
61 2
    public function getModifiers(): int
62
    {
63 2
        return $this->modifiers;
64
    }
65
66
    /**
67
     * @param int $modifiers
68
     * @return AbstractPropertyDefinition
69
     */
70 5
    public function setModifiers(int $modifiers): AbstractPropertyDefinition
71
    {
72 5
        $this->modifiers = $modifiers;
73
74 5
        return $this;
75
    }
76
77
    /**
78
     * @return boolean
79
     */
80 3
    public function isPublic(): bool
81
    {
82 3
        return $this->isPublic;
83
    }
84
85
    /**
86
     * @param boolean $isPublic
87
     * @return AbstractPropertyDefinition
88
     */
89 5
    public function setIsPublic(bool $isPublic): AbstractPropertyDefinition
90
    {
91 5
        $this->isPublic = $isPublic;
92
93 5
        return $this;
94
    }
95
}
96