Passed
Push — master ( 827600...d1e019 )
by Sebastian
04:24
created
src/Mailcode/Parser/Safeguard/Formatter/ReplacerType.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@
 block discarded – undo
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())
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/Type/SingleLines.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/Type/SingleLines/Location.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/Type/MarkVariables.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@
 block discarded – undo
29 29
     
30 30
     const ERROR_INVALID_TAG_TEMPLATE = 66101;
31 31
     
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     private $tagTemplate = '<span class="mailcode-marked-variable">%s</span>';
36 36
     
37 37
     protected function initFormatting() : void
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/FormatType.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard.php 1 patch
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -53,50 +53,50 @@  discard block
 block discarded – undo
53 53
     const ERROR_EMPTY_DELIMITER = 47803;
54 54
     const ERROR_PLACEHOLDER_NOT_FOUND = 47804;
55 55
     
56
-   /**
57
-    * @var Mailcode_Parser
58
-    */
56
+    /**
57
+     * @var Mailcode_Parser
58
+     */
59 59
     protected $parser;
60 60
     
61
-   /**
62
-    * @var Mailcode_Collection
63
-    */
61
+    /**
62
+     * @var Mailcode_Collection
63
+     */
64 64
     protected $commands;
65 65
     
66
-   /**
67
-    * @var string
68
-    */
66
+    /**
67
+     * @var string
68
+     */
69 69
     protected $originalString;
70 70
     
71
-   /**
72
-    * @var Mailcode_Collection
73
-    */
71
+    /**
72
+     * @var Mailcode_Collection
73
+     */
74 74
     protected $collection;
75 75
     
76
-   /**
77
-    * Counter for the placeholders, global for all placeholders.
78
-    * @var integer
79
-    */
76
+    /**
77
+     * Counter for the placeholders, global for all placeholders.
78
+     * @var integer
79
+     */
80 80
     private static $counter = 0;
81 81
     
82
-   /**
83
-    * @var Mailcode_Parser_Safeguard_Placeholder[]
84
-    */
82
+    /**
83
+     * @var Mailcode_Parser_Safeguard_Placeholder[]
84
+     */
85 85
     protected $placeholders;
86 86
     
87
-   /**
88
-    * @var string
89
-    */
87
+    /**
88
+     * @var string
89
+     */
90 90
     protected $delimiter = '__';
91 91
     
92
-   /**
93
-    * @var string[]|NULL
94
-    */
92
+    /**
93
+     * @var string[]|NULL
94
+     */
95 95
     protected $placeholderStrings;
96 96
     
97
-   /**
98
-    * @var Mailcode_Parser_Safeguard_Formatting|NULL
99
-    */
97
+    /**
98
+     * @var Mailcode_Parser_Safeguard_Formatting|NULL
99
+     */
100 100
     private $formatting = null;
101 101
     
102 102
     public function __construct(Mailcode_Parser $parser, string $subject)
@@ -105,25 +105,25 @@  discard block
 block discarded – undo
105 105
         $this->originalString = $subject;
106 106
     }
107 107
     
108
-   /**
109
-    * Retrieves the string the safeguard was created for.
110
-    * 
111
-    * @return string
112
-    */
108
+    /**
109
+     * Retrieves the string the safeguard was created for.
110
+     * 
111
+     * @return string
112
+     */
113 113
     public function getOriginalString() : string
114 114
     {
115 115
         return $this->originalString;
116 116
     }
117 117
     
118
-   /**
119
-    * Sets the delimiter character sequence used to prepend
120
-    * and append to the placeholders.
121
-    * 
122
-    * The delimiter's default is "__" (two underscores).
123
-    * 
124
-    * @param string $delimiter
125
-    * @return Mailcode_Parser_Safeguard
126
-    */
118
+    /**
119
+     * Sets the delimiter character sequence used to prepend
120
+     * and append to the placeholders.
121
+     * 
122
+     * The delimiter's default is "__" (two underscores).
123
+     * 
124
+     * @param string $delimiter
125
+     * @return Mailcode_Parser_Safeguard
126
+     */
127 127
     public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard
128 128
     {
129 129
         if(empty($delimiter))
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
         return $this->delimiter;
146 146
     }
147 147
     
148
-   /**
149
-    * Retrieves the safe string in which all commands have been replaced
150
-    * by placeholder strings.
151
-    *
152
-    * @return string
153
-    * @throws Mailcode_Exception 
154
-    *
155
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
156
-    */
148
+    /**
149
+     * Retrieves the safe string in which all commands have been replaced
150
+     * by placeholder strings.
151
+     *
152
+     * @return string
153
+     * @throws Mailcode_Exception 
154
+     *
155
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
156
+     */
157 157
     public function makeSafe() : string
158 158
     {
159 159
         $this->requireValidCollection();
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
         return $this->makeSafePartial();
162 162
     }
