@@ -55,40 +55,40 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | const ERROR_EMPTY_DELIMITER = 47803; |
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @var Mailcode_Parser |
|
| 60 | - */ |
|
| 58 | + /** |
|
| 59 | + * @var Mailcode_Parser |
|
| 60 | + */ |
|
| 61 | 61 | protected $parser; |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @var Mailcode_Collection |
|
| 65 | - */ |
|
| 63 | + /** |
|
| 64 | + * @var Mailcode_Collection |
|
| 65 | + */ |
|
| 66 | 66 | protected $commands; |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @var string |
|
| 70 | - */ |
|
| 68 | + /** |
|
| 69 | + * @var string |
|
| 70 | + */ |
|
| 71 | 71 | protected $originalString; |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @var Mailcode_Collection |
|
| 75 | - */ |
|
| 73 | + /** |
|
| 74 | + * @var Mailcode_Collection |
|
| 75 | + */ |
|
| 76 | 76 | protected $collection; |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Counter for the placeholders, global for all placeholders. |
|
| 80 | - * @var integer |
|
| 81 | - */ |
|
| 78 | + /** |
|
| 79 | + * Counter for the placeholders, global for all placeholders. |
|
| 80 | + * @var integer |
|
| 81 | + */ |
|
| 82 | 82 | private static $counter = 0; |
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * @var Mailcode_Parser_Safeguard_Placeholder[] |
|
| 86 | - */ |
|
| 84 | + /** |
|
| 85 | + * @var Mailcode_Parser_Safeguard_Placeholder[] |
|
| 86 | + */ |
|
| 87 | 87 | protected $placeholders; |
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @var string |
|
| 91 | - */ |
|
| 89 | + /** |
|
| 90 | + * @var string |
|
| 91 | + */ |
|
| 92 | 92 | protected $delimiter = '__'; |
| 93 | 93 | |
| 94 | 94 | public function __construct(Mailcode_Parser $parser, string $subject) |
@@ -97,15 +97,15 @@ discard block |
||
| 97 | 97 | $this->originalString = $subject; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Sets the delimiter character sequence used to prepend |
|
| 102 | - * and append to the placeholders. |
|
| 103 | - * |
|
| 104 | - * The delimiter's default is "__" (two underscores). |
|
| 105 | - * |
|
| 106 | - * @param string $delimiter |
|
| 107 | - * @return Mailcode_Parser_Safeguard |
|
| 108 | - */ |
|
| 100 | + /** |
|
| 101 | + * Sets the delimiter character sequence used to prepend |
|
| 102 | + * and append to the placeholders. |
|
| 103 | + * |
|
| 104 | + * The delimiter's default is "__" (two underscores). |
|
| 105 | + * |
|
| 106 | + * @param string $delimiter |
|
| 107 | + * @return Mailcode_Parser_Safeguard |
|
| 108 | + */ |
|
| 109 | 109 | public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard |
| 110 | 110 | { |
| 111 | 111 | if(empty($delimiter)) |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | return $this->delimiter; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - /** |
|
| 131 | - * Retrieves the safe string in which all commands have been replaced |
|
| 132 | - * by placeholder strings. |
|
| 133 | - * |
|
| 134 | - * @return string |
|
| 135 | - * @throws Mailcode_Exception |
|
| 136 | - * |
|
| 137 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 138 | - */ |
|
| 130 | + /** |
|
| 131 | + * Retrieves the safe string in which all commands have been replaced |
|
| 132 | + * by placeholder strings. |
|
| 133 | + * |
|
| 134 | + * @return string |
|
| 135 | + * @throws Mailcode_Exception |
|
| 136 | + * |
|
| 137 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 138 | + */ |
|
| 139 | 139 | public function makeSafe() : string |
| 140 | 140 | { |
| 141 | 141 | $this->requireValidCollection(); |
@@ -160,12 +160,12 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
| 163 | - /** |
|
| 164 | - * Retrieves all placeholders that have to be added to |
|
| 165 | - * the subject text. |
|
| 166 | - * |
|
| 167 | - * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
| 168 | - */ |
|
| 163 | + /** |
|
| 164 | + * Retrieves all placeholders that have to be added to |
|
| 165 | + * the subject text. |
|
| 166 | + * |
|
| 167 | + * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
| 168 | + */ |
|
| 169 | 169 | public function getPlaceholders() |
| 170 | 170 | { |
| 171 | 171 | if(isset($this->placeholders)) |
@@ -191,17 +191,17 @@ discard block |
||
| 191 | 191 | return $this->placeholders; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - /** |
|
| 195 | - * Makes the string whole again after transforming or filtering it, |
|
| 196 | - * by replacing the command placeholders with the original commands. |
|
| 197 | - * |
|
| 198 | - * @param string $string |
|
| 199 | - * @return string |
|
| 200 | - * @throws Mailcode_Exception |
|
| 201 | - * |
|
| 202 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 203 | - * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
| 204 | - */ |
|
| 194 | + /** |
|
| 195 | + * Makes the string whole again after transforming or filtering it, |
|
| 196 | + * by replacing the command placeholders with the original commands. |
|
| 197 | + * |
|
| 198 | + * @param string $string |
|
| 199 | + * @return string |
|
| 200 | + * @throws Mailcode_Exception |
|
| 201 | + * |
|
| 202 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 203 | + * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
| 204 | + */ |
|
| 205 | 205 | public function makeWhole(string $string) : string |
| 206 | 206 | { |
| 207 | 207 | $this->requireValidCollection(); |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | return str_replace($placeholderStrings, array_values($replaces), $string); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - /** |
|
| 232 | - * Retrieves the commands collection contained in the string. |
|
| 233 | - * |
|
| 234 | - * @return Mailcode_Collection |
|
| 235 | - */ |
|
| 231 | + /** |
|
| 232 | + * Retrieves the commands collection contained in the string. |
|
| 233 | + * |
|
| 234 | + * @return Mailcode_Collection |
|
| 235 | + */ |
|
| 236 | 236 | public function getCollection() : Mailcode_Collection |
| 237 | 237 | { |
| 238 | 238 | if(isset($this->collection)) |
@@ -250,11 +250,11 @@ discard block |
||
| 250 | 250 | return $this->getCollection()->isValid(); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - /** |
|
| 254 | - * @throws Mailcode_Exception |
|
| 255 | - * |
|
| 256 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 257 | - */ |
|
| 253 | + /** |
|
| 254 | + * @throws Mailcode_Exception |
|
| 255 | + * |
|
| 256 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 257 | + */ |
|
| 258 | 258 | protected function requireValidCollection() : void |
| 259 | 259 | { |
| 260 | 260 | if($this->getCollection()->isValid()) |