@@ -54,8 +54,7 @@ |
||
| 54 | 54 | * @class Operator |
| 55 | 55 | * @package Platine\Expression |
| 56 | 56 | */ |
| 57 | -class Operator |
|
| 58 | -{ |
|
| 57 | +class Operator { |
|
| 59 | 58 | /** |
| 60 | 59 | * The operator like =, >=, ... |
| 61 | 60 | * @var string |
@@ -51,8 +51,7 @@ discard block |
||
| 51 | 51 | * @class Token |
| 52 | 52 | * @package Platine\Expression |
| 53 | 53 | */ |
| 54 | -class Token |
|
| 55 | -{ |
|
| 54 | +class Token { |
|
| 56 | 55 | /** |
| 57 | 56 | * Constants |
| 58 | 57 | */ |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | * @param mixed $value |
| 97 | 96 | * @param string|null $name |
| 98 | 97 | */ |
| 99 | - public function __construct(string $type, $value, ?string $name = null) |
|
| 100 | - { |
|
| 98 | + public function __construct(string $type, $value, ?string $name = null) { |
|
| 101 | 99 | $this->name = $name; |
| 102 | 100 | $this->value = $value; |
| 103 | 101 | $this->type = $type; |
@@ -116,8 +114,7 @@ discard block |
||
| 116 | 114 | * Return the token value |
| 117 | 115 | * @return mixed |
| 118 | 116 | */ |
| 119 | - public function getValue() |
|
| 120 | - { |
|
| 117 | + public function getValue() { |
|
| 121 | 118 | return $this->value; |
| 122 | 119 | } |
| 123 | 120 | |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * @class CustomFunction |
| 55 | 55 | * @package Platine\Expression |
| 56 | 56 | */ |
| 57 | -class CustomFunction |
|
| 58 | -{ |
|
| 57 | +class CustomFunction { |
|
| 59 | 58 | /** |
| 60 | 59 | * The function name |
| 61 | 60 | * @var string |
@@ -79,8 +78,7 @@ discard block |
||
| 79 | 78 | * @param string $name |
| 80 | 79 | * @param callable $function |
| 81 | 80 | */ |
| 82 | - public function __construct(string $name, callable $function) |
|
| 83 | - { |
|
| 81 | + public function __construct(string $name, callable $function) { |
|
| 84 | 82 | $this->name = $name; |
| 85 | 83 | $this->function = $function; |
| 86 | 84 | |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * @class Tokenizer |
| 57 | 57 | * @package Platine\Expression |
| 58 | 58 | */ |
| 59 | -class Tokenizer |
|
| 60 | -{ |
|
| 59 | +class Tokenizer { |
|
| 61 | 60 | /** |
| 62 | 61 | * List of token |
| 63 | 62 | * @var array<Token> |
@@ -111,8 +110,7 @@ discard block |
||
| 111 | 110 | * @param string $input |
| 112 | 111 | * @param array<string, Operator> $operators |
| 113 | 112 | */ |
| 114 | - public function __construct(string $input, array $operators) |
|
| 115 | - { |
|
| 113 | + public function __construct(string $input, array $operators) { |
|
| 116 | 114 | $this->input = $input; |
| 117 | 115 | $this->operators = $operators; |
| 118 | 116 | } |
@@ -55,8 +55,7 @@ discard block |
||
| 55 | 55 | * @class Executor |
| 56 | 56 | * @package Platine\Expression |
| 57 | 57 | */ |
| 58 | -class Executor |
|
| 59 | -{ |
|
| 58 | +class Executor { |
|
| 60 | 59 | /** |
| 61 | 60 | * The variable list |
| 62 | 61 | * @var array<string, int|float> |
@@ -96,16 +95,14 @@ discard block |
||
| 96 | 95 | /** |
| 97 | 96 | * Create new instance |
| 98 | 97 | */ |
| 99 | - public function __construct() |
|
| 100 | - { |
|
| 98 | + public function __construct() { |
|
| 101 | 99 | $this->addDefaults(); |
| 102 | 100 | } |
| 103 | 101 | |
| 104 | 102 | /** |
| 105 | 103 | * When do clone of this object |
| 106 | 104 | */ |
| 107 | - public function __clone() |
|
| 108 | - { |
|
| 105 | + public function __clone() { |
|
| 109 | 106 | $this->addDefaults(); |
| 110 | 107 | } |
| 111 | 108 | |
@@ -115,8 +112,7 @@ discard block |
||
| 115 | 112 | * @param bool $cache |
| 116 | 113 | * @return int|float|string|null |
| 117 | 114 | */ |
| 118 | - public function execute(string $expression, bool $cache = true) |
|
| 119 | - { |
|
| 115 | + public function execute(string $expression, bool $cache = true) { |
|
| 120 | 116 | $cacheKey = $expression; |
| 121 | 117 | if (!array_key_exists($cacheKey, $this->caches)) { |
| 122 | 118 | $tokens = (new Tokenizer($expression, $this->operators)) |
@@ -172,8 +168,7 @@ discard block |
||
| 172 | 168 | * @param string $name |
| 173 | 169 | * @return int|float |
| 174 | 170 | */ |
| 175 | - public function getVariable(string $name) |
|
| 176 | - { |
|
| 171 | + public function getVariable(string $name) { |
|
| 177 | 172 | if (! array_key_exists($name, $this->variables)) { |
| 178 | 173 | if ($this->variableNotFoundHandler !== null) { |
| 179 | 174 | return call_user_func($this->variableNotFoundHandler, $name); |