1: <?php
2:
3: namespace Deimos\Flow;
4:
5: class Lexer
6: {
7:
8: 9: 10:
11: protected $configure;
12:
13: 14: 15:
16: protected $data = [
17:
18:
19: LexerConst::T_IF => Extension\TIF\TIF::class,
20: LexerConst::T_ELSEIF => Extension\TIF\TELSEIF::class,
21: LexerConst::T_ELSE => Extension\TIF\TELSE::class,
22: LexerConst::T_END_IF => Extension\TIF\TEndIF::class,
23:
24:
25: LexerConst::T_FOR => Extension\TFor\TFor::class,
26: LexerConst::T_END_FOR => Extension\TFor\TEndFor::class,
27:
28:
29: LexerConst::T_WHILE => Extension\TWhile\TWhile::class,
30: LexerConst::T_END_WHILE => Extension\TWhile\TEndWhile::class,
31:
32:
33: LexerConst::T_FOREACH => Extension\TForeach\TForeach::class,
34: LexerConst::T_FOREACH_ELSE => Extension\TForeach\TElseForeach::class,
35: LexerConst::T_END_FOREACH => Extension\TForeach\TEndForeach::class,
36:
37:
38: LexerConst::T_CONTINUE => Extension\TSimple\TContinue::class,
39: LexerConst::T_BREAK => Extension\TSimple\TBreak::class,
40:
41:
42: LexerConst::T_PHP => Extension\TPHP\TPHP::class,
43: LexerConst::T_END_PHP => Extension\TPHP\TEndPHP::class,
44:
45:
46: LexerConst::T_ASSIGN => Extension\TSimple\TAssign::class,
47:
48:
49: LexerConst::T_VARIABLE => Extension\TSimple\TVariable::class,
50:
51:
52: LexerConst::T_INCLUDE => Extension\TSimple\TInclude::class,
53:
54:
55: LexerConst::T_EXTENDS => Extension\TSimple\TExtends::class,
56:
57:
58: LexerConst::T_PARTIAL => Extension\TSimple\TPartial::class,
59:
60:
61: LexerConst::T_BLOCK_START => Extension\TBlock\TBlockStart::class,
62: LexerConst::T_BLOCK_END => Extension\TBlock\TEndBlock::class,
63:
64:
65: LexerConst::T_TRY => Extension\TTry\TTry::class,
66: LexerConst::T_CATCH => Extension\TTry\TCatch::class,
67: LexerConst::T_FINALLY => Extension\TTry\TFinally::class,
68: LexerConst::T_END_TRY => Extension\TTry\TEndTry::class,
69:
70: ];
71:
72: 73: 74: 75: 76:
77: public function __construct(Configure $configure)
78: {
79: $this->configure = $configure;
80: }
81:
82: 83: 84: 85: 86: 87: 88:
89: public function get($key)
90: {
91: if (!isset($this->data[$key]))
92: {
93: throw new \InvalidArgumentException('Config key "' . $key . '" not found!');
94: }
95:
96: return $this->data[$key];
97: }
98:
99: }