@@ -101,7 +101,7 @@ |
||
| 101 | 101 | { |
| 102 | 102 | $replaces = array(); |
| 103 | 103 | |
| 104 | - foreach(self::$charsEncoded as $char => $placeholder) |
|
| 104 | + foreach (self::$charsEncoded as $char => $placeholder) |
|
| 105 | 105 | { |
| 106 | 106 | $escaped = self::$charsEscaped[$char]; |
| 107 | 107 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | public function getVariable() : Mailcode_Variables_Variable |
| 30 | 30 | { |
| 31 | - if($this->subject instanceof Mailcode_Variables_Variable) |
|
| 31 | + if ($this->subject instanceof Mailcode_Variables_Variable) |
|
| 32 | 32 | { |
| 33 | 33 | return $this->subject; |
| 34 | 34 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $token = $this->info->getTokenByIndex($index); |
| 45 | 45 | |
| 46 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 46 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 47 | 47 | { |
| 48 | 48 | return $token; |
| 49 | 49 | } |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $tokens = $this->getAll(); |
| 64 | 64 | |
| 65 | - foreach($tokens as $token) |
|
| 65 | + foreach ($tokens as $token) |
|
| 66 | 66 | { |
| 67 | - if($token->getKeyword() === $name) |
|
| 67 | + if ($token->getKeyword() === $name) |
|
| 68 | 68 | { |
| 69 | 69 | return $token; |
| 70 | 70 | } |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | $result = array(); |
| 82 | 82 | $tokens = $this->info->getTokens(); |
| 83 | 83 | |
| 84 | - foreach($tokens as $token) |
|
| 84 | + foreach ($tokens as $token) |
|
| 85 | 85 | { |
| 86 | - if($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 86 | + if ($token instanceof Mailcode_Parser_Statement_Tokenizer_Token_Keyword) |
|
| 87 | 87 | { |
| 88 | 88 | $result[] = $token; |
| 89 | 89 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function setEnabled(string $keyword, bool $enabled) : Mailcode_Parser_Statement_Info_Keywords |
| 104 | 104 | { |
| 105 | - if($enabled) |
|
| 105 | + if ($enabled) |
|
| 106 | 106 | { |
| 107 | 107 | return $this->add($keyword); |
| 108 | 108 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | $keyword = rtrim($keyword, ':').':'; |
| 123 | 123 | |
| 124 | - if(!$this->hasKeyword($keyword)) |
|
| 124 | + if (!$this->hasKeyword($keyword)) |
|
| 125 | 125 | { |
| 126 | 126 | $this->tokenizer->appendKeyword($keyword); |
| 127 | 127 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | foreach ($keywords as $kw) |
| 168 | 168 | { |
| 169 | - if($kw->getKeyword() === $keyword) |
|
| 169 | + if ($kw->getKeyword() === $keyword) |
|
| 170 | 170 | { |
| 171 | 171 | return true; |
| 172 | 172 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | private function stripStyleTags() : void |
| 81 | 81 | { |
| 82 | - if(!ConvertHelper::isStringHTML($this->subject)) |
|
| 82 | + if (!ConvertHelper::isStringHTML($this->subject)) |
|
| 83 | 83 | { |
| 84 | 84 | return; |
| 85 | 85 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | private function escapeRegexBracketMatch(string $subject, string $needle) : string |
| 95 | 95 | { |
| 96 | - $replacement = str_replace( |
|
| 96 | + $replacement = str_replace( |
|
| 97 | 97 | array('{', '}'), |
| 98 | 98 | array('\{', '\}'), |
| 99 | 99 | $needle |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | $this->instantiator->checkCommand($cmd); |
| 38 | 38 | |
| 39 | - if($cmd instanceof Mailcode_Commands_Command_ShowSnippet) |
|
| 39 | + if ($cmd instanceof Mailcode_Commands_Command_ShowSnippet) |
|
| 40 | 40 | { |
| 41 | 41 | return $cmd; |
| 42 | 42 | } |
@@ -33,21 +33,21 @@ discard block |
||
| 33 | 33 | * @return Mailcode_Commands_Command_ShowURL |
| 34 | 34 | * @throws Mailcode_Factory_Exception |
| 35 | 35 | */ |
| 36 | - public function create(string $url, ?string $trackingID=null, array $queryParams=array()) : Mailcode_Commands_Command_ShowURL |
|
| 36 | + public function create(string $url, ?string $trackingID = null, array $queryParams = array()) : Mailcode_Commands_Command_ShowURL |
|
| 37 | 37 | { |
| 38 | 38 | $contentID = PreParser::storeContent($url); |
| 39 | 39 | |
| 40 | 40 | $params = array(); |
| 41 | 41 | $params[] = (string)$contentID; |
| 42 | 42 | |
| 43 | - if($trackingID !== null) |
|
| 43 | + if ($trackingID !== null) |
|
| 44 | 44 | { |
| 45 | 45 | $params[] = sprintf('"%s"', $trackingID); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - if(!empty($queryParams)) |
|
| 48 | + if (!empty($queryParams)) |
|
| 49 | 49 | { |
| 50 | - foreach($queryParams as $name => $value) |
|
| 50 | + foreach ($queryParams as $name => $value) |
|
| 51 | 51 | { |
| 52 | 52 | $params[] = sprintf( |
| 53 | 53 | '"%s=%s"', |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $this->instantiator->checkCommand($cmd); |
| 70 | 70 | |
| 71 | - if($cmd instanceof Mailcode_Commands_Command_ShowURL) |
|
| 71 | + if ($cmd instanceof Mailcode_Commands_Command_ShowURL) |
|
| 72 | 72 | { |
| 73 | 73 | return $cmd; |
| 74 | 74 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @return Mailcode_Commands_Command_ShowPhone |
| 36 | 36 | * @throws Mailcode_Factory_Exception |
| 37 | 37 | */ |
| 38 | - public function create(string $variableName, string $sourceFormat, string $urlEncoding=Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone |
|
| 38 | + public function create(string $variableName, string $sourceFormat, string $urlEncoding = Mailcode_Factory::URL_ENCODING_NONE) : Mailcode_Commands_Command_ShowPhone |
|
| 39 | 39 | { |
| 40 | 40 | $variableName = $this->instantiator->filterVariableName($variableName); |
| 41 | 41 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->instantiator->checkCommand($cmd); |
| 59 | 59 | $this->instantiator->setEncoding($cmd, $urlEncoding); |
| 60 | 60 | |
| 61 | - if($cmd instanceof Mailcode_Commands_Command_ShowPhone) |
|
| 61 | + if ($cmd instanceof Mailcode_Commands_Command_ShowPhone) |
|
| 62 | 62 | { |
| 63 | 63 | return $cmd; |
| 64 | 64 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class Number extends Mailcode_Factory_CommandSets_Set |
| 25 | 25 | { |
| 26 | - public function create(string $variableName, string $formatString="", bool $absolute=false) : Mailcode_Commands_Command_ShowNumber |
|
| 26 | + public function create(string $variableName, string $formatString = "", bool $absolute = false) : Mailcode_Commands_Command_ShowNumber |
|
| 27 | 27 | { |
| 28 | 28 | $variableName = $this->instantiator->filterVariableName($variableName); |
| 29 | 29 | $paramsString = $this->compileNumberParams($formatString, $absolute); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $this->instantiator->checkCommand($cmd); |
| 43 | 43 | |
| 44 | - if($cmd instanceof Mailcode_Commands_Command_ShowNumber) |
|
| 44 | + if ($cmd instanceof Mailcode_Commands_Command_ShowNumber) |
|
| 45 | 45 | { |
| 46 | 46 | return $cmd; |
| 47 | 47 | } |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | throw $this->instantiator->exceptionUnexpectedType('ShowNumber', $cmd); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - private function compileNumberParams(string $formatString="", bool $absolute=false) : string |
|
| 52 | + private function compileNumberParams(string $formatString = "", bool $absolute = false) : string |
|
| 53 | 53 | { |
| 54 | 54 | $params = array(); |
| 55 | 55 | |
| 56 | - if(!empty($formatString)) |
|
| 56 | + if (!empty($formatString)) |
|
| 57 | 57 | { |
| 58 | 58 | $params[] = sprintf( |
| 59 | 59 | ' "%s"', |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | ); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if($absolute) |
|
| 64 | + if ($absolute) |
|
| 65 | 65 | { |
| 66 | 66 | $params[] = ' absolute:'; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if(!empty($params)) |
|
| 69 | + if (!empty($params)) |
|
| 70 | 70 | { |
| 71 | 71 | return ' '.implode(' ', $params); |
| 72 | 72 | } |
@@ -62,23 +62,23 @@ |
||
| 62 | 62 | |
| 63 | 63 | public function getNestedMailcode() : Mailcode_Collection |
| 64 | 64 | { |
| 65 | - if(isset($this->nestedMailcode)) |
|
| 66 | - { |
|
| 67 | - return $this->nestedMailcode; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - if($this->isMailcodeEnabled()) |
|
| 71 | - { |
|
| 72 | - $collection = Mailcode::create()->parseString($this->getContent()); |
|
| 73 | - } |
|
| 74 | - else |
|
| 75 | - { |
|
| 76 | - $collection = new Mailcode_Collection(); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - $this->nestedMailcode = $collection; |
|
| 80 | - |
|
| 81 | - return $collection; |
|
| 65 | + if(isset($this->nestedMailcode)) |
|
| 66 | + { |
|
| 67 | + return $this->nestedMailcode; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + if($this->isMailcodeEnabled()) |
|
| 71 | + { |
|
| 72 | + $collection = Mailcode::create()->parseString($this->getContent()); |
|
| 73 | + } |
|
| 74 | + else |
|
| 75 | + { |
|
| 76 | + $collection = new Mailcode_Collection(); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + $this->nestedMailcode = $collection; |
|
| 80 | + |
|
| 81 | + return $collection; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | protected function validateSyntax_nested_mailcode() : void |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | ->getInfo() |
| 48 | 48 | ->getTokenByIndex(0); |
| 49 | 49 | |
| 50 | - if($contentIDToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number) |
|
| 50 | + if ($contentIDToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Number) |
|
| 51 | 51 | { |
| 52 | 52 | $this->contentIDToken = $contentIDToken; |
| 53 | 53 | $this->loadContent(); |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function getNestedMailcode() : Mailcode_Collection |
| 64 | 64 | { |
| 65 | - if(isset($this->nestedMailcode)) |
|
| 65 | + if (isset($this->nestedMailcode)) |
|
| 66 | 66 | { |
| 67 | 67 | return $this->nestedMailcode; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if($this->isMailcodeEnabled()) |
|
| 70 | + if ($this->isMailcodeEnabled()) |
|
| 71 | 71 | { |
| 72 | 72 | $collection = Mailcode::create()->parseString($this->getContent()); |
| 73 | 73 | } |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $collection = $this->getNestedMailcode(); |
| 87 | 87 | |
| 88 | - if($collection->isValid()) |
|
| 88 | + if ($collection->isValid()) |
|
| 89 | 89 | { |
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $errors = $collection->getErrors(); |
| 94 | 94 | |
| 95 | - foreach($errors as $error) |
|
| 95 | + foreach ($errors as $error) |
|
| 96 | 96 | { |
| 97 | 97 | $this->getValidationResult()->makeError( |
| 98 | 98 | $error->getMessage(), |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | public function getContentID() : int |
| 105 | 105 | { |
| 106 | - if(isset($this->contentIDToken)) |
|
| 106 | + if (isset($this->contentIDToken)) |
|
| 107 | 107 | { |
| 108 | 108 | return (int)$this->contentIDToken->getValue(); |
| 109 | 109 | } |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $variables = parent::getVariables(); |
| 135 | 135 | |
| 136 | - if($this->isMailcodeEnabled()) |
|
| 136 | + if ($this->isMailcodeEnabled()) |
|
| 137 | 137 | { |
| 138 | 138 | $nested = $this->getNestedMailcode() |
| 139 | 139 | ->getVariables() |
| 140 | 140 | ->getAll(); |
| 141 | 141 | |
| 142 | - foreach($nested as $variable) |
|
| 142 | + foreach ($nested as $variable) |
|
| 143 | 143 | { |
| 144 | 144 | $variables->add($variable); |
| 145 | 145 | } |
@@ -70,8 +70,7 @@ |
||
| 70 | 70 | if($this->isMailcodeEnabled()) |
| 71 | 71 | { |
| 72 | 72 | $collection = Mailcode::create()->parseString($this->getContent()); |
| 73 | - } |
|
| 74 | - else |
|
| 73 | + } else |
|
| 75 | 74 | { |
| 76 | 75 | $collection = new Mailcode_Collection(); |
| 77 | 76 | } |