@@ -32,34 +32,34 @@ |
||
| 32 | 32 | public const VALIDATION_ERROR_PATH_UNDERSCORE = 48203; |
| 33 | 33 | public const VALIDATION_ERROR_NAME_UNDERSCORE = 48204; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | 38 | protected string $path; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | 43 | protected string $name; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var string |
|
| 47 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var string |
|
| 47 | + */ |
|
| 48 | 48 | protected string $matchedText; |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | 53 | protected string $hash = ''; |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var OperationResult|NULL |
|
| 57 | - */ |
|
| 55 | + /** |
|
| 56 | + * @var OperationResult|NULL |
|
| 57 | + */ |
|
| 58 | 58 | protected ?OperationResult $validationResult = null; |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @var array<string> |
|
| 62 | - */ |
|
| 60 | + /** |
|
| 61 | + * @var array<string> |
|
| 62 | + */ |
|
| 63 | 63 | protected array $validations = array( |
| 64 | 64 | 'number_path', |
| 65 | 65 | 'number_name', |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | private ?Mailcode_Commands_Command $command; |
| 74 | 74 | |
| 75 | - public function __construct(string $path, string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand=null) |
|
| 75 | + public function __construct(string $path, string $name, string $matchedText, ?Mailcode_Commands_Command $sourceCommand = null) |
|
| 76 | 76 | { |
| 77 | 77 | $this->path = $path; |
| 78 | 78 | $this->name = $name; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public function getFullName() : string |
| 97 | 97 | { |
| 98 | - if(empty($this->path)) |
|
| 98 | + if (empty($this->path)) |
|
| 99 | 99 | { |
| 100 | 100 | return dollarize($this->name); |
| 101 | 101 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function getUniqueName() : string |
| 115 | 115 | { |
| 116 | - if(isset($this->command)) |
|
| 116 | + if (isset($this->command)) |
|
| 117 | 117 | { |
| 118 | 118 | return $this->getFullName().'/'.$this->command->getHash(); |
| 119 | 119 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | public function getHash() : string |
| 140 | 140 | { |
| 141 | - if(empty($this->hash)) |
|
| 141 | + if (empty($this->hash)) |
|
| 142 | 142 | { |
| 143 | 143 | $this->hash = md5($this->matchedText); |
| 144 | 144 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function getValidationResult() : OperationResult |
| 159 | 159 | { |
| 160 | - if(isset($this->validationResult)) |
|
| 160 | + if (isset($this->validationResult)) |
|
| 161 | 161 | { |
| 162 | 162 | return $this->validationResult; |
| 163 | 163 | } |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | protected function validate(OperationResult $result) : void |
| 173 | 173 | { |
| 174 | - foreach($this->validations as $validation) |
|
| 174 | + foreach ($this->validations as $validation) |
|
| 175 | 175 | { |
| 176 | 176 | $method = 'validate_'.$validation; |
| 177 | 177 | |
| 178 | - if(!method_exists($this, $method)) |
|
| 178 | + if (!method_exists($this, $method)) |
|
| 179 | 179 | { |
| 180 | 180 | throw new Mailcode_Exception( |
| 181 | 181 | 'Unknown validation method', |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | protected function validateNumber(string $value, int $errorCode) : void |
| 227 | 227 | { |
| 228 | - if(empty($value) || !is_numeric($value[0])) |
|
| 228 | + if (empty($value) || !is_numeric($value[0])) |
|
| 229 | 229 | { |
| 230 | 230 | return; |
| 231 | 231 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | protected function validateUnderscore(string $value, int $errorCode) : void |
| 244 | 244 | { |
| 245 | 245 | // allow empty paths |
| 246 | - if(empty($value)) |
|
| 246 | + if (empty($value)) |
|
| 247 | 247 | { |
| 248 | 248 | return; |
| 249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $length = strlen($value); |
| 252 | 252 | |
| 253 | 253 | // trimming underscores does not change the length: no underscores at start or end of string. |
| 254 | - if(strlen(trim($value, '_')) === $length) |
|
| 254 | + if (strlen(trim($value, '_')) === $length) |
|
| 255 | 255 | { |
| 256 | 256 | return; |
| 257 | 257 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | if ($command->isCountEnabled()) |
| 28 | 28 | { |
| 29 | 29 | $result = $this->buildCountAssignment($command); |
| 30 | - if($result !== null) { |
|
| 30 | + if ($result !== null) { |
|
| 31 | 31 | $assignmentString = $result; |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | return null; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if($variable->hasPath()) { |
|
| 50 | + if ($variable->hasPath()) { |
|
| 51 | 51 | return sprintf( |
| 52 | 52 | '$map.of(%s).keys("%s").count()', |
| 53 | 53 | dollarize($variable->getPath()), |