@@ -24,34 +24,34 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | const ERROR_PLACEHOLDER_NOT_FOUND = 66001; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var Mailcode_Parser_Safeguard_Formatter |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var Mailcode_Parser_Safeguard_Formatter |
|
| 29 | + */ |
|
| 30 | 30 | protected $formatter; |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @var string |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * @var string |
|
| 34 | + */ |
|
| 35 | 35 | protected $append = ''; |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @var string |
|
| 39 | - */ |
|
| 37 | + /** |
|
| 38 | + * @var string |
|
| 39 | + */ |
|
| 40 | 40 | protected $prepend = ''; |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * @var Mailcode_Parser_Safeguard_Placeholder |
|
| 44 | - */ |
|
| 42 | + /** |
|
| 43 | + * @var Mailcode_Parser_Safeguard_Placeholder |
|
| 44 | + */ |
|
| 45 | 45 | protected $placeholder; |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @var Mailcode_StringContainer |
|
| 49 | - */ |
|
| 47 | + /** |
|
| 48 | + * @var Mailcode_StringContainer |
|
| 49 | + */ |
|
| 50 | 50 | protected $subject; |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @var string[] |
|
| 54 | - */ |
|
| 52 | + /** |
|
| 53 | + * @var string[] |
|
| 54 | + */ |
|
| 55 | 55 | protected $log = array(); |
| 56 | 56 | |
| 57 | 57 | public function __construct(Mailcode_Parser_Safeguard_Formatter $formatter, Mailcode_Parser_Safeguard_Placeholder $placeholder) |
@@ -67,22 +67,22 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | abstract public function requiresAdjustment() : bool; |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @return int|boolean |
|
| 72 | - */ |
|
| 70 | + /** |
|
| 71 | + * @return int|boolean |
|
| 72 | + */ |
|
| 73 | 73 | public function getStartPosition() |
| 74 | 74 | { |
| 75 | 75 | return $this->subject->getSubstrPosition($this->placeholder->getReplacementText()); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Checks whether the specified position within the string |
|
| 80 | - * is within another command's placeholder (excluding this |
|
| 81 | - * location's placeholder). |
|
| 82 | - * |
|
| 83 | - * @param int $position |
|
| 84 | - * @return bool |
|
| 85 | - */ |
|
| 78 | + /** |
|
| 79 | + * Checks whether the specified position within the string |
|
| 80 | + * is within another command's placeholder (excluding this |
|
| 81 | + * location's placeholder). |
|
| 82 | + * |
|
| 83 | + * @param int $position |
|
| 84 | + * @return bool |
|
| 85 | + */ |
|
| 86 | 86 | public function isWithinCommand(int $position) : bool |
| 87 | 87 | { |
| 88 | 88 | $placeholders = $this->formatter->getSafeguard()->getPlaceholders(); |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | return false; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * @return int|boolean |
|
| 119 | - */ |
|
| 117 | + /** |
|
| 118 | + * @return int|boolean |
|
| 119 | + */ |
|
| 120 | 120 | public function getEndPosition() |
| 121 | 121 | { |
| 122 | 122 | $start = $this->getStartPosition(); |
@@ -139,14 +139,14 @@ discard block |
||
| 139 | 139 | return $this->placeholder; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - /** |
|
| 143 | - * Replaces the placeholder with the specified replacement text. |
|
| 144 | - * |
|
| 145 | - * @param string $replacementText |
|
| 146 | - * @throws Mailcode_Exception |
|
| 147 | - * |
|
| 148 | - * @see Mailcode_Parser_Safeguard_Formatter_Location::ERROR_PLACEHOLDER_NOT_FOUND |
|
| 149 | - */ |
|
| 142 | + /** |
|
| 143 | + * Replaces the placeholder with the specified replacement text. |
|
| 144 | + * |
|
| 145 | + * @param string $replacementText |
|
| 146 | + * @throws Mailcode_Exception |
|
| 147 | + * |
|
| 148 | + * @see Mailcode_Parser_Safeguard_Formatter_Location::ERROR_PLACEHOLDER_NOT_FOUND |
|
| 149 | + */ |
|
| 150 | 150 | public function replaceWith(string $replacementText) : void |
| 151 | 151 | { |
| 152 | 152 | $needle = $this->placeholder->getReplacementText(); |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | ); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - /** |
|
| 193 | - * Retrieves the location's log messages, if any. |
|
| 194 | - * @return string[] |
|
| 195 | - */ |
|
| 192 | + /** |
|
| 193 | + * Retrieves the location's log messages, if any. |
|
| 194 | + * @return string[] |
|
| 195 | + */ |
|
| 196 | 196 | public function getLog() : array |
| 197 | 197 | { |
| 198 | 198 | return $this->log; |
@@ -27,19 +27,19 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | const ERROR_INVALID_LOCATION_INSTANCE = 65601; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var Mailcode_Parser_Safeguard_Formatting |
|
| 32 | - */ |
|
| 30 | + /** |
|
| 31 | + * @var Mailcode_Parser_Safeguard_Formatting |
|
| 32 | + */ |
|
| 33 | 33 | protected $formatting; |
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * @var Mailcode_StringContainer |
|
| 37 | - */ |
|
| 35 | + /** |
|
| 36 | + * @var Mailcode_StringContainer |
|
| 37 | + */ |
|
| 38 | 38 | protected $subject; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var string[] |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var string[] |
|
| 42 | + */ |
|
| 43 | 43 | protected $log = array(); |
| 44 | 44 | |
| 45 | 45 | public function __construct(Mailcode_Parser_Safeguard_Formatting $formatting) |
@@ -93,12 +93,12 @@ discard block |
||
| 93 | 93 | ); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Retrieves all formatter-specific placeholder locations |
|
| 98 | - * in the subject string. |
|
| 99 | - * |
|
| 100 | - * @return Mailcode_Parser_Safeguard_Formatter_Location[] |
|
| 101 | - */ |
|
| 96 | + /** |
|
| 97 | + * Retrieves all formatter-specific placeholder locations |
|
| 98 | + * in the subject string. |
|
| 99 | + * |
|
| 100 | + * @return Mailcode_Parser_Safeguard_Formatter_Location[] |
|
| 101 | + */ |
|
| 102 | 102 | protected function resolveLocations() : array |
| 103 | 103 | { |
| 104 | 104 | $placeholders = $this->formatting->getSafeguard()->getPlaceholders(); |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | return $result; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Resolves the newline character used in the string. |
|
| 118 | - * |
|
| 119 | - * @param string $subject |
|
| 120 | - * @return string |
|
| 121 | - */ |
|
| 116 | + /** |
|
| 117 | + * Resolves the newline character used in the string. |
|
| 118 | + * |
|
| 119 | + * @param string $subject |
|
| 120 | + * @return string |
|
| 121 | + */ |
|
| 122 | 122 | protected function resolveNewlineChar(string $subject) : string |
| 123 | 123 | { |
| 124 | 124 | $eol = ConvertHelper::detectEOLCharacter($subject); |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * @return string[] |
|
| 155 | - */ |
|
| 153 | + /** |
|
| 154 | + * @return string[] |
|
| 155 | + */ |
|
| 156 | 156 | public function getLog() : array |
| 157 | 157 | { |
| 158 | 158 | return $this->log; |
@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | trait Mailcode_Traits_Formatting_HTMLHighlighting |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var string[] |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var string[] |
|
| 28 | + */ |
|
| 29 | 29 | private $excludeTags = array( |
| 30 | 30 | 'style', // NOTE: style tags are excluded natively on the parser level. |
| 31 | 31 | 'script' |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Adds an HTML tag name to the list of tags within which |
|
| 36 | - * commands may not be highlighted. |
|
| 37 | - * |
|
| 38 | - * @param string $tagName Case insensitive. |
|
| 39 | - * @return $this |
|
| 40 | - */ |
|
| 34 | + /** |
|
| 35 | + * Adds an HTML tag name to the list of tags within which |
|
| 36 | + * commands may not be highlighted. |
|
| 37 | + * |
|
| 38 | + * @param string $tagName Case insensitive. |
|
| 39 | + * @return $this |
|
| 40 | + */ |
|
| 41 | 41 | public function excludeTag(string $tagName) : Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting |
| 42 | 42 | { |
| 43 | 43 | $tagName = strtolower($tagName); |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Adds several exluded tag names at once. |
|
| 55 | - * |
|
| 56 | - * @param string[] $tagNames |
|
| 57 | - * @return $this |
|
| 58 | - */ |
|
| 53 | + /** |
|
| 54 | + * Adds several exluded tag names at once. |
|
| 55 | + * |
|
| 56 | + * @param string[] $tagNames |
|
| 57 | + * @return $this |
|
| 58 | + */ |
|
| 59 | 59 | public function excludeTags(array $tagNames) : Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting |
| 60 | 60 | { |
| 61 | 61 | foreach($tagNames as $tagName) |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Whether the specified tag name is in the exlusion list. |
|
| 71 | - * |
|
| 72 | - * @param string $tagName |
|
| 73 | - * @return bool |
|
| 74 | - */ |
|
| 69 | + /** |
|
| 70 | + * Whether the specified tag name is in the exlusion list. |
|
| 71 | + * |
|
| 72 | + * @param string $tagName |
|
| 73 | + * @return bool |
|
| 74 | + */ |
|
| 75 | 75 | public function isTagExcluded(string $tagName) : bool |
| 76 | 76 | { |
| 77 | 77 | $tagName = strtolower($tagName); |