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

End   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 11
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

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