1 | <?php |
||
28 | trait ReferenceTrait |
||
29 | { |
||
30 | /** |
||
31 | * refernece start chars |
||
32 | * |
||
33 | * @var string |
||
34 | * @access protected |
||
35 | */ |
||
36 | protected $ref_start = '${'; |
||
37 | |||
38 | /** |
||
39 | * reference ending chars |
||
40 | * |
||
41 | * @var string |
||
42 | * @access protected |
||
43 | */ |
||
44 | protected $ref_end = '}'; |
||
45 | |||
46 | /** |
||
47 | * pattern to match |
||
48 | * |
||
49 | * @var string |
||
50 | * @access protected |
||
51 | */ |
||
52 | protected $ref_pattern; |
||
53 | |||
54 | /** |
||
55 | * unresolved reference |
||
56 | * |
||
57 | * @var array |
||
58 | * @access protected |
||
59 | */ |
||
60 | protected $unresolved = []; |
||
61 | |||
62 | /** |
||
63 | * {@inheritDoc} |
||
64 | */ |
||
65 | public function setReference( |
||
81 | |||
82 | /** |
||
83 | * {@inheritDoc} |
||
84 | */ |
||
85 | public function hasReference( |
||
99 | |||
100 | /** |
||
101 | * {@inheritDoc} |
||
102 | */ |
||
103 | public function deReference(/*# string */ $subject) |
||
130 | |||
131 | /** |
||
132 | * Resolve the reference $name |
||
133 | * |
||
134 | * @param string $name |
||
135 | * @return mixed |
||
136 | * @access protected |
||
137 | */ |
||
138 | protected function resolveReference(/*# string */ $name) |
||
152 | |||
153 | /** |
||
154 | * For unknown reference $name, NEED OVERLOAD |
||
155 | * |
||
156 | * @param string $name |
||
157 | * @return mixed |
||
158 | * @access protected |
||
159 | */ |
||
160 | protected function resolveUnknown(/*# string */ $name) |
||
164 | |||
165 | /** |
||
166 | * The real resolving method. return NULL for unknown reference |
||
167 | * |
||
168 | * @param string $name |
||
169 | * @return mixed |
||
170 | * @access protected |
||
171 | */ |
||
172 | abstract protected function getReference(/*# string */ $name); |
||
173 | } |
||
174 |
This check looks for the bodies of
if
statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
if
bodies can be removed. If you have an empty if but statements in theelse
branch, consider inverting the condition.could be turned into
This is much more concise to read.