Overview

Namespaces

  • Deimos
    • Flow
      • Extension
        • TBlock
        • TFor
        • TForeach
        • TIF
        • TLiteral
        • TPHP
        • TSimple
        • TTry
        • TWhile
      • Traits
  • PHP

Classes

  • Deimos\Flow\Block
  • Deimos\Flow\Configure
  • Deimos\Flow\DefaultConfig
  • Deimos\Flow\DefaultContainer
  • Deimos\Flow\Extension\TBlock\TBlockStart
  • Deimos\Flow\Extension\TBlock\TEndBlock
  • Deimos\Flow\Extension\TFor\TEndFor
  • Deimos\Flow\Extension\TFor\TFor
  • Deimos\Flow\Extension\TForeach\TElseForeach
  • Deimos\Flow\Extension\TForeach\TEndForeach
  • Deimos\Flow\Extension\TForeach\TForeach
  • Deimos\Flow\Extension\TIF\TELSE
  • Deimos\Flow\Extension\TIF\TELSEIF
  • Deimos\Flow\Extension\TIF\TEndIF
  • Deimos\Flow\Extension\TIF\TIF
  • Deimos\Flow\Extension\TLiteral\TLiteral
  • Deimos\Flow\Extension\TPHP\TEndPHP
  • Deimos\Flow\Extension\TPHP\TPHP
  • Deimos\Flow\Extension\TSimple\TAssign
  • Deimos\Flow\Extension\TSimple\TBreak
  • Deimos\Flow\Extension\TSimple\TContinue
  • Deimos\Flow\Extension\TSimple\TExtends
  • Deimos\Flow\Extension\TSimple\TInclude
  • Deimos\Flow\Extension\TSimple\TPartial
  • Deimos\Flow\Extension\TSimple\TVariable
  • Deimos\Flow\Extension\TTry\TCatch
  • Deimos\Flow\Extension\TTry\TEndTry
  • Deimos\Flow\Extension\TTry\TFinally
  • Deimos\Flow\Extension\TTry\TTry
  • Deimos\Flow\Extension\TWhile\TEndWhile
  • Deimos\Flow\Extension\TWhile\TWhile
  • Deimos\Flow\Flow
  • Deimos\Flow\FlowForeach
  • Deimos\Flow\FlowFunction
  • Deimos\Flow\ForeachState
  • Deimos\Flow\Lexer
  • Deimos\Flow\LexerConst
  • Deimos\Flow\Tokenizer

Interfaces

  • Throwable

Traits

  • Deimos\Flow\Traits\Block
  • Deimos\Flow\Traits\FileSystem
  • Deimos\Flow\Traits\Tokenizer

Exceptions

  • BadFunctionCallException
  • Exception
  • InvalidArgumentException
  • LogicException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: namespace Deimos\Flow;
 4: 
 5: class Lexer
 6: {
 7: 
 8:     /**
 9:      * @var Configure $configure
10:      */
11:     protected $configure;
12: 
13:     /**
14:      * @var array
15:      */
16:     protected $data = [
17: 
18:         // if
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:         // for
25:         LexerConst::T_FOR          => Extension\TFor\TFor::class,
26:         LexerConst::T_END_FOR      => Extension\TFor\TEndFor::class,
27: 
28:         // while
29:         LexerConst::T_WHILE        => Extension\TWhile\TWhile::class,
30:         LexerConst::T_END_WHILE    => Extension\TWhile\TEndWhile::class,
31: 
32:         // foreach
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:         // operators
38:         LexerConst::T_CONTINUE     => Extension\TSimple\TContinue::class,
39:         LexerConst::T_BREAK        => Extension\TSimple\TBreak::class,
40: 
41:         // PHP
42:         LexerConst::T_PHP          => Extension\TPHP\TPHP::class,
43:         LexerConst::T_END_PHP      => Extension\TPHP\TEndPHP::class,
44: 
45:         // ASSIGN
46:         LexerConst::T_ASSIGN       => Extension\TSimple\TAssign::class,
47: 
48:         // variable
49:         LexerConst::T_VARIABLE     => Extension\TSimple\TVariable::class,
50: 
51:         // include
52:         LexerConst::T_INCLUDE      => Extension\TSimple\TInclude::class,
53: 
54:         // extends
55:         LexerConst::T_EXTENDS      => Extension\TSimple\TExtends::class,
56: 
57:         // partial
58:         LexerConst::T_PARTIAL      => Extension\TSimple\TPartial::class,
59: 
60:         // block
61:         LexerConst::T_BLOCK_START  => Extension\TBlock\TBlockStart::class,
62:         LexerConst::T_BLOCK_END    => Extension\TBlock\TEndBlock::class,
63: 
64:         // try|catch|finally
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:      * Lexer constructor.
74:      *
75:      * @param Configure $configure
76:      */
77:     public function __construct(Configure $configure)
78:     {
79:         $this->configure = $configure;
80:     }
81: 
82:     /**
83:      * @param $key
84:      *
85:      * @return mixed
86:      *
87:      * @throws \InvalidArgumentException
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: }
API documentation generated by ApiGen