@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | false===$content and $this->isLast=true; |
35 | 35 | |
36 | - $this->content= rtrim($content,"\n"); |
|
36 | + $this->content=rtrim($content, "\n"); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function getContent():string |
45 | 45 | { |
46 | - return ltrim($this->content,"\t"); |
|
46 | + return ltrim($this->content, "\t"); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function slice( int$start=0, int...$lengths ):string |
68 | 68 | { |
69 | - return substr($this->getContent(),$start,...array_slice($lengths,0,1)); |
|
69 | + return substr($this->getContent(), $start, ...array_slice($lengths, 0, 1)); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getChar( int$offset ):string |
80 | 80 | { |
81 | - return substr($this->getcontent(),$offset,1); |
|
81 | + return substr($this->getcontent(), $offset, 1); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function pregMatch( string$pattern ):bool |
92 | 92 | { |
93 | - return !!preg_match($pattern,ltrim($this->content,"\t")); |
|
93 | + return !!preg_match($pattern, ltrim($this->content, "\t")); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function pregGet( string$pattern, /*int|string*/$match=0 ):string |
105 | 105 | { |
106 | - preg_match($pattern,ltrim($this->content,"\t"),$matches); |
|
107 | - return $matches[$match]??''; |
|
106 | + preg_match($pattern, ltrim($this->content, "\t"), $matches); |
|
107 | + return $matches[ $match ]??''; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function pregMap( string$pattern, callable$callback ):array |
119 | 119 | { |
120 | - preg_match_all($pattern,ltrim($this->content,"\t"),$matches); |
|
121 | - return array_map($callback,...$matches); |
|
120 | + preg_match_all($pattern, ltrim($this->content, "\t"), $matches); |
|
121 | + return array_map($callback, ...$matches); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | // return (static function( $a ):int{$i=0;while($a{$i}==="\t")++$i;return $i;})($this->content); |
132 | 132 | |
133 | - return strlen($this->content)-strlen(ltrim($this->content,"\t")); |
|
133 | + return strlen($this->content)-strlen(ltrim($this->content, "\t")); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -190,6 +190,6 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function getSubIndentLine():self |
192 | 192 | { |
193 | - return new static(ltrim($this->getContent(),' ')); |
|
193 | + return new static(ltrim($this->getContent(), ' ')); |
|
194 | 194 | } |
195 | 195 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | */ |
31 | 31 | final public function __construct( Document$document ) |
32 | 32 | { |
33 | - $this->document= $document; |
|
33 | + $this->document=$document; |
|
34 | 34 | |
35 | 35 | $this->construct(); |
36 | 36 | } |
@@ -48,7 +48,9 @@ |
||
48 | 48 | /** |
49 | 49 | * Real constructor to be rewrite. |
50 | 50 | */ |
51 | - protected function construct(){} |
|
51 | + protected function construct() |
|
52 | + { |
|
53 | +} |
|
52 | 54 | |
53 | 55 | /** |
54 | 56 | * Parsing line. |