| 1 | <?php |
||
| 10 | class RegexpSubstringParser implements ParserInterface |
||
| 11 | { |
||
| 12 | /** @var string $regexp regexp for matching */ |
||
| 13 | private $regexp; |
||
| 14 | |||
| 15 | /** @var integer $start start position of substring */ |
||
| 16 | private $start; |
||
| 17 | |||
| 18 | /** @var integer $length length of substring (see PHP `substr` manual) */ |
||
| 19 | private $length; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * constructor |
||
| 23 | * |
||
| 24 | * @param string $regexp regexp for matching |
||
| 25 | * @param integer $start start position of substring |
||
| 26 | * @param integer $length length of substring |
||
| 27 | */ |
||
| 28 | 15 | public function __construct($regexp, $start, $length) |
|
| 34 | |||
| 35 | /** |
||
| 36 | * parse given `$source` and return substring result |
||
| 37 | * |
||
| 38 | * @param Source $source parser input |
||
| 39 | * @return array |
||
| 40 | * @throws UnserializeFailedException |
||
| 41 | */ |
||
| 42 | 15 | public function parse(Source $source) |
|
| 47 | } |
||
| 48 |