@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | public function setTemplate(string $template) : Mailcode_Parser_Safeguard_Formatter_Type_MarkVariables |
| 62 | 62 | { |
| 63 | - if(substr_count($template, '%s') !== 1) |
|
| 63 | + if (substr_count($template, '%s') !== 1) |
|
| 64 | 64 | { |
| 65 | 65 | throw new Mailcode_Exception( |
| 66 | 66 | 'Invalid tag template', |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $parts = explode('%s', $this->getTemplate()); |
| 102 | 102 | $tag = array_shift($parts); |
| 103 | 103 | |
| 104 | - if($this->templateMode === self::TEMPLATE_MODE_INLINE) |
|
| 104 | + if ($this->templateMode === self::TEMPLATE_MODE_INLINE) |
|
| 105 | 105 | { |
| 106 | 106 | $tag = str_replace('__STYLES__', $this->getInlineStyles(), $tag); |
| 107 | 107 | } |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | $styles = ''; |
| 130 | 130 | $regex = '/\.'.self::DEFAULT_CLASS_NAME.'{([^}]+)}/'; |
| 131 | 131 | |
| 132 | - if(preg_match($regex, $this->getCSS(), $matches)) |
|
| 132 | + if (preg_match($regex, $this->getCSS(), $matches)) |
|
| 133 | 133 | { |
| 134 | 134 | $styles = $matches[1]; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if(empty($styles)) |
|
| 137 | + if (empty($styles)) |
|
| 138 | 138 | { |
| 139 | 139 | throw new Mailcode_Exception( |
| 140 | 140 | 'Cannot extract styles.', |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $file = MAILCODE_INSTALL_FOLDER.'/css/marked-variables.css'; |
| 192 | 192 | $path = realpath($file); |
| 193 | 193 | |
| 194 | - if($path !== false) |
|
| 194 | + if ($path !== false) |
|
| 195 | 195 | { |
| 196 | 196 | return $path; |
| 197 | 197 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $total = count($matches[0]); |
| 80 | 80 | |
| 81 | - for($i=0; $i < $total; $i++) |
|
| 81 | + for ($i = 0; $i < $total; $i++) |
|
| 82 | 82 | { |
| 83 | 83 | $match = $this->parseMatch($matches, $i); |
| 84 | 84 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | protected function prepareString(string $subject) : string |
| 92 | 92 | { |
| 93 | - if(!ConvertHelper::isStringHTML($subject)) |
|
| 93 | + if (!ConvertHelper::isStringHTML($subject)) |
|
| 94 | 94 | { |
| 95 | 95 | return $subject; |
| 96 | 96 | } |
@@ -140,17 +140,17 @@ discard block |
||
| 140 | 140 | private function handleNesting(Mailcode_Commands_Command $cmd) : void |
| 141 | 141 | { |
| 142 | 142 | // Set the command's parent from the stack, if any is present. |
| 143 | - if(!empty($this->stack)) |
|
| 143 | + if (!empty($this->stack)) |
|
| 144 | 144 | { |
| 145 | 145 | $cmd->setParent($this->stack[array_key_last($this->stack)]); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // Handle opening and closing commands, adding and removing from the stack. |
| 149 | - if($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
| 149 | + if ($cmd instanceof Mailcode_Commands_Command_Type_Opening) |
|
| 150 | 150 | { |
| 151 | 151 | $this->stack[] = $cmd; |
| 152 | 152 | } |
| 153 | - else if($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
| 153 | + else if ($cmd instanceof Mailcode_Commands_Command_Type_Closing) |
|
| 154 | 154 | { |
| 155 | 155 | array_pop($this->stack); |
| 156 | 156 | } |
@@ -177,16 +177,16 @@ discard block |
||
| 177 | 177 | // 5 = parameter type command, type |
| 178 | 178 | // 6 = parameter type command, params |
| 179 | 179 | |
| 180 | - if(!empty($matches[1][$index])) |
|
| 180 | + if (!empty($matches[1][$index])) |
|
| 181 | 181 | { |
| 182 | 182 | $name = $matches[1][$index]; |
| 183 | 183 | } |
| 184 | - else if(!empty($matches[2][$index])) |
|
| 184 | + else if (!empty($matches[2][$index])) |
|
| 185 | 185 | { |
| 186 | 186 | $name = $matches[2][$index]; |
| 187 | 187 | $params = $matches[3][$index]; |
| 188 | 188 | } |
| 189 | - else if(!empty($matches[4][$index])) |
|
| 189 | + else if (!empty($matches[4][$index])) |
|
| 190 | 190 | { |
| 191 | 191 | $name = $matches[4][$index]; |
| 192 | 192 | $type = $matches[5][$index]; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | // IF type. |
| 40 | 40 | $method = 'translate'.$this->getIfType($command); |
| 41 | 41 | |
| 42 | - if(method_exists($this, $method)) |
|
| 42 | + if (method_exists($this, $method)) |
|
| 43 | 43 | { |
| 44 | 44 | return strval($this->$method($command)); |
| 45 | 45 | } |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | $keywords = $command->getLogicKeywords()->getKeywords(); |
| 55 | 55 | |
| 56 | - foreach($keywords as $keyword) |
|
| 56 | + foreach ($keywords as $keyword) |
|
| 57 | 57 | { |
| 58 | 58 | $keyCommand = $keyword->getCommand(); |
| 59 | 59 | |
| 60 | - if($keyCommand instanceof Mailcode_Commands_IfBase) |
|
| 60 | + if ($keyCommand instanceof Mailcode_Commands_IfBase) |
|
| 61 | 61 | { |
| 62 | 62 | $body .= ' '.$this->getSign($keyword).' '.$this->translateBody($keyCommand); |
| 63 | 63 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | protected function getSign(Mailcode_Commands_LogicKeywords_Keyword $keyword) : string |
| 82 | 82 | { |
| 83 | - switch($keyword->getName()) |
|
| 83 | + switch ($keyword->getName()) |
|
| 84 | 84 | { |
| 85 | 85 | case 'and': |
| 86 | 86 | return '&&'; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $sign = ''; |
| 105 | 105 | |
| 106 | - if($notEmpty) |
|
| 106 | + if ($notEmpty) |
|
| 107 | 107 | { |
| 108 | 108 | $sign = '!'; |
| 109 | 109 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $params = $command->getParams(); |
| 121 | 121 | |
| 122 | - if(!$params) |
|
| 122 | + if (!$params) |
|
| 123 | 123 | { |
| 124 | 124 | return ''; |
| 125 | 125 | } |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | $varName = $variable->getFullName(); |
| 151 | 151 | |
| 152 | 152 | $opts = 's'; |
| 153 | - if($caseSensitive) |
|
| 153 | + if ($caseSensitive) |
|
| 154 | 154 | { |
| 155 | 155 | $opts = 'is'; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - foreach($searchTerms as $token) |
|
| 158 | + foreach ($searchTerms as $token) |
|
| 159 | 159 | { |
| 160 | 160 | $parts[] = sprintf( |
| 161 | 161 | '%s.matches("(?%s)%s")', |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | protected function _translateSearch(string $mode, Mailcode_Variables_Variable $variable, bool $caseSensitive, string $searchTerm) : string |
| 172 | 172 | { |
| 173 | 173 | $method = $mode.'With'; |
| 174 | - if($caseSensitive) |
|
| 174 | + if ($caseSensitive) |
|
| 175 | 175 | { |
| 176 | 176 | $method = $mode.'WithIgnoreCase'; |
| 177 | 177 | } |
@@ -24,15 +24,15 @@ |
||
| 24 | 24 | { |
| 25 | 25 | const ERROR_UNKNOWN_DATE_FORMAT_CHARACTER = 55501; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * The date format used in the date variable. This is used to convert |
|
| 29 | - * the native date to the format specified in the variable command. |
|
| 30 | - */ |
|
| 27 | + /** |
|
| 28 | + * The date format used in the date variable. This is used to convert |
|
| 29 | + * the native date to the format specified in the variable command. |
|
| 30 | + */ |
|
| 31 | 31 | const DEFAULT_INTERNAL_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"; |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var string[]string |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var string[]string |
|
| 35 | + */ |
|
| 36 | 36 | private $charTable = array( |
| 37 | 37 | 'd' => 'dd', |
| 38 | 38 | 'j' => 'd', |