Completed
Push — master ( c80620...0cd8d9 )
by Martijn
03:25
created

Nothing::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Vanderlee\Comprehend\Parser\Terminal;
4
5
use Vanderlee\Comprehend\Core\Context;
6
use Vanderlee\Comprehend\Parser\Parser;
7
8
/**
9
 * Matches always, with length zero.
10
 * This serves as a placeholder for badly written BNF specifications and should not be used in normal situations.
11
 * Do NOT use this within repetitions!
12
 *
13
 * @author Martijn
14
 */
15
class Nothing extends Parser
16
{
17
18
    protected function parse(&$input, $offset, Context $context)
19
    {
20
        return $this->makeMatch($offset <= mb_strlen($input), $input, 0);
21
    }
22
23
    public function __toString()
24
    {
25
        return '0.';
26
    }
27
28
}
29