1 | <?php |
||
2 | |||
3 | namespace Vanderlee\Comprehend\Directive; |
||
4 | |||
5 | use Vanderlee\Comprehend\Core\ArgumentsTrait; |
||
6 | use Vanderlee\Comprehend\Core\Context; |
||
7 | use Vanderlee\Comprehend\Parser\Parser; |
||
8 | |||
9 | /** |
||
10 | * Description of LexemeDirective. |
||
11 | * |
||
12 | * @author Martijn |
||
13 | */ |
||
14 | class Space extends Parser |
||
15 | { |
||
16 | use ArgumentsTrait; |
||
17 | |||
18 | /** |
||
19 | * @var null|Parser |
||
20 | */ |
||
21 | private $spacer; |
||
22 | |||
23 | /** |
||
24 | * @var null|Parser |
||
25 | */ |
||
26 | private $parser; |
||
27 | |||
28 | /** |
||
29 | * Set (or disable) a spacer for the parser. |
||
30 | * |
||
31 | * @param Parser|string|int|bool|null $spacer |
||
32 | * @param Parser|string|int $parser |
||
33 | */ |
||
34 | 2 | public function __construct($spacer, $parser) |
|
35 | { |
||
36 | 2 | $this->spacer = $spacer === null |
|
37 | 1 | ? null |
|
38 | 1 | : self::getArgument($spacer); |
|
39 | 2 | $this->parser = self::getArgument($parser); |
|
40 | 2 | } |
|
41 | |||
42 | 23 | protected function parse(&$input, $offset, Context $context) |
|
43 | { |
||
44 | 23 | $context->pushSpacer($this->spacer); |
|
45 | 23 | $match = $this->parser->parse($input, $offset, $context); |
|
0 ignored issues
–
show
|
|||
46 | 23 | $context->popSpacer(); |
|
47 | |||
48 | 23 | return $match; |
|
49 | } |
||
50 | |||
51 | 23 | public function __toString() |
|
52 | { |
||
53 | 23 | return (string)$this->parser; |
|
54 | } |
||
55 | } |
||
56 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.