@@ -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(); |
@@ -171,12 +171,12 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
| 174 | - /** |
|
| 175 | - * Retrieves all placeholders that have to be added to |
|
| 176 | - * the subject text. |
|
| 177 | - * |
|
| 178 | - * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
| 179 | - */ |
|
| 174 | + /** |
|
| 175 | + * Retrieves all placeholders that have to be added to |
|
| 176 | + * the subject text. |
|
| 177 | + * |
|
| 178 | + * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[] |
|
| 179 | + */ |
|
| 180 | 180 | public function getPlaceholders() |
| 181 | 181 | { |
| 182 | 182 | if(isset($this->placeholders)) |
@@ -228,46 +228,46 @@ discard block |
||
| 228 | 228 | return str_replace($placeholderStrings, array_values($replaces), $string); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - /** |
|
| 232 | - * Makes the string whole again after transforming or filtering it, |
|
| 233 | - * by replacing the command placeholders with the original commands. |
|
| 234 | - * |
|
| 235 | - * @param string $string |
|
| 236 | - * @return string |
|
| 237 | - * @throws Mailcode_Exception |
|
| 238 | - * |
|
| 239 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 240 | - * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
| 241 | - */ |
|
| 231 | + /** |
|
| 232 | + * Makes the string whole again after transforming or filtering it, |
|
| 233 | + * by replacing the command placeholders with the original commands. |
|
| 234 | + * |
|
| 235 | + * @param string $string |
|
| 236 | + * @return string |
|
| 237 | + * @throws Mailcode_Exception |
|
| 238 | + * |
|
| 239 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 240 | + * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
| 241 | + */ |
|
| 242 | 242 | public function makeWhole(string $string) : string |
| 243 | 243 | { |
| 244 | 244 | return $this->restore($string, false); |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - /** |
|
| 248 | - * Like makeWhole(), but replaces the commands with a syntax |
|
| 249 | - * highlighted version, meant for human readable texts only. |
|
| 250 | - * |
|
| 251 | - * Note: the commands lose their functionality (They cannot be |
|
| 252 | - * parsed from that string again). |
|
| 253 | - * |
|
| 254 | - * @param string $string |
|
| 255 | - * @return string |
|
| 256 | - * @throws Mailcode_Exception |
|
| 257 | - * |
|
| 258 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 259 | - * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
| 260 | - */ |
|
| 247 | + /** |
|
| 248 | + * Like makeWhole(), but replaces the commands with a syntax |
|
| 249 | + * highlighted version, meant for human readable texts only. |
|
| 250 | + * |
|
| 251 | + * Note: the commands lose their functionality (They cannot be |
|
| 252 | + * parsed from that string again). |
|
| 253 | + * |
|
| 254 | + * @param string $string |
|
| 255 | + * @return string |
|
| 256 | + * @throws Mailcode_Exception |
|
| 257 | + * |
|
| 258 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 259 | + * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING |
|
| 260 | + */ |
|
| 261 | 261 | public function makeHighlighted(string $string) : string |
| 262 | 262 | { |
| 263 | 263 | return $this->restore($string, true); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - /** |
|
| 267 | - * Retrieves the commands collection contained in the string. |
|
| 268 | - * |
|
| 269 | - * @return Mailcode_Collection |
|
| 270 | - */ |
|
| 266 | + /** |
|
| 267 | + * Retrieves the commands collection contained in the string. |
|
| 268 | + * |
|
| 269 | + * @return Mailcode_Collection |
|
| 270 | + */ |
|
| 271 | 271 | public function getCollection() : Mailcode_Collection |
| 272 | 272 | { |
| 273 | 273 | if(isset($this->collection)) |
@@ -285,11 +285,11 @@ discard block |
||
| 285 | 285 | return $this->getCollection()->isValid(); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - /** |
|
| 289 | - * @throws Mailcode_Exception |
|
| 290 | - * |
|
| 291 | - * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 292 | - */ |
|
| 288 | + /** |
|
| 289 | + * @throws Mailcode_Exception |
|
| 290 | + * |
|
| 291 | + * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS |
|
| 292 | + */ |
|
| 293 | 293 | protected function requireValidCollection() : void |
| 294 | 294 | { |
| 295 | 295 | if($this->getCollection()->isValid()) |