@@ -22,19 +22,19 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class Mailcode_Parser_Statement_Info_Pruner |
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * @var Mailcode_Parser_Statement_Info |
|
| 27 | - */ |
|
| 25 | + /** |
|
| 26 | + * @var Mailcode_Parser_Statement_Info |
|
| 27 | + */ |
|
| 28 | 28 | private $info; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var string[] |
|
| 32 | - */ |
|
| 30 | + /** |
|
| 31 | + * @var string[] |
|
| 32 | + */ |
|
| 33 | 33 | private $exclude = array(); |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var string[] |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var string[] |
|
| 37 | + */ |
|
| 38 | 38 | private $classNames = array(); |
| 39 | 39 | |
| 40 | 40 | public function __construct(Mailcode_Parser_Statement_Info $info) |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | return $this; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Retrieves all tokens in the statement matching the |
|
| 79 | - * current criteria. |
|
| 80 | - * |
|
| 81 | - * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 82 | - */ |
|
| 77 | + /** |
|
| 78 | + * Retrieves all tokens in the statement matching the |
|
| 79 | + * current criteria. |
|
| 80 | + * |
|
| 81 | + * @return Mailcode_Parser_Statement_Tokenizer_Token[] |
|
| 82 | + */ |
|
| 83 | 83 | public function getTokens() : array |
| 84 | 84 | { |
| 85 | 85 | $tokens = $this->info->getTokens(); |
@@ -20,26 +20,26 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | abstract class Mailcode_Parser_Statement_Tokenizer_Token implements Mailcode_Parser_Statement_Tokenizer_TypeInterface |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | 26 | protected $tokenID; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var string |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var string |
|
| 30 | + */ |
|
| 31 | 31 | protected $matchedText; |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var mixed |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var mixed |
|
| 35 | + */ |
|
| 36 | 36 | protected $subject; |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param string $tokenID |
|
| 40 | - * @param string $matchedText |
|
| 41 | - * @param mixed $subject |
|
| 42 | - */ |
|
| 38 | + /** |
|
| 39 | + * @param string $tokenID |
|
| 40 | + * @param string $matchedText |
|
| 41 | + * @param mixed $subject |
|
| 42 | + */ |
|
| 43 | 43 | public function __construct(string $tokenID, string $matchedText, $subject=null) |
| 44 | 44 | { |
| 45 | 45 | $this->tokenID = $tokenID; |
@@ -47,20 +47,20 @@ discard block |
||
| 47 | 47 | $this->subject = $subject; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * The ID of the type. i.e. the class name ("Keyword", "StringLiteral"). |
|
| 52 | - * @return string |
|
| 53 | - */ |
|
| 50 | + /** |
|
| 51 | + * The ID of the type. i.e. the class name ("Keyword", "StringLiteral"). |
|
| 52 | + * @return string |
|
| 53 | + */ |
|
| 54 | 54 | public function getTypeID() : string |
| 55 | 55 | { |
| 56 | 56 | $parts = explode('_', get_class($this)); |
| 57 | 57 | return array_pop($parts); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Retrieves a unique ID of the token. |
|
| 62 | - * @return string |
|
| 63 | - */ |
|
| 60 | + /** |
|
| 61 | + * Retrieves a unique ID of the token. |
|
| 62 | + * @return string |
|
| 63 | + */ |
|
| 64 | 64 | public function getID() : string |
| 65 | 65 | { |
| 66 | 66 | return $this->tokenID; |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | use Mailcode_Traits_Commands_Validation_Variable; |
| 29 | 29 | use Mailcode_Traits_Commands_Validation_CaseSensitive; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
| 33 | + */ |
|
| 34 | 34 | protected $searchTerms = array(); |
| 35 | 35 | |
| 36 | 36 | protected function getValidations() : array |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Retrieves all search terms. |
|
| 71 | - * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
| 72 | - */ |
|
| 69 | + /** |
|
| 70 | + * Retrieves all search terms. |
|
| 71 | + * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[] |
|
| 72 | + */ |
|
| 73 | 73 | public function getSearchTerms() : array |
| 74 | 74 | { |
| 75 | 75 | return $this->searchTerms; |
@@ -24,14 +24,14 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | trait Mailcode_Traits_Commands_Validation_CaseSensitive |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var boolean |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var boolean |
|
| 29 | + */ |
|
| 30 | 30 | protected $caseInsensitive = false; |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 34 | + */ |
|
| 35 | 35 | protected $caseToken; |
| 36 | 36 | |
| 37 | 37 | protected function validateSyntax_case_sensitive() : void |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | const ERROR_INVALID_COMMAND_CREATED = 50001; |
| 24 | 24 | const ERROR_UNEXPECTED_COMMAND_TYPE = 50002; |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var Mailcode_Factory_CommandSets |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var Mailcode_Factory_CommandSets |
|
| 28 | + */ |
|
| 29 | 29 | private static $commandSets; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Creates a ShowVariable command. |
|
| 33 | - * |
|
| 34 | - * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 35 | - * @return Mailcode_Commands_Command_ShowVariable |
|
| 36 | - */ |
|
| 31 | + /** |
|
| 32 | + * Creates a ShowVariable command. |
|
| 33 | + * |
|
| 34 | + * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 35 | + * @return Mailcode_Commands_Command_ShowVariable |
|
| 36 | + */ |
|
| 37 | 37 | public static function showVar(string $variableName) : Mailcode_Commands_Command_ShowVariable |
| 38 | 38 | { |
| 39 | 39 | return self::$commandSets->show()->showVar($variableName); |
@@ -52,41 +52,41 @@ discard block |
||
| 52 | 52 | return self::$commandSets->show()->showDate($variableName, $formatString); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Creates a ShowSnippet command. |
|
| 57 | - * |
|
| 58 | - * @param string $snippetName A snippet name, with or without the $ sign prepended. |
|
| 59 | - * @return Mailcode_Commands_Command_ShowSnippet |
|
| 60 | - */ |
|
| 55 | + /** |
|
| 56 | + * Creates a ShowSnippet command. |
|
| 57 | + * |
|
| 58 | + * @param string $snippetName A snippet name, with or without the $ sign prepended. |
|
| 59 | + * @return Mailcode_Commands_Command_ShowSnippet |
|
| 60 | + */ |
|
| 61 | 61 | public static function showSnippet(string $snippetName) : Mailcode_Commands_Command_ShowSnippet |
| 62 | 62 | { |
| 63 | 63 | return self::$commandSets->show()->showSnippet($snippetName); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Creates a SetVariable command. |
|
| 68 | - * |
|
| 69 | - * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 70 | - * @param string $value |
|
| 71 | - * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
| 72 | - * @return Mailcode_Commands_Command_SetVariable |
|
| 73 | - * @throws Mailcode_Factory_Exception |
|
| 74 | - * |
|
| 75 | - * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
| 76 | - */ |
|
| 66 | + /** |
|
| 67 | + * Creates a SetVariable command. |
|
| 68 | + * |
|
| 69 | + * @param string $variableName A variable name, with or without the $ sign prepended. |
|
| 70 | + * @param string $value |
|
| 71 | + * @param bool $quoteValue Whether to treat the value as a string literal, and add quotes to it. |
|
| 72 | + * @return Mailcode_Commands_Command_SetVariable |
|
| 73 | + * @throws Mailcode_Factory_Exception |
|
| 74 | + * |
|
| 75 | + * @see Mailcode_Factory::ERROR_INVALID_COMMAND_CREATED |
|
| 76 | + */ |
|
| 77 | 77 | public static function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
| 78 | 78 | { |
| 79 | 79 | return self::$commandSets->set()->setVar($variableName, $value, $quoteValue); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Like setVar(), but treats the value as a string literal |
|
| 84 | - * and automatically adds quotes to it. |
|
| 85 | - * |
|
| 86 | - * @param string $variableName |
|
| 87 | - * @param string $value |
|
| 88 | - * @return Mailcode_Commands_Command_SetVariable |
|
| 89 | - */ |
|
| 82 | + /** |
|
| 83 | + * Like setVar(), but treats the value as a string literal |
|
| 84 | + * and automatically adds quotes to it. |
|
| 85 | + * |
|
| 86 | + * @param string $variableName |
|
| 87 | + * @param string $value |
|
| 88 | + * @return Mailcode_Commands_Command_SetVariable |
|
| 89 | + */ |
|
| 90 | 90 | public static function setVarString(string $variableName, string $value) : Mailcode_Commands_Command_SetVariable |
| 91 | 91 | { |
| 92 | 92 | return self::$commandSets->set()->setVar($variableName, $value, true); |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | return self::$commandSets->if()->ifContains($variable, array($search), $caseInsensitive); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * Creates if contains command, with several search terms. |
|
| 217 | - * |
|
| 218 | - * @param string $variable |
|
| 219 | - * @param string[] $searchTerms List of search terms. Do not add surrounding quotes. |
|
| 220 | - * @param bool $caseInsensitive |
|
| 221 | - * @return Mailcode_Commands_Command_If_Contains |
|
| 222 | - */ |
|
| 215 | + /** |
|
| 216 | + * Creates if contains command, with several search terms. |
|
| 217 | + * |
|
| 218 | + * @param string $variable |
|
| 219 | + * @param string[] $searchTerms List of search terms. Do not add surrounding quotes. |
|
| 220 | + * @param bool $caseInsensitive |
|
| 221 | + * @return Mailcode_Commands_Command_If_Contains |
|
| 222 | + */ |
|
| 223 | 223 | public static function ifContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
| 224 | 224 | { |
| 225 | 225 | return self::$commandSets->if()->ifContains($variable, $searchTerms, $caseInsensitive); |
@@ -230,14 +230,14 @@ discard block |
||
| 230 | 230 | return self::$commandSets->elseIf()->elseIfContains($variable, array($search), $caseInsensitive); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - /** |
|
| 234 | - * Creates else if contains command, with several search terms. |
|
| 235 | - * |
|
| 236 | - * @param string $variable |
|
| 237 | - * @param string[] $searchTerms List of search terms. Do not add surrounding quotes. |
|
| 238 | - * @param bool $caseInsensitive |
|
| 239 | - * @return Mailcode_Commands_Command_ElseIf_Contains |
|
| 240 | - */ |
|
| 233 | + /** |
|
| 234 | + * Creates else if contains command, with several search terms. |
|
| 235 | + * |
|
| 236 | + * @param string $variable |
|
| 237 | + * @param string[] $searchTerms List of search terms. Do not add surrounding quotes. |
|
| 238 | + * @param bool $caseInsensitive |
|
| 239 | + * @return Mailcode_Commands_Command_ElseIf_Contains |
|
| 240 | + */ |
|
| 241 | 241 | public static function elseIfContainsAny(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
| 242 | 242 | { |
| 243 | 243 | return self::$commandSets->elseIf()->elseIfContains($variable, $searchTerms, $caseInsensitive); |
@@ -253,34 +253,34 @@ discard block |
||
| 253 | 253 | return self::$commandSets->if()->ifNotEmpty($variable); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - /** |
|
| 257 | - * Creates a renderer instance, which can be used to easily |
|
| 258 | - * create and convert commands to strings. |
|
| 259 | - * |
|
| 260 | - * @return Mailcode_Renderer |
|
| 261 | - */ |
|
| 256 | + /** |
|
| 257 | + * Creates a renderer instance, which can be used to easily |
|
| 258 | + * create and convert commands to strings. |
|
| 259 | + * |
|
| 260 | + * @return Mailcode_Renderer |
|
| 261 | + */ |
|
| 262 | 262 | public static function createRenderer() : Mailcode_Renderer |
| 263 | 263 | { |
| 264 | 264 | return new Mailcode_Renderer(); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - /** |
|
| 268 | - * Creates a printer instance, which works like the renderer, |
|
| 269 | - * but outputs the generated strings to standard output. |
|
| 270 | - * |
|
| 271 | - * @return Mailcode_Printer |
|
| 272 | - */ |
|
| 267 | + /** |
|
| 268 | + * Creates a printer instance, which works like the renderer, |
|
| 269 | + * but outputs the generated strings to standard output. |
|
| 270 | + * |
|
| 271 | + * @return Mailcode_Printer |
|
| 272 | + */ |
|
| 273 | 273 | public static function createPrinter() : Mailcode_Printer |
| 274 | 274 | { |
| 275 | 275 | return new Mailcode_Printer(); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - /** |
|
| 279 | - * Gets/creates the global instance of the date format info |
|
| 280 | - * class, used to handle date formatting aspects. |
|
| 281 | - * |
|
| 282 | - * @return Mailcode_Date_FormatInfo |
|
| 283 | - */ |
|
| 278 | + /** |
|
| 279 | + * Gets/creates the global instance of the date format info |
|
| 280 | + * class, used to handle date formatting aspects. |
|
| 281 | + * |
|
| 282 | + * @return Mailcode_Date_FormatInfo |
|
| 283 | + */ |
|
| 284 | 284 | public static function createDateInfo() : Mailcode_Date_FormatInfo |
| 285 | 285 | { |
| 286 | 286 | return Mailcode_Date_FormatInfo::getInstance(); |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class Mailcode_Commands_Command_Comment extends Mailcode_Commands_Command implements Mailcode_Commands_Command_Type_Standalone |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 23 | + /** |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | 26 | private $commentString = ''; |
| 27 | 27 | |
| 28 | 28 | protected function init() : void |
@@ -78,13 +78,13 @@ |
||
| 78 | 78 | return $this->buildIf($ifType, $this->filterVariableName($variable), 'not-empty'); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * @param string $ifType |
|
| 83 | - * @param string $variable |
|
| 84 | - * @param string[] $searchTerms |
|
| 85 | - * @param bool $caseInsensitive |
|
| 86 | - * @return Mailcode_Commands_IfBase |
|
| 87 | - */ |
|
| 81 | + /** |
|
| 82 | + * @param string $ifType |
|
| 83 | + * @param string $variable |
|
| 84 | + * @param string[] $searchTerms |
|
| 85 | + * @param bool $caseInsensitive |
|
| 86 | + * @return Mailcode_Commands_IfBase |
|
| 87 | + */ |
|
| 88 | 88 | public function buildIfContains(string $ifType, string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_IfBase |
| 89 | 89 | { |
| 90 | 90 | $keyword = ' '; |
@@ -104,12 +104,12 @@ |
||
| 104 | 104 | throw $this->instantiator->exceptionUnexpectedType('ElseIfVarNotEqualsString', $command); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * @param string $variable |
|
| 109 | - * @param string[] $searchTerms |
|
| 110 | - * @param bool $caseInsensitive |
|
| 111 | - * @return Mailcode_Commands_Command_ElseIf_Contains |
|
| 112 | - */ |
|
| 107 | + /** |
|
| 108 | + * @param string $variable |
|
| 109 | + * @param string[] $searchTerms |
|
| 110 | + * @param bool $caseInsensitive |
|
| 111 | + * @return Mailcode_Commands_Command_ElseIf_Contains |
|
| 112 | + */ |
|
| 113 | 113 | public function elseIfContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_ElseIf_Contains |
| 114 | 114 | { |
| 115 | 115 | $command = $this->instantiator->buildIfContains('ElseIf', $variable, $searchTerms, $caseInsensitive); |
@@ -128,12 +128,12 @@ |
||
| 128 | 128 | throw $this->instantiator->exceptionUnexpectedType('IfNotEmpty', $command); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * @param string $variable |
|
| 133 | - * @param string[] $searchTerms |
|
| 134 | - * @param bool $caseInsensitive |
|
| 135 | - * @return Mailcode_Commands_Command_If_Contains |
|
| 136 | - */ |
|
| 131 | + /** |
|
| 132 | + * @param string $variable |
|
| 133 | + * @param string[] $searchTerms |
|
| 134 | + * @param bool $caseInsensitive |
|
| 135 | + * @return Mailcode_Commands_Command_If_Contains |
|
| 136 | + */ |
|
| 137 | 137 | public function ifContains(string $variable, array $searchTerms, bool $caseInsensitive=false) : Mailcode_Commands_Command_If_Contains |
| 138 | 138 | { |
| 139 | 139 | $command = $this->instantiator->buildIfContains('If', $variable, $searchTerms, $caseInsensitive); |