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

Any::parse()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 3
dl 0
loc 7
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 any single symbol
10
 *
11
 * @author Martijn
12
 */
13
class Any extends Parser
14
{
15
16
    protected function parse(&$input, $offset, Context $context)
17
    {
18
        if ($offset < mb_strlen($input)) {
19
            return $this->success($input, $offset, 1);
20
        }
21
22
        return $this->failure($input, $offset);
23
    }
24
25
    public function __toString()
26
    {
27
        return '.';
28
    }
29
30
}
31