163 163
     
164
-   /**
165
-    * Like makeSafe(), but allows partial (invalid) commands: use this
166
-    * if the subject string may contain only part of the whole set of
167
-    * commands. 
168
-    * 
169
-    * Example: parsing a text with an opening if statement, without the 
170
-    * matching end statement.
171
-    * 
172
-    * @return string
173
-    */
164
+    /**
165
+     * Like makeSafe(), but allows partial (invalid) commands: use this
166
+     * if the subject string may contain only part of the whole set of
167
+     * commands. 
168
+     * 
169
+     * Example: parsing a text with an opening if statement, without the 
170
+     * matching end statement.
171
+     * 
172
+     * @return string
173
+     */
174 174
     public function makeSafePartial() : string
175 175
     {
176 176
         $placeholders = $this->getPlaceholders();
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
         return $string;
201 201
     }
202 202
     
203
-   /**
204
-    * Creates a formatting handler, which can be used to specify
205
-    * which formattings to use for the commands in the subject string.
206
-    * 
207
-    * @param Mailcode_StringContainer|string $subject
208
-    * @return Mailcode_Parser_Safeguard_Formatting
209
-    */
203
+    /**
204
+     * Creates a formatting handler, which can be used to specify
205
+     * which formattings to use for the commands in the subject string.
206
+     * 
207
+     * @param Mailcode_StringContainer|string $subject
208
+     * @return Mailcode_Parser_Safeguard_Formatting
209
+     */
210 210
     public function createFormatting($subject) : Mailcode_Parser_Safeguard_Formatting
211 211
     {
212 212
         if(is_string($subject))
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
         return new Mailcode_Parser_Safeguard_Formatting($this, $subject);
218 218
     }
219 219
     
220
-   /**
221
-    * Retrieves all placeholders that have to be added to
222
-    * the subject text.
223
-    * 
224
-    * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[]
225
-    */
220
+    /**
221
+     * Retrieves all placeholders that have to be added to
222
+     * the subject text.
223
+     * 
224
+     * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[]
225
+     */
226 226
     public function getPlaceholders()
227 227
     {
228 228
         if(isset($this->placeholders))
@@ -269,16 +269,16 @@  discard block
 block discarded – undo
269 269
         return $formatting->toString();
270 270
     }
271 271
     
272
-   /**
273
-    * Makes the string whole again after transforming or filtering it,
274
-    * by replacing the command placeholders with the original commands.
275
-    *
276
-    * @param string $string
277
-    * @return string
278
-    * @throws Mailcode_Exception
279
-    *
280
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
281
-    */
272
+    /**
273
+     * Makes the string whole again after transforming or filtering it,
274
+     * by replacing the command placeholders with the original commands.
275
+     *
276
+     * @param string $string
277
+     * @return string
278
+     * @throws Mailcode_Exception
279
+     *
280
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
281
+     */
282 282
     public function makeWhole(string $string) : string
283 283
     {
284 284
         return $this->restore(
@@ -288,15 +288,15 @@  discard block
 block discarded – undo
288 288
         );
289 289
     }
290 290
     
291
-   /**
292
-    * Like `makeWhole()`, but ignores missing command placeholders.
293
-    *
294
-    * @param string $string
295
-    * @return string
296
-    * @throws Mailcode_Exception
297
-    *
298
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
299
-    */
291
+    /**
292
+     * Like `makeWhole()`, but ignores missing command placeholders.
293
+     *
294
+     * @param string $string
295
+     * @return string
296
+     * @throws Mailcode_Exception
297
+     *
298
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
299
+     */
300 300
     public function makeWholePartial(string $string) : string
301 301
     {
302 302
         return $this->restore(
@@ -306,19 +306,19 @@  discard block
 block discarded – undo
306 306
         );
307 307
     }
308 308
 
309
-   /**
310
-    * Like `makeWhole()`, but replaces the commands with a syntax
311
-    * highlighted version, meant for human readable texts only.
312
-    * 
313
-    * Note: the commands lose their functionality (They cannot be 
314
-    * parsed from that string again).
315
-    *
316
-    * @param string $string
317
-    * @return string
318
-    * @throws Mailcode_Exception
319
-    *
320
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
321
-    */
309
+    /**
310
+     * Like `makeWhole()`, but replaces the commands with a syntax
311
+     * highlighted version, meant for human readable texts only.
312
+     * 
313
+     * Note: the commands lose their functionality (They cannot be 
314
+     * parsed from that string again).
315
+     *
316
+     * @param string $string
317
+     * @return string
318
+     * @throws Mailcode_Exception
319
+     *
320
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
321
+     */
322 322
     public function makeHighlighted(string $string) : string
323 323
     {
324 324
         return $this->restore(
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
         );
329 329
     }
