@@ 130-152 (lines=23) @@ | ||
127 | * |
|
128 | * @param string $simpleDirective the regexp that will match the starting block directives |
|
129 | */ |
|
130 | public function setStartMultiLine($startMultiLine) |
|
131 | { |
|
132 | try { |
|
133 | Assert::string($startMultiLine); |
|
134 | } catch (InvalidArgumentException $e) { |
|
135 | throw ServerException::forInvalidMatcher( |
|
136 | $startMultiLine, |
|
137 | 'The starting block directive matcher is expected to be a string. Got: %s' |
|
138 | ); |
|
139 | } |
|
140 | ||
141 | if (!$this->isValidRegex($startMultiLine)) { |
|
142 | throw ServerException::forInvalidMatcher( |
|
143 | $startMultiLine, |
|
144 | 'The starting block directive matcher is expected to be a regexp '. |
|
145 | 'containing named subpatterns "key" and "value". Got: %s' |
|
146 | ); |
|
147 | } |
|
148 | ||
149 | $this->startMultiLine = $startMultiLine; |
|
150 | ||
151 | return $this; |
|
152 | } |
|
153 | ||
154 | /** |
|
155 | * Gets the regexp that will match the ending block directives. |
|
@@ 169-190 (lines=22) @@ | ||
166 | * |
|
167 | * @param string $endMultiLine the regexp that will match the ending block directives |
|
168 | */ |
|
169 | public function setEndMultiLine($endMultiLine) |
|
170 | { |
|
171 | try { |
|
172 | Assert::string($endMultiLine); |
|
173 | } catch (InvalidArgumentException $e) { |
|
174 | throw ServerException::forInvalidMatcher( |
|
175 | $endMultiLine, |
|
176 | 'The endind block directive matcher is expected to be a string. Got: %s' |
|
177 | ); |
|
178 | } |
|
179 | ||
180 | if (!$this->isValidRegex($endMultiLine, false)) { |
|
181 | throw ServerException::forInvalidMatcher( |
|
182 | $endMultiLine, |
|
183 | 'The ending block directive matcher is expected to be a regexp . Got: %s' |
|
184 | ); |
|
185 | } |
|
186 | ||
187 | $this->endMultiLine = $endMultiLine; |
|
188 | ||
189 | return $this; |
|
190 | } |
|
191 | ||
192 | /** |
|
193 | * Gets the regexp that will match the simple directives. |
|
@@ 207-229 (lines=23) @@ | ||
204 | * |
|
205 | * @param string $simpleDirective the regexp that will match the simple directives |
|
206 | */ |
|
207 | public function setSimpleDirective($simpleDirective) |
|
208 | { |
|
209 | try { |
|
210 | Assert::string($simpleDirective); |
|
211 | } catch (InvalidArgumentException $e) { |
|
212 | throw ServerException::forInvalidMatcher( |
|
213 | $simpleDirective, |
|
214 | 'The simple directive matcher is expected to be a string. Got: %s' |
|
215 | ); |
|
216 | } |
|
217 | ||
218 | if (!$this->isValidRegex($simpleDirective)) { |
|
219 | throw ServerException::forInvalidMatcher( |
|
220 | $simpleDirective, |
|
221 | 'The simple directive matcher is expected to be a regexp '. |
|
222 | 'containing named subpatterns "key" and "value". Got: %s' |
|
223 | ); |
|
224 | } |
|
225 | ||
226 | $this->simpleDirective = $simpleDirective; |
|
227 | ||
228 | return $this; |
|
229 | } |
|
230 | ||
231 | /** |
|
232 | * Confirms if a matcher is a valid reguler expression. |