Nothing   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 3 1
A __toString() 0 3 1
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 5
    protected function parse(&$input, $offset, Context $context)
18
    {
19 5
        return $this->makeMatch($offset <= mb_strlen($input), $input, 0);
20
    }
21
22 5
    public function __toString()
23
    {
24 5
        return '0.';
25
    }
26
}
27