330 330
     
331
-   /**
332
-    * Like `makeHighlighted()`, but ignores missing command placeholders.
333
-    * 
334
-    * @param string $string
335
-    * @return string
336
-    * @throws Mailcode_Exception
337
-    *
338
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
339
-    */
331
+    /**
332
+     * Like `makeHighlighted()`, but ignores missing command placeholders.
333
+     * 
334
+     * @param string $string
335
+     * @return string
336
+     * @throws Mailcode_Exception
337
+     *
338
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
339
+     */
340 340
     public function makeHighlightedPartial(string $string) : string
341 341
     {
342 342
         return $this->restore(
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
         );
347 347
     }
348 348
     
349
-   /**
350
-    * Retrieves the commands collection contained in the string.
351
-    * 
352
-    * @return Mailcode_Collection
353
-    */
349
+    /**
350
+     * Retrieves the commands collection contained in the string.
351
+     * 
352
+     * @return Mailcode_Collection
353
+     */
354 354
     public function getCollection() : Mailcode_Collection
355 355
     {
356 356
         if(isset($this->collection))
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
         return $this->getCollection()->isValid();
369 369
     }
370 370
     
371
-   /**
372
-    * @throws Mailcode_Exception
373
-    * 
374
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
375
-    */
371
+    /**
372
+     * @throws Mailcode_Exception
373
+     * 
374
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
375
+     */
376 376
     protected function requireValidCollection() : void
377 377
     {
378 378
         if($this->getCollection()->isValid())
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
         );
392 392
     }
393 393
     
394
-   /**
395
-    * Retrieves a list of all placeholder IDs used in the text.
396
-    * 
397
-    * @return string[]
398
-    */
394
+    /**
395
+     * Retrieves a list of all placeholder IDs used in the text.
396
+     * 
397
+     * @return string[]
398
+     */
399 399
     public function getPlaceholderStrings() : array
400 400
     {
401 401
         if(is_array($this->placeholderStrings))
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
         return in_array($subject, $ids);
423 423
     }
424 424
     
425
-   /**
426
-    * Retrieves a placeholder instance by its ID.
427
-    * 
428
-    * @param int $id
429
-    * @throws Mailcode_Exception If the placeholder was not found.
430
-    * @return Mailcode_Parser_Safeguard_Placeholder
431
-    */
425
+    /**
426
+     * Retrieves a placeholder instance by its ID.
427
+     * 
428
+     * @param int $id
429
+     * @throws Mailcode_Exception If the placeholder was not found.
430
+     * @return Mailcode_Parser_Safeguard_Placeholder
431
+     */
432 432
     public function getPlaceholderByID(int $id) : Mailcode_Parser_Safeguard_Placeholder
433 433
     {
434 434
         $placeholders = $this->getPlaceholders();
@@ -451,13 +451,13 @@  discard block
 block discarded – undo
451 451
         );
452 452
     }
453 453
     
454
-   /**
455
-    * Retrieves a placeholder instance by its replacement text.
456
-    * 
457
-    * @param string $string
458
-    * @throws Mailcode_Exception
459
-    * @return Mailcode_Parser_Safeguard_Placeholder
460
-    */
454
+    /**
455
+     * Retrieves a placeholder instance by its replacement text.
456
+     * 
457
+     * @param string $string
458
+     * @throws Mailcode_Exception
459
+     * @return Mailcode_Parser_Safeguard_Placeholder
460
+     */
461 461
     public function getPlaceholderByString(string $string) : Mailcode_Parser_Safeguard_Placeholder
462 462
     {
463 463
         $placeholders = $this->getPlaceholders();
Please login to merge, or discard this patch.
src/Mailcode/StringContainer.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -26,39 +26,39 @@  discard block
 block discarded – undo
26 26
     const ERROR_INVALID_CALLABLE = 65701;
27 27
     const ERROR_UPDATE_CALLED_DURING_UPDATE_OPERATION = 65702;
28 28
     
29
-   /**
30
-    * @var string
31
-    */
29
+    /**
30
+     * @var string
31
+     */
32 32
     private $subject;
33 33
     
34
-   /**
35
-    * @var integer
36
-    */
34
+    /**
35
+     * @var integer
36
+     */
37 37
     private static $listenerCounter = 0;
38 38
     
39
-   /**
40
-    * @var callable[]
41
-    */
39
+    /**
40
+     * @var callable[]
41
+     */
42 42
     private $listeners = array();
43 43
     
44
-   /**
45
-    * @var boolean
46
-    */
44
+    /**
45
+     * @var boolean
46
+     */
47 47
     private $updating = false;
48 48
     
49
-   /**
50
-    * @var integer
51
-    */
49
+    /**
50
+     * @var integer
51
+     */
52 52
     private static $idCounter = 0;
53 53
     
54
-   /**
55
-    * @var integer
56
-    */
54
+    /**
55
+     * @var integer
56
+     */
57 57
     private $id;
58 58
     
59
-   /**
60
-    * @var integer
61
-    */
59
+    /**
60
+     * @var integer
61
+     */
62 62
     private $length;
63 63
     
64 64
     public function __construct(string $subject)
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
         return $this->id;
76 76
     }
