@@ -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; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $pattern = '/(?:{%)\s{0,}([A-Z]+)\s{0,}\|.*\s{0,}(?:%})/m'; |
| 73 | 73 | $matches = []; |
| 74 | - $result = (preg_match_all($pattern, $this->tag,$matches, PREG_SET_ORDER) !== false); |
|
| 74 | + $result = (preg_match_all($pattern, $this->tag, $matches, PREG_SET_ORDER) !== false); |
|
| 75 | 75 | |
| 76 | 76 | return ($result ? $matches[0][1] : false); |
| 77 | 77 | } |
@@ -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 | continue; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | //2. Lookup the callback in the hooks dictionary. |
| 238 | 238 | |
| 239 | - if(isset($this->hooks[$action]) === false) { |
|
| 239 | + if (isset($this->hooks[$action]) === false) { |
|
| 240 | 240 | throw new Exception('The callback you requested is not registered in the notification hooks.'); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | public function hash($args) { |
| 280 | 280 | $buffer = ''; |
| 281 | - for($x = 0; $x < count($args); $x++ ) { |
|
| 282 | - $buffer = md5($buffer.$args[$x]); |
|
| 281 | + for ($x = 0; $x < count($args); $x++) { |
|
| 282 | + $buffer = md5($buffer . $args[$x]); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | return $buffer; |
@@ -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 | } |