1 | <?php |
||
17 | abstract class ANode |
||
18 | { |
||
19 | use TGetter; |
||
20 | |||
21 | /** |
||
22 | * Htsl main object. |
||
23 | * |
||
24 | * @access protected |
||
25 | * |
||
26 | * @var \Htsl\Htsl |
||
27 | */ |
||
28 | protected $htsl; |
||
29 | |||
30 | /** |
||
31 | * The document. |
||
32 | * |
||
33 | * @access protected |
||
34 | * |
||
35 | * @var \Htsl\Parser\Document |
||
36 | */ |
||
37 | protected $document; |
||
38 | |||
39 | /** |
||
40 | * The document. |
||
41 | * |
||
42 | * @access protected |
||
43 | * |
||
44 | * @var \Htsl\ReadingBuffer\Line |
||
45 | */ |
||
46 | protected $line; |
||
47 | |||
48 | /** |
||
49 | * The config. |
||
50 | * |
||
51 | * @access protected |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $config; |
||
56 | |||
57 | |||
58 | /** |
||
59 | * Fake contructor of Node. |
||
60 | * |
||
61 | * @access public |
||
62 | * |
||
63 | * @param \Htsl\Parser\Document $document |
||
64 | * @param \Htsl\ReadingBuffer\Line $line |
||
65 | */ |
||
66 | final public function __construct( Document$document, Line$line ) |
||
74 | |||
75 | /** |
||
76 | * Real contructor to be rewrite. |
||
77 | * |
||
78 | * @access protected |
||
79 | * |
||
80 | * @return \Htsl\Parser\Node\Contracts\ANode |
||
81 | */ |
||
82 | abstract protected function construct():self; |
||
83 | |||
84 | /** |
||
85 | * Opening this node, and returning node opener. |
||
86 | * |
||
87 | * @access public |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | abstract public function open():string; |
||
92 | |||
93 | /** |
||
94 | * Close this node, and returning node closer. |
||
95 | * |
||
96 | * @access public |
||
97 | * |
||
98 | * @param \Htsl\ReadingBuffer\Line $closerLine The line when node closed. |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | abstract public function close( Line$closerLine ):string; |
||
103 | |||
104 | /** |
||
105 | * Getting whether this node contains a scope and scope name. |
||
106 | * |
||
107 | * @access public |
||
108 | * |
||
109 | * @return string | null |
||
110 | */ |
||
111 | public function getScope() |
||
115 | |||
116 | /** |
||
117 | * Getting the type of this node. |
||
118 | * |
||
119 | * @access public |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | public function getNodeType() |
||
128 | |||
129 | /** |
||
130 | * Loading node configuration. |
||
131 | * |
||
132 | * @access protected |
||
133 | * |
||
134 | * @param string $name |
||
135 | * @param \Htsl\Helper\IConfigProvider $configProvider |
||
136 | * |
||
137 | * @return \Htsl\Parser\Node\Contracts\ANode |
||
138 | */ |
||
139 | protected function loadConfig( string$name, IConfigProvider$configProvider ) |
||
177 | } |
||
178 |
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.