End::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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 (with length 0) if the offset is at the very end of the input.
10
 *
11
 * @author Martijn
12
 */
13
class End extends Parser
14
{
15 3
    protected function parse(&$input, $offset, Context $context)
16
    {
17 3
        return $offset === mb_strlen($input)
18 1
            ? $this->success($input, $offset)
19 3
            : $this->failure($input, $offset);
20
    }
21
22 3
    public function __toString()
23
    {
24 3
        return 'end';
25
    }
26
}
27