Instance   A
last analyzed

Complexity

Total Complexity 17

Size/Duplication

Total Lines 155
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 1

Importance

Changes 0
Metric Value
wmc 17
lcom 3
cbo 1
dl 0
loc 155
rs 10
c 0
b 0
f 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
A setAlias() 0 10 2
A getAlias() 0 4 1
A hasAlias() 0 4 1
A setClassName() 0 6 1
A getClassName() 0 4 1
A isFactory() 0 4 1
A setIsFactory() 0 6 1
A isShared() 0 4 1
A setIsShared() 0 6 1
A setMethodBodyBuilder() 0 5 1
A getMethodBodyBuilder() 0 4 1
A getReturnValue() 0 4 1
A hasReturnValue() 0 4 1
A setReturnValue() 0 9 3
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2014-06-07 
5
 */
6
7
namespace Net\Bazzline\Component\Locator\Configuration;
8
9
use Net\Bazzline\Component\Locator\MethodBodyBuilder\MethodBodyBuilderInterface;
10
11
/**
12
 * Class Instance
13
 * @package Net\Bazzline\Component\Locator\Configuration
14
 */
15
class Instance
16
{
17
    /** @var string */
18
    private $alias;
19
20
    /** @var string */
21
    private $className;
22
23
    /** @var boolean */
24
    private $isFactory = false;
25
26
    /** @var boolean */
27
    private $isShared = true;
28
29
    /** @var MethodBodyBuilderInterface */
30
    private $methodBodyBuilder;
31
32
    /** @var string */
33
    private $returnValue;
34
35
    /**
36
     * @param string $alias
37
     * @return $this
38
     */
39
    public function setAlias($alias)
40
    {
41
        $alias = trim((string) $alias);
42
43
        if (strlen($alias) > 0) {
44
            $this->alias = (string) $alias;
45
        }
46
47
        return $this;
48
    }
49
50
    /**
51
     * @return null|string
52
     */
53
    public function getAlias()
54
    {
55
        return $this->alias;
56
    }
57
58
    /**
59
     * @return bool
60
     */
61
    public function hasAlias()
62
    {
63
        return (is_string($this->alias));
64
    }
65
66
    /**
67
     * @param string $className
68
     * @return $this
69
     */
70
    public function setClassName($className)
71
    {
72
        $this->className = (string) $className;
73
74
        return $this;
75
    }
76
77
    /**
78
     * @return null|string
79
     */
80
    public function getClassName()
81
    {
82
        return $this->className;
83
    }
84
85
    /**
86
     * @return null|boolean
87
     */
88
    public function isFactory()
89
    {
90
        return $this->isFactory;
91
    }
92
93
    /**
94
     * @param boolean $isFactory
95
     * @return $this
96
     */
97
    public function setIsFactory($isFactory)
98
    {
99
        $this->isFactory = (boolean) $isFactory;
100
101
        return $this;
102
    }
103
104
    /**
105
     * @return null|boolean
106
     */
107
    public function isShared()
108
    {
109
        return $this->isShared;
110
    }
111
112
    /**
113
     * @param boolean $isShared
114
     * @return $this
115
     */
116
    public function setIsShared($isShared)
117
    {
118
        $this->isShared = (boolean) $isShared;
119
120
        return $this;
121
    }
122
123
    /**
124
     * @param \Net\Bazzline\Component\Locator\MethodBodyBuilder\MethodBodyBuilderInterface $methodBodyBuilder
125
     */
126
    public function setMethodBodyBuilder(MethodBodyBuilderInterface $methodBodyBuilder)
127
    {
128
        $this->methodBodyBuilder = $methodBodyBuilder;
129
        $this->methodBodyBuilder->setInstance($this);
130
    }
131
132
    /**
133
     * @return \Net\Bazzline\Component\Locator\MethodBodyBuilder\MethodBodyBuilderInterface
134
     */
135
    public function getMethodBodyBuilder()
136
    {
137
        return $this->methodBodyBuilder;
138
    }
139
140
    /**
141
     * @return string
142
     */
143
    public function getReturnValue()
144
    {
145
        return $this->returnValue;
146
    }
147
148
    /**
149
     * @return bool
150
     */
151
    public function hasReturnValue()
152
    {
153
        return (!is_null($this->returnValue));
154
    }
155
156
    /**
157
     * @param string $returnValue
158
     * @return $this
159
     */
160
    public function setReturnValue($returnValue)
161
    {
162
        if ((is_string($returnValue))
163
            && (strlen($returnValue) > 0)) {
164
            $this->returnValue = $returnValue;
165
        }
166
167
        return $this;
168
    }
169
}
170