77 77
     
78
-   /**
79
-    * Updates the string with the specified string.
80
-    * Notifies all listeners of the change.
81
-    * 
82
-    * @param string $subject
83
-    * @throws Mailcode_Exception
84
-    * @return bool Whether the string had modifications.
85
-    * 
86
-    * @see Mailcode_StringContainer::ERROR_UPDATE_CALLED_DURING_UPDATE_OPERATION
87
-    */
78
+    /**
79
+     * Updates the string with the specified string.
80
+     * Notifies all listeners of the change.
81
+     * 
82
+     * @param string $subject
83
+     * @throws Mailcode_Exception
84
+     * @return bool Whether the string had modifications.
85
+     * 
86
+     * @see Mailcode_StringContainer::ERROR_UPDATE_CALLED_DURING_UPDATE_OPERATION
87
+     */
88 88
     public function updateString(string $subject) : bool
89 89
     {
90 90
         // avoid triggering an update if there are no changes in the string
@@ -117,27 +117,27 @@  discard block
 block discarded – undo
117 117
         return true;
118 118
     }
119 119
     
120
-   /**
121
-    * Retrieves the stored string.
122
-    * 
123
-    * @return string
124
-    */
120
+    /**
121
+     * Retrieves the stored string.
122
+     * 
123
+     * @return string
124
+     */
125 125
     public function getString() : string
126 126
     {
127 127
         return $this->subject;
128 128
     }
129 129
     
130
-   /**
131
-    * Adds a listener that will be informed every time the string is modified.
132
-    * The callback gets the string container instance as parameter.
133
-    * 
134
-    * @param callable $callback
135
-    * @throws Mailcode_Exception If it is not a valid callable.
136
-    * @return int The listener number, to be able to remove it using `removeListener()`.
137
-    * 
138
-    * @see Mailcode_StringContainer::removeListener()
139
-    * @see Mailcode_StringContainer::ERROR_INVALID_CALLABLE
140
-    */
130
+    /**
131
+     * Adds a listener that will be informed every time the string is modified.
132
+     * The callback gets the string container instance as parameter.
133
+     * 
134
+     * @param callable $callback
135
+     * @throws Mailcode_Exception If it is not a valid callable.
136
+     * @return int The listener number, to be able to remove it using `removeListener()`.
137
+     * 
138
+     * @see Mailcode_StringContainer::removeListener()
139
+     * @see Mailcode_StringContainer::ERROR_INVALID_CALLABLE
140
+     */
141 141
     public function addListener($callback) : int
142 142
     {
143 143
         self::$listenerCounter++;
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
         return $this->length;
165 165
     }
166 166
     
167
-   /**
168
-    * Removes an existing listener by its ID.
169
-    * Has no effect if it does not exist, or has already been removed.
170
-    * 
171
-    * @param int $listenerID
172
-    */
167
+    /**
168
+     * Removes an existing listener by its ID.
169
+     * Has no effect if it does not exist, or has already been removed.
170
+     * 
171
+     * @param int $listenerID
172
+     */
173 173
     public function removeListener(int $listenerID) : void
174 174
     {
175 175
         if(isset($this->listeners[$listenerID]))
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
         }
179 179
     }
180 180
     
181
-   /**
182
-    * Replaces all substrings matching needle with the replacement text.
183
-    *  
184
-    * @param string $needle
185
-    * @param string $replacement
186
-    * @return bool
187
-    */
181
+    /**
182
+     * Replaces all substrings matching needle with the replacement text.
183
+     *  
184
+     * @param string $needle
185
+     * @param string $replacement
186
+     * @return bool
187
+     */
188 188
     public function replaceSubstrings(string $needle, string $replacement) : bool
189 189
     {
190 190
         $string = str_replace($needle, $replacement, $this->subject);
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
         return $this->updateString($string);
193 193
     }
194 194
 
195
-   /**
196
-    * Get the position of a substring in the string.
197
-    * 
198
-    * @param string $needle
199
-    * @return int|bool The zero-based position, or false if not found.
200
-    */
195
+    /**
196
+     * Get the position of a substring in the string.
197
+     * 
198
+     * @param string $needle
199
+     * @return int|bool The zero-based position, or false if not found.
200
+     */
201 201
     public function getSubstrPosition(string $needle)
202 202
     {
203 203
         return mb_strpos($this->subject, $needle);
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/Location.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -24,34 +24,34 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.