1 | <?php |
||
11 | class ComponentBuffer { |
||
12 | private $buffer = ''; |
||
|
|||
13 | private $literalBuffer = ''; |
||
14 | private $inEcho = false; |
||
15 | private $indent; |
||
16 | private $depth; |
||
17 | private $scopes; |
||
18 | |||
19 | 69 | public function __construct(array $defaults = []) { |
|
30 | |||
31 | 62 | public function echoLiteral($value) { |
|
34 | |||
35 | 47 | public function echoCode($php) { |
|
44 | |||
45 | 69 | private function flushLiteralBuffer() { |
|
52 | |||
53 | 62 | private function ensureEcho($append) { |
|
61 | |||
62 | 69 | protected function px($add = 0) { |
|
65 | |||
66 | 69 | public function appendCode($php) { |
|
72 | |||
73 | 69 | private function flushEcho() { |
|
81 | |||
82 | 69 | public function indent($add) { |
|
86 | |||
87 | 21 | public function depth($add = 1) { |
|
90 | |||
91 | 22 | public function depthName($name, $add = 0) { |
|
100 | |||
101 | 69 | public function pushScope(array $vars) { |
|
104 | |||
105 | 61 | public function popScope() { |
|
108 | |||
109 | 61 | public function getScopeVariables() { |
|
113 | |||
114 | public function getScope() { |
||
117 | |||
118 | 13 | public function getAllScopes() { |
|
121 | |||
122 | 61 | public function flush() { |
|
127 | |||
128 | /** |
||
129 | * Get the indent. |
||
130 | * |
||
131 | * @return int Returns the indent. |
||
132 | */ |
||
133 | 13 | public function getIndent() { |
|
136 | |||
137 | /** |
||
138 | * Get the depth. |
||
139 | * |
||
140 | * @return mixed Returns the depth. |
||
141 | */ |
||
142 | 13 | public function getDepth() { |
|
145 | } |
||
146 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.