@@ -11,7 +11,7 @@ |
||
| 11 | 11 | * @param string $class The fully-qualified class name. |
| 12 | 12 | * @return void |
| 13 | 13 | */ |
| 14 | -spl_autoload_register(function ($class) { |
|
| 14 | +spl_autoload_register(function($class) { |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | // project-specific namespace prefix |
@@ -20,15 +20,15 @@ |
||
| 20 | 20 | |
| 21 | 21 | $matches = []; |
| 22 | 22 | |
| 23 | - if(preg_match($templatePattern, $tag) === 1 ) { |
|
| 23 | + if (preg_match($templatePattern, $tag) === 1) { |
|
| 24 | 24 | return new TemplateTag($templatePattern, $tag); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if(preg_match($templateHookPattern, $tag) === 1 ) { |
|
| 27 | + if (preg_match($templateHookPattern, $tag) === 1) { |
|
| 28 | 28 | return new TemplateHook($templateHookPattern, $tag); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if(preg_match($templateHookWithArgsPattern, $tag) === 1 ) { |
|
| 31 | + if (preg_match($templateHookWithArgsPattern, $tag) === 1) { |
|
| 32 | 32 | return new TemplateHookWithArgs($templateHookWithArgsPattern, $tag); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function getLabel() |
| 17 | 17 | { |
| 18 | 18 | $matches = []; |
| 19 | - preg_match_all($this->pattern, $this->tag,$matches, PREG_SET_ORDER); |
|
| 19 | + preg_match_all($this->pattern, $this->tag, $matches, PREG_SET_ORDER); |
|
| 20 | 20 | return $matches[0][1]; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function fart($dictionary) { |
| 33 | 33 | $label = $this->getLabel(); |
| 34 | - foreach($dictionary as $find => $replace) { |
|
| 35 | - if(strcmp($find,$label) === 0) { |
|
| 34 | + foreach ($dictionary as $find => $replace) { |
|
| 35 | + if (strcmp($find, $label) === 0) { |
|
| 36 | 36 | $this->replacement = $replace; |
| 37 | 37 | return true; |
| 38 | 38 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | private function trimArg($arg) { |
| 25 | 25 | |
| 26 | - $arg = str_replace("|",'',$arg); |
|
| 26 | + $arg = str_replace("|", '', $arg); |
|
| 27 | 27 | $arg = trim($arg); |
| 28 | 28 | return $arg; |
| 29 | 29 | } |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | preg_match_all($argsPattern, $this->tag, $matches, PREG_PATTERN_ORDER); |
| 36 | 36 | |
| 37 | 37 | //Clean up the args. |
| 38 | - $this->args = array_map([$this,'trimArg'], $matches[0]); |
|
| 38 | + $this->args = array_map([$this, 'trimArg'], $matches[0]); |
|
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function getLabel() |
| 43 | 43 | { |
| 44 | 44 | $matches = []; |
| 45 | - $result = (preg_match_all($this->pattern, $this->tag,$matches, PREG_SET_ORDER) !== false); |
|
| 45 | + $result = (preg_match_all($this->pattern, $this->tag, $matches, PREG_SET_ORDER) !== false); |
|
| 46 | 46 | |
| 47 | 47 | return ($result ? $matches[0][1] : false); |
| 48 | 48 | } |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | public function fart($dictionary) { |
| 51 | 51 | $TagFactory = new TagFactory(); |
| 52 | 52 | |
| 53 | - for($x = 0; $x < count($this->args); $x++) { |
|
| 53 | + for ($x = 0; $x < count($this->args); $x++) { |
|
| 54 | 54 | $Tag = $TagFactory->getTag($this->args[$x]); |
| 55 | 55 | |
| 56 | 56 | //If this argument is NOT a tag like {{FIRSTNAME}} |
| 57 | - if($Tag === false) { |
|
| 58 | - foreach($dictionary as $find => $replace) { |
|
| 57 | + if ($Tag === false) { |
|
| 58 | + foreach ($dictionary as $find => $replace) { |
|
| 59 | 59 | $this->args[$x] = str_replace($find, $replace, $this->args[$x]); |
| 60 | 60 | } |
| 61 | 61 | continue; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function getLabel() |
| 16 | 16 | { |
| 17 | 17 | $matches = []; |
| 18 | - $result = (preg_match_all($this->pattern, $this->tag,$matches, PREG_SET_ORDER) !== false); |
|
| 18 | + $result = (preg_match_all($this->pattern, $this->tag, $matches, PREG_SET_ORDER) !== false); |
|
| 19 | 19 | |
| 20 | 20 | return ($result ? $matches[0][1] : false); |
| 21 | 21 | } |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function fart($dictionary) { |
| 28 | 28 | $label = $this->getLabel(); |
| 29 | - foreach($dictionary as $find => $replace) { |
|
| 30 | - if(strcmp($find,$label) === 0) { |
|
| 29 | + foreach ($dictionary as $find => $replace) { |
|
| 30 | + if (strcmp($find, $label) === 0) { |
|
| 31 | 31 | $this->replacement = $replace; |
| 32 | 32 | return true; |
| 33 | 33 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | if (file_exists($this->templateDirectory) === false) { |
| 77 | 77 | throw new Exception("Template directory not set!"); |
| 78 | 78 | } |
| 79 | - if (file_exists($targetTemplate) === false) { |
|
| 79 | + if (file_exists($targetTemplate) === false) { |
|
| 80 | 80 | throw new Exception("Requested template does not exist in $targetTemplate"); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $TagFactory = new TagFactory(); |
| 154 | 154 | $buffer = []; |
| 155 | 155 | |
| 156 | - foreach($matches[0] as $match) { |
|
| 156 | + foreach ($matches[0] as $match) { |
|
| 157 | 157 | $tag = $TagFactory->getTag($match); |
| 158 | 158 | $buffer[] = $tag; |
| 159 | 159 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | $tag->fart($this->fartDictionary); |
| 196 | 196 | |
| 197 | - if(strpos($body, $tag->getTag()) === false) { |
|
| 197 | + if (strpos($body, $tag->getTag()) === false) { |
|
| 198 | 198 | // @codeCoverageIgnoreStart |
| 199 | 199 | continue; |
| 200 | 200 | // @codeCoverageIgnoreEnd |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $TagFactory = new TagFactory(); |
| 235 | 235 | $tags = []; |
| 236 | 236 | |
| 237 | - foreach($hooks as $hook) { |
|
| 237 | + foreach ($hooks as $hook) { |
|
| 238 | 238 | $Tag = $TagFactory->getTag($hook); |
| 239 | 239 | $Tag->setReplacement($this->renderHook($hook)); |
| 240 | 240 | $body = str_replace($hook, $Tag->getReplacement(), $body); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | //2. Lookup the callback in the hooks dictionary. |
| 272 | 272 | |
| 273 | - if(isset($this->hooks[$action]) === false) { |
|
| 273 | + if (isset($this->hooks[$action]) === false) { |
|
| 274 | 274 | throw new Exception('The callback you requested is not registered in the notification hooks.'); |
| 275 | 275 | } |
| 276 | 276 | |
@@ -312,8 +312,8 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | public function hash($args) { |
| 314 | 314 | $buffer = ''; |
| 315 | - for($x = 0; $x < count($args); $x++ ) { |
|
| 316 | - $buffer = md5($buffer.$args[$x]); |
|
| 315 | + for ($x = 0; $x < count($args); $x++) { |
|
| 316 | + $buffer = md5($buffer . $args[$x]); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | return $buffer; |