1 | <?php |
||
34 | abstract class ParserAbstract extends ObjectAbstract implements ParserInterface, DebuggableInterface |
||
35 | { |
||
36 | use DebuggableTrait; |
||
37 | |||
38 | /** |
||
39 | * flag for new route added. |
||
40 | * |
||
41 | * @var bool |
||
42 | * @access protected |
||
43 | */ |
||
44 | protected $modified = false; |
||
45 | |||
46 | /** |
||
47 | * regex storage |
||
48 | * |
||
49 | * @var string[] |
||
50 | * @access protected |
||
51 | */ |
||
52 | protected $regex = []; |
||
53 | |||
54 | /** |
||
55 | * pattern shortcuts |
||
56 | * |
||
57 | * @var string[] |
||
58 | * @access protected |
||
59 | */ |
||
60 | protected $shortcuts = [ |
||
61 | ':d}' => ':[0-9]++}', // digit only |
||
62 | ':l}' => ':[a-z]++}', // lower case |
||
63 | ':u}' => ':[A-Z]++}', // upper case |
||
64 | ':a}' => ':[0-9a-zA-Z]++}', // alphanumeric |
||
65 | ':c}' => ':[0-9a-zA-Z+_\-\.]++}', // common chars |
||
66 | ':nd}' => ':[^0-9/]++}', // not digits |
||
67 | ':xd}' => ':[^0-9/][^/]*+}', // no leading digits |
||
68 | ]; |
||
69 | |||
70 | /** |
||
71 | * @var string |
||
72 | */ |
||
73 | const MATCH_GROUP_NAME = "\s*([a-zA-Z][a-zA-Z0-9_]*)\s*"; |
||
74 | const MATCH_GROUP_TYPE = ":\s*([^{}]*(?:\{(?-1)\}[^{}]*)*)"; |
||
75 | const MATCH_SEGMENT = "[^/]++"; |
||
76 | |||
77 | /** |
||
78 | * Constructor |
||
79 | * |
||
80 | * @param array $properties |
||
81 | * @access public |
||
82 | */ |
||
83 | public function __construct(array $properties = []) |
||
87 | |||
88 | /** |
||
89 | * Update regex pool etc. |
||
90 | * |
||
91 | * @param string $routeName |
||
92 | * @param string $routePattern |
||
93 | * @param string $regex |
||
94 | * @access protected |
||
95 | */ |
||
96 | protected function doneProcess( |
||
111 | } |
||
112 |