@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | return $this->getSign(); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Retrieves all known comparison operator signs. |
|
| 35 | - * @return string[] |
|
| 36 | - */ |
|
| 33 | + /** |
|
| 34 | + * Retrieves all known comparison operator signs. |
|
| 35 | + * @return string[] |
|
| 36 | + */ |
|
| 37 | 37 | public static function getComparisonSigns() : array |
| 38 | 38 | { |
| 39 | 39 | return array( |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | ); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Retrieves all known arithmetic operator signs. |
|
| 51 | - * @return string[] |
|
| 52 | - */ |
|
| 49 | + /** |
|
| 50 | + * Retrieves all known arithmetic operator signs. |
|
| 51 | + * @return string[] |
|
| 52 | + */ |
|
| 53 | 53 | public static function getArithmeticSigns() : array |
| 54 | 54 | { |
| 55 | 55 | return array( |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | ); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Whether the operator is comparison related (equals, not equals, smaller, greater...). |
|
| 65 | - * |
|
| 66 | - * @return bool |
|
| 67 | - */ |
|
| 63 | + /** |
|
| 64 | + * Whether the operator is comparison related (equals, not equals, smaller, greater...). |
|
| 65 | + * |
|
| 66 | + * @return bool |
|
| 67 | + */ |
|
| 68 | 68 | public function isComparator() : bool |
| 69 | 69 | { |
| 70 | 70 | return |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | $this->isSmallerOrEquals(); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Whether the operator is calculation related (minus, plus, divide, multiply). |
|
| 81 | - * |
|
| 82 | - * @return bool |
|
| 83 | - */ |
|
| 79 | + /** |
|
| 80 | + * Whether the operator is calculation related (minus, plus, divide, multiply). |
|
| 81 | + * |
|
| 82 | + * @return bool |
|
| 83 | + */ |
|
| 84 | 84 | public function isCalculator() : bool |
| 85 | 85 | { |
| 86 | 86 | return |
@@ -35,13 +35,13 @@ |
||
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Resolves the string with which this location needs to be |
|
| 40 | - * replaced. |
|
| 41 | - * |
|
| 42 | - * @param Mailcode_Parser_Safeguard_Formatter_Location $location |
|
| 43 | - * @return string |
|
| 44 | - */ |
|
| 38 | + /** |
|
| 39 | + * Resolves the string with which this location needs to be |
|
| 40 | + * replaced. |
|
| 41 | + * |
|
| 42 | + * @param Mailcode_Parser_Safeguard_Formatter_Location $location |
|
| 43 | + * @return string |
|
| 44 | + */ |
|
| 45 | 45 | private function resolveReplacement(Mailcode_Parser_Safeguard_Formatter_Location $location) : string |
| 46 | 46 | { |
| 47 | 47 | if($location->requiresAdjustment()) |
@@ -23,14 +23,14 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class Mailcode_Parser_Safeguard_Formatter_Type_SingleLines extends Mailcode_Parser_Safeguard_Formatter_FormatType |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | 29 | private $eol; |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var int |
|
| 33 | - */ |
|
| 31 | + /** |
|
| 32 | + * @var int |
|
| 33 | + */ |
|
| 34 | 34 | private $eolLength; |
| 35 | 35 | |
| 36 | 36 | protected function initFormatting() : void |
@@ -25,14 +25,14 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | class Mailcode_Parser_Safeguard_Formatter_Type_SingleLines_Location extends Mailcode_Parser_Safeguard_Formatter_Location |
| 27 | 27 | { |
| 28 | - /** |
|
| 29 | - * @var int |
|
| 30 | - */ |
|
| 28 | + /** |
|
| 29 | + * @var int |
|
| 30 | + */ |
|
| 31 | 31 | protected $eolLength; |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var string |
|
| 35 | - */ |
|
| 33 | + /** |
|
| 34 | + * @var string |
|
| 35 | + */ |
|
| 36 | 36 | protected $eol; |
| 37 | 37 | |
| 38 | 38 | protected function init() : void |
@@ -25,11 +25,11 @@ |
||
| 25 | 25 | return PHP_INT_MAX; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Formats the specified string according to the formatter. |
|
| 30 | - * Retrieve the updated string from the string container used |
|
| 31 | - * to create the formatter, or use `getSubjectString()`. |
|
| 32 | - */ |
|
| 28 | + /** |
|
| 29 | + * Formats the specified string according to the formatter. |
|
| 30 | + * Retrieve the updated string from the string container used |
|
| 31 | + * to create the formatter, or use `getSubjectString()`. |
|
| 32 | + */ |
|
| 33 | 33 | public function format() : void |
| 34 | 34 | { |
| 35 | 35 | $locations = $this->resolveLocations(); |
@@ -176,27 +176,27 @@ |
||
| 176 | 176 | * @return array<string,string> |
| 177 | 177 | * @throws Mailcode_Exception |
| 178 | 178 | */ |
| 179 | - private function parseVarName() : array |
|
| 180 | - { |
|
| 181 | - $tokens = explode('.', ltrim($this->variable->getFullName(), '$')); |
|
| 182 | - |
|
| 183 | - if(count($tokens) === 2) |
|
| 184 | - { |
|
| 185 | - return array( |
|
| 186 | - 'path' => $tokens[0], |
|
| 187 | - 'name' => $tokens[1] |
|
| 188 | - ); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - throw new Mailcode_Exception( |
|
| 192 | - 'Invalid variable name for a list property.', |
|
| 193 | - sprintf( |
|
| 194 | - 'Exactly 2 parts are required, variable [%s] has [%s].', |
|
| 195 | - $this->variable->getFullName(), |
|
| 196 | - count($tokens) |
|
| 197 | - ), |
|
| 198 | - self::ERROR_INVALID_LIST_VARIABLE_NAME |
|
| 199 | - ); |
|
| 200 | - } |
|
| 179 | + private function parseVarName() : array |
|
| 180 | + { |
|
| 181 | + $tokens = explode('.', ltrim($this->variable->getFullName(), '$')); |
|
| 182 | + |
|
| 183 | + if(count($tokens) === 2) |
|
| 184 | + { |
|
| 185 | + return array( |
|
| 186 | + 'path' => $tokens[0], |
|
| 187 | + 'name' => $tokens[1] |
|
| 188 | + ); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + throw new Mailcode_Exception( |
|
| 192 | + 'Invalid variable name for a list property.', |
|
| 193 | + sprintf( |
|
| 194 | + 'Exactly 2 parts are required, variable [%s] has [%s].', |
|
| 195 | + $this->variable->getFullName(), |
|
| 196 | + count($tokens) |
|
| 197 | + ), |
|
| 198 | + self::ERROR_INVALID_LIST_VARIABLE_NAME |
|
| 199 | + ); |
|
| 200 | + } |
|
| 201 | 201 | } |
| 202 | 202 | |
@@ -24,9 +24,9 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | trait Mailcode_Traits_Commands_Validation_Variable |
| 26 | 26 | { |
| 27 | - /** |
|
| 28 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL |
|
| 29 | + */ |
|
| 30 | 30 | protected $variableToken; |
| 31 | 31 | |
| 32 | 32 | protected function validateSyntax_variable() : void |
@@ -23,25 +23,25 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | trait Mailcode_Traits_Formatting_HTMLHighlighting |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * Stored this way so we can use isset() instead |
|
| 28 | - * of using in_array, which is some magnitudes slower. |
|
| 29 | - * The boolean value is not used otherwise. |
|
| 30 | - * |
|
| 31 | - * @var array<string,bool> |
|
| 32 | - */ |
|
| 26 | + /** |
|
| 27 | + * Stored this way so we can use isset() instead |
|
| 28 | + * of using in_array, which is some magnitudes slower. |
|
| 29 | + * The boolean value is not used otherwise. |
|
| 30 | + * |
|
| 31 | + * @var array<string,bool> |
|
| 32 | + */ |
|
| 33 | 33 | private $excludeTags = array( |
| 34 | 34 | 'style' => true, // NOTE: style tags are excluded natively on the parser level. |
| 35 | 35 | 'script' => true |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Adds an HTML tag name to the list of tags within which |
|
| 40 | - * commands may not be highlighted. |
|
| 41 | - * |
|
| 42 | - * @param string $tagName Case insensitive. |
|
| 43 | - * @return $this |
|
| 44 | - */ |
|
| 38 | + /** |
|
| 39 | + * Adds an HTML tag name to the list of tags within which |
|
| 40 | + * commands may not be highlighted. |
|
| 41 | + * |
|
| 42 | + * @param string $tagName Case insensitive. |
|
| 43 | + * @return $this |
|
| 44 | + */ |
|
| 45 | 45 | public function excludeTag(string $tagName) |
| 46 | 46 | { |
| 47 | 47 | $tagName = strtolower($tagName); |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | return $this; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Adds several exluded tag names at once. |
|
| 56 | - * |
|
| 57 | - * @param string[] $tagNames |
|
| 58 | - * @return $this |
|
| 59 | - */ |
|
| 54 | + /** |
|
| 55 | + * Adds several exluded tag names at once. |
|
| 56 | + * |
|
| 57 | + * @param string[] $tagNames |
|
| 58 | + * @return $this |
|
| 59 | + */ |
|
| 60 | 60 | public function excludeTags(array $tagNames) |
| 61 | 61 | { |
| 62 | 62 | foreach($tagNames as $tagName) |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Whether the specified tag name is in the exlusion list. |
|
| 72 | - * |
|
| 73 | - * @param string $tagName |
|
| 74 | - * @return bool |
|
| 75 | - */ |
|
| 70 | + /** |
|
| 71 | + * Whether the specified tag name is in the exlusion list. |
|
| 72 | + * |
|
| 73 | + * @param string $tagName |
|
| 74 | + * @return bool |
|
| 75 | + */ |
|
| 76 | 76 | public function isTagExcluded(string $tagName) : bool |
| 77 | 77 | { |
| 78 | 78 | $tagName = strtolower($tagName); |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | trait Mailcode_Traits_Commands_Validation_CaseSensitive |
| 28 | 28 | { |
| 29 | - /** |
|
| 30 | - * @var boolean |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var boolean |
|
| 31 | + */ |
|
| 32 | 32 | protected $caseInsensitive = false; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var Mailcode_Parser_Statement_Tokenizer_Token_Keyword|NULL |
|
| 36 | + */ |
|
| 37 | 37 | protected $regexToken; |
| 38 | 38 | |
| 39 | 39 | protected function validateSyntax_case_sensitive() : void |