@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function getParser() : Mailcode_Parser |
| 70 | 70 | { |
| 71 | - if(!isset($this->parser)) |
|
| 71 | + if (!isset($this->parser)) |
|
| 72 | 72 | { |
| 73 | 73 | $this->parser = new Mailcode_Parser($this); |
| 74 | 74 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function getCommands() : Mailcode_Commands |
| 86 | 86 | { |
| 87 | - if(!isset($this->commands)) |
|
| 87 | + if (!isset($this->commands)) |
|
| 88 | 88 | { |
| 89 | 89 | $this->commands = new Mailcode_Commands(); |
| 90 | 90 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function createVariables() : Mailcode_Variables |
| 112 | 112 | { |
| 113 | - if(!isset($this->variables)) |
|
| 113 | + if (!isset($this->variables)) |
|
| 114 | 114 | { |
| 115 | 115 | $this->variables = new Mailcode_Variables(); |
| 116 | 116 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | protected $validationResult = null; |
| 61 | 61 | |
| 62 | - public function __construct(string $type='', string $paramsString='', string $matchedText='') |
|
| 62 | + public function __construct(string $type = '', string $paramsString = '', string $matchedText = '') |
|
| 63 | 63 | { |
| 64 | 64 | $this->type = $type; |
| 65 | 65 | $this->paramsString = $paramsString; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $this->requireNonDummy(); |
| 99 | 99 | |
| 100 | - if($this->hash === '') { |
|
| 100 | + if ($this->hash === '') { |
|
| 101 | 101 | $this->hash = md5($this->matchedText); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | protected function requireNonDummy() : void |
| 108 | 108 | { |
| 109 | - if(!$this->isDummy()) |
|
| 109 | + if (!$this->isDummy()) |
|
| 110 | 110 | { |
| 111 | 111 | return; |
| 112 | 112 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $this->requireNonDummy(); |
| 129 | 129 | |
| 130 | - if(isset($this->validationResult)) |
|
| 130 | + if (isset($this->validationResult)) |
|
| 131 | 131 | { |
| 132 | 132 | return $this->validationResult; |
| 133 | 133 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | public function getValidationResult() : \AppUtils\OperationResult |
| 143 | 143 | { |
| 144 | - if(isset($this->validationResult)) |
|
| 144 | + if (isset($this->validationResult)) |
|
| 145 | 145 | { |
| 146 | 146 | return $this->validationResult; |
| 147 | 147 | } |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | { |
| 165 | 165 | $validations = array_merge($this->validations, $this->getValidations()); |
| 166 | 166 | |
| 167 | - foreach($validations as $validation) |
|
| 167 | + foreach ($validations as $validation) |
|
| 168 | 168 | { |
| 169 | 169 | $method = 'validateSyntax_'.$validation; |
| 170 | 170 | |
| 171 | - if(!method_exists($this, $method)) |
|
| 171 | + if (!method_exists($this, $method)) |
|
| 172 | 172 | { |
| 173 | 173 | throw new Mailcode_Exception( |
| 174 | 174 | 'Missing validation method', |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $this->$method(); |
| 185 | 185 | |
| 186 | 186 | // break off at the first validation issue |
| 187 | - if(!$this->validationResult->isValid()) |
|
| 187 | + if (!$this->validationResult->isValid()) |
|
| 188 | 188 | { |
| 189 | 189 | return; |
| 190 | 190 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | protected function validateSyntax_params() |
| 197 | 197 | { |
| 198 | - if($this->requiresParameters() && empty($this->paramsString)) |
|
| 198 | + if ($this->requiresParameters() && empty($this->paramsString)) |
|
| 199 | 199 | { |
| 200 | 200 | $this->validationResult->makeError( |
| 201 | 201 | t('Parameters have to be specified.'), |
@@ -207,14 +207,14 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | protected function validateSyntax_type_supported() |
| 209 | 209 | { |
| 210 | - if(!$this->supportsType() || empty($this->type)) |
|
| 210 | + if (!$this->supportsType() || empty($this->type)) |
|
| 211 | 211 | { |
| 212 | 212 | return; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $types = $this->getSupportedTypes(); |
| 216 | 216 | |
| 217 | - if(!in_array($this->type, $types)) |
|
| 217 | + if (!in_array($this->type, $types)) |
|
| 218 | 218 | { |
| 219 | 219 | $this->validationResult->makeError( |
| 220 | 220 | t('The command addon %1$s is not supported.', $this->type).' '. |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | protected function validateSyntax_type_unsupported() |
| 230 | 230 | { |
| 231 | - if($this->supportsType() || empty($this->type)) |
|
| 231 | + if ($this->supportsType() || empty($this->type)) |
|
| 232 | 232 | { |
| 233 | 233 | return; |
| 234 | 234 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | $vars = $this->getVariables(); |
| 245 | 245 | |
| 246 | - if(!$vars->hasInvalid()) |
|
| 246 | + if (!$vars->hasInvalid()) |
|
| 247 | 247 | { |
| 248 | 248 | return; |
| 249 | 249 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | public function getType() : string |
| 265 | 265 | { |
| 266 | - if($this->supportsType()) |
|
| 266 | + if ($this->supportsType()) |
|
| 267 | 267 | { |
| 268 | 268 | return $this->type; |
| 269 | 269 | } |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | public function getParamsString() : string |
| 291 | 291 | { |
| 292 | - if($this->requiresParameters()) |
|
| 292 | + if ($this->requiresParameters()) |
|
| 293 | 293 | { |
| 294 | 294 | return $this->paramsString; |
| 295 | 295 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | { |
| 48 | 48 | $amount = $this->getVariables()->countVariables(); |
| 49 | 49 | |
| 50 | - if($amount === 1) |
|
| 50 | + if ($amount === 1) |
|
| 51 | 51 | { |
| 52 | 52 | return; |
| 53 | 53 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function getHash() : string |
| 85 | 85 | { |
| 86 | - if(empty($this->hash)) |
|
| 86 | + if (empty($this->hash)) |
|
| 87 | 87 | { |
| 88 | 88 | $this->hash = md5($this->matchedText); |
| 89 | 89 | } |
@@ -107,14 +107,14 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | protected function validate() : void |
| 109 | 109 | { |
| 110 | - if(isset($this->validationResult)) |
|
| 110 | + if (isset($this->validationResult)) |
|
| 111 | 111 | { |
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $this->validationResult = new OperationResult($this); |
| 116 | 116 | |
| 117 | - if(is_numeric(substr($this->path, 0, 1))) |
|
| 117 | + if (is_numeric(substr($this->path, 0, 1))) |
|
| 118 | 118 | { |
| 119 | 119 | $this->validationResult->makeError( |
| 120 | 120 | t( |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | ); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if(is_numeric(substr($this->name, 0, 1))) |
|
| 129 | + if (is_numeric(substr($this->name, 0, 1))) |
|
| 130 | 130 | { |
| 131 | 131 | $this->validationResult->makeError( |
| 132 | 132 | t( |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function add(Mailcode_Variables_Variable $variable) : Mailcode_Variables_Collection |
| 34 | 34 | { |
| 35 | - if(!$variable->isValid()) |
|
| 35 | + if (!$variable->isValid()) |
|
| 36 | 36 | { |
| 37 | 37 | return $this->addInvalid($variable); |
| 38 | 38 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | parent::mergeWith($collection); |
| 77 | 77 | |
| 78 | 78 | // also inherit any invalid variables |
| 79 | - if($collection instanceof Mailcode_Variables_Collection_Regular) |
|
| 79 | + if ($collection instanceof Mailcode_Variables_Collection_Regular) |
|
| 80 | 80 | { |
| 81 | 81 | $invalid = $collection->getInvalid(); |
| 82 | 82 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | { |
| 25 | 25 | public function add(Mailcode_Variables_Variable $variable) : Mailcode_Variables_Collection |
| 26 | 26 | { |
| 27 | - if($variable->isValid()) |
|
| 27 | + if ($variable->isValid()) |
|
| 28 | 28 | { |
| 29 | 29 | return $this; |
| 30 | 30 | } |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | $fullName = $this->fixName($fullName); |
| 68 | 68 | |
| 69 | - foreach($this->variables as $variable) |
|
| 69 | + foreach ($this->variables as $variable) |
|
| 70 | 70 | { |
| 71 | - if($variable->getFullName() === $fullName) |
|
| 71 | + if ($variable->getFullName() === $fullName) |
|
| 72 | 72 | { |
| 73 | 73 | return true; |
| 74 | 74 | } |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $collection = new Mailcode_Variables_Collection_Regular(); |
| 93 | 93 | |
| 94 | - foreach($this->variables as $variable) |
|
| 94 | + foreach ($this->variables as $variable) |
|
| 95 | 95 | { |
| 96 | - if($variable->getFullName() === $fullName) |
|
| 96 | + if ($variable->getFullName() === $fullName) |
|
| 97 | 97 | { |
| 98 | 98 | $collection->add($variable); |
| 99 | 99 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | protected function fixName(string $fullName) : string |
| 112 | 112 | { |
| 113 | - if(substr($fullName, 0, 1) === '$') |
|
| 113 | + if (substr($fullName, 0, 1) === '$') |
|
| 114 | 114 | { |
| 115 | 115 | return $fullName; |
| 116 | 116 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $entries = array(); |
| 140 | 140 | |
| 141 | - foreach($this->variables as $variable) |
|
| 141 | + foreach ($this->variables as $variable) |
|
| 142 | 142 | { |
| 143 | 143 | $entries[$variable->getFullName()] = $variable; |
| 144 | 144 | } |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | $result = array(); |
| 156 | 156 | |
| 157 | - foreach($this->variables as $variable) |
|
| 157 | + foreach ($this->variables as $variable) |
|
| 158 | 158 | { |
| 159 | 159 | $name = $variable->getFullName(); |
| 160 | 160 | |
| 161 | - if(!in_array($name, $result)) |
|
| 161 | + if (!in_array($name, $result)) |
|
| 162 | 162 | { |
| 163 | 163 | $result[] = $name; |
| 164 | 164 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | { |
| 198 | 198 | $variables = $collection->getGroupedByHash(); |
| 199 | 199 | |
| 200 | - foreach($variables as $variable) |
|
| 200 | + foreach ($variables as $variable) |
|
| 201 | 201 | { |
| 202 | 202 | $this->add($variable); |
| 203 | 203 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $hash = $command->getHash(); |
| 42 | 42 | |
| 43 | - if(!isset($this->commands[$hash])) { |
|
| 43 | + if (!isset($this->commands[$hash])) { |
|
| 44 | 44 | $this->commands[$hash] = $command; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | public function addCommands(array $commands) : Mailcode_Collection |
| 108 | 108 | { |
| 109 | - foreach($commands as $command) |
|
| 109 | + foreach ($commands as $command) |
|
| 110 | 110 | { |
| 111 | 111 | $this->addCommand($command); |
| 112 | 112 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | $collection = new Mailcode_Variables_Collection_Regular(); |
| 127 | 127 | |
| 128 | - foreach($this->commands as $command) |
|
| 128 | + foreach ($this->commands as $command) |
|
| 129 | 129 | { |
| 130 | 130 | $collection->mergeWith($command->getVariables()); |
| 131 | 131 | } |
@@ -35,12 +35,12 @@ |
||
| 35 | 35 | $matches = array(); |
| 36 | 36 | preg_match_all(self::REGEX_VARIABLE_NAME, $subject, $matches, PREG_PATTERN_ORDER); |
| 37 | 37 | |
| 38 | - if(!isset($matches[0]) || empty($matches[0])) |
|
| 38 | + if (!isset($matches[0]) || empty($matches[0])) |
|
| 39 | 39 | { |
| 40 | 40 | return $collection; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - foreach($matches[0] as $idx => $matchedText) |
|
| 43 | + foreach ($matches[0] as $idx => $matchedText) |
|
| 44 | 44 | { |
| 45 | 45 | $path = $matches[1][$idx]; |
| 46 | 46 | $name = $matches[2][$idx]; |