Passed
Push — master ( ad7522...d3eb9e )
by Sebastian
05:45
created
src/Mailcode/Variables.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 {
23 23
     public const REGEX_VARIABLE_NAME = '/\$\s*([A-Z0-9_]+)\s*\.\s*([A-Z0-9_]+)|\$\s*([A-Z0-9_]+)/six';
24 24
     
25
-   /**
26
-    * @var Mailcode_Variables_Collection_Regular
27
-    */
25
+    /**
26
+     * @var Mailcode_Variables_Collection_Regular
27
+     */
28 28
     protected $collection;
29 29
 
30 30
     /**
Please login to merge, or discard this patch.
src/Mailcode/Styler.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 {
25 25
     public const ERROR_CSS_FILE_NOT_FOUND = 60901;
26 26
     
27
-   /**
28
-    * @var string
29
-    */
27
+    /**
28
+     * @var string
29
+     */
30 30
     private $path;
31 31
     
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     private $fileName = 'highlight.css';
36 36
     
37 37
     public function __construct()
@@ -54,22 +54,22 @@  discard block
 block discarded – undo
54 54
         $this->path = $path;
55 55
     }
56 56
    
57
-   /**
58
-    * Retrieves the raw CSS source for the highlighting.
59
-    * 
60
-    * @return string
61
-    */
57
+    /**
58
+     * Retrieves the raw CSS source for the highlighting.
59
+     * 
60
+     * @return string
61
+     */
62 62
     public function getCSS() : string
63 63
     {
64 64
         return FileHelper::readContents($this->path);
65 65
     }
66 66
     
67
-   /**
68
-    * Retrieves a fully formed `code` tag with the CSS,
69
-    * to inject inline into an HTML document.
70
-    * 
71
-    * @return string
72
-    */
67
+    /**
68
+     * Retrieves a fully formed `code` tag with the CSS,
69
+     * to inject inline into an HTML document.
70
+     * 
71
+     * @return string
72
+     */
73 73
     public function getStyleTag() : string
74 74
     {
75 75
         return sprintf(
@@ -78,23 +78,23 @@  discard block
 block discarded – undo
78 78
         );
79 79
     }
80 80
     
81
-   /**
82
-    * Retrieves the path to the stylesheet file.
83
-    * 
84
-    * @return string
85
-    */
81
+    /**
82
+     * Retrieves the path to the stylesheet file.
83
+     * 
84
+     * @return string
85
+     */
86 86
     public function getStylesheetPath() : string
87 87
     {
88 88
         return $this->path;
89 89
     }
90 90
     
91
-   /**
92
-    * Retrieves the URL to the stylesheet file, given the
93
-    * local URL to the application's vendor folder.
94
-    *  
95
-    * @param string $vendorURL The URL to the vendor folder (must be accessible in the webroot).
96
-    * @return string
97
-    */
91
+    /**
92
+     * Retrieves the URL to the stylesheet file, given the
93
+     * local URL to the application's vendor folder.
94
+     *  
95
+     * @param string $vendorURL The URL to the vendor folder (must be accessible in the webroot).
96
+     * @return string
97
+     */
98 98
     public function getStylesheetURL(string $vendorURL) : string
99 99
     {
100 100
         return sprintf(
Please login to merge, or discard this patch.
src/Mailcode/Collection.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
     public const ERROR_CANNOT_RETRIEVE_FIRST_ERROR = 52301;
26 26
     public const ERROR_CANNOT_MODIFY_FINALIZED = 52302;
27 27
     
28
-   /**
29
-    * @var Mailcode_Commands_Command[]
30
-    */
28
+    /**
29
+     * @var Mailcode_Commands_Command[]
30
+     */
31 31
     protected $commands = array();
32 32
     
33 33
     /**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
      */
36 36
     protected $errors = array();
37 37
     
38
-   /**
39
-    * @var OperationResult|NULL
40
-    */
38
+    /**
39
+     * @var OperationResult|NULL
40
+     */
41 41
     protected $validationResult;
42 42
 
43 43
     /**
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
         return $this;
78 78
     }
79 79
     
80
-   /**
81
-    * Whether there are any commands in the collection.
82
-    * 
83
-    * @return bool
84
-    */
80
+    /**
81
+     * Whether there are any commands in the collection.
82
+     * 
83
+     * @return bool
84
+     */
85 85
     public function hasCommands() : bool
86 86
     {
87 87
         return !empty($this->commands);
88 88
     }
89 89
     
90
-   /**
91
-    * Counts the amount of commands in the collection.
92
-    * 
93
-    * @return int
94
-    */
90
+    /**
91
+     * Counts the amount of commands in the collection.
92
+     * 
93
+     * @return int
94
+     */
95 95
     public function countCommands() : int
96 96
     {
97 97
         return count($this->commands);
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
         $this->commands = $keep;
130 130
     }
131 131
     
132
-   /**
133
-    * @return Mailcode_Collection_Error[]
134
-    */
132
+    /**
133
+     * @return Mailcode_Collection_Error[]
134
+     */
135 135
     public function getErrors()
136 136
     {
137 137
         $result = $this->getValidationResult();
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
         return empty($errors);
174 174
     }
175 175
     
176
-   /**
177
-    * Retrieves all commands that were detected, in the exact order
178
-    * they were found.
179
-    * 
180
-    * @return Mailcode_Commands_Command[]
181
-    */
176
+    /**
177
+     * Retrieves all commands that were detected, in the exact order
178
+     * they were found.
179
+     * 
180
+     * @return Mailcode_Commands_Command[]
181
+     */
182 182
     public function getCommands()
183 183
     {
184 184
         $this->validate();
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
     }
330 330
 
331 331
     /**
332
-    * Retrieves only show variable commands in the collection, if any.
333
-    * 
334
-    * @return Mailcode_Commands_Command_ShowVariable[]
335
-    */
332
+     * Retrieves only show variable commands in the collection, if any.
333
+     * 
334
+     * @return Mailcode_Commands_Command_ShowVariable[]
335
+     */
336 336
     public function getShowVariableCommands(): array
337 337
     {
338 338
         return $this->getCommandsByClass(Mailcode_Commands_Command_ShowVariable::class);
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
         return $this->getCommandsByClass(Mailcode_Commands_Command_For::class);
347 347
     }
348 348
 
349
-   /**
350
-    * Retrieves only show date commands in the collection, if any.
351
-    *
352
-    * @return Mailcode_Commands_Command_ShowDate[]
353
-    */
349
+    /**
350
+     * Retrieves only show date commands in the collection, if any.
351
+     *
352
+     * @return Mailcode_Commands_Command_ShowDate[]
353
+     */
354 354
     public function getShowDateCommands() : array
355 355
     {
356 356
         return $this->getCommandsByClass(Mailcode_Commands_Command_ShowDate::class);
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
@@ -52,45 +52,45 @@  discard block
 block discarded – undo
52 52
     public const ERROR_INVALID_COMMANDS = 47801;
53 53
     public const ERROR_PLACEHOLDER_NOT_FOUND = 47804;
54 54
 
55
-   /**
56
-    * @var Mailcode_Parser
57
-    */
55
+    /**
56
+     * @var Mailcode_Parser
57
+     */
58 58
     protected $parser;
59 59
     
60
-   /**
61
-    * @var Mailcode_Collection
62
-    */
60
+    /**
61
+     * @var Mailcode_Collection
62
+     */
63 63
     protected $commands;
64 64
     
65
-   /**
66
-    * @var string
67
-    */
65
+    /**
66
+     * @var string
67
+     */
68 68
     protected $originalString;
69 69
     
70
-   /**
71
-    * @var Mailcode_Collection
72
-    */
70
+    /**
71
+     * @var Mailcode_Collection
72
+     */
73 73
     protected $collection;
74 74
     
75
-   /**
76
-    * Counter for the placeholders, global for all placeholders.
77
-    * @var integer
78
-    */
75
+    /**
76
+     * Counter for the placeholders, global for all placeholders.
77
+     * @var integer
78
+     */
79 79
     private static $counter = 0;
80 80
     
81
-   /**
82
-    * @var Mailcode_Parser_Safeguard_Placeholder[]
83
-    */
81
+    /**
82
+     * @var Mailcode_Parser_Safeguard_Placeholder[]
83
+     */
84 84
     protected $placeholders;
85 85
     
86
-   /**
87
-    * @var string
88
-    */
86
+    /**
87
+     * @var string
88
+     */
89 89
     protected $delimiter = '999';
90 90
     
91
-   /**
92
-    * @var string[]|NULL
93
-    */
91
+    /**
92
+     * @var string[]|NULL
93
+     */
94 94
     protected $placeholderStrings;
95 95
 
96 96
     public function __construct(Mailcode_Parser $parser, string $subject)
@@ -109,28 +109,28 @@  discard block
 block discarded – undo
109 109
         self::$counter = 0;
110 110
     }
111 111
     
112
-   /**
113
-    * Retrieves the string the safeguard was created for.
114
-    * 
115
-    * @return string
116
-    */
112
+    /**
113
+     * Retrieves the string the safeguard was created for.
114
+     * 
115
+     * @return string
116
+     */
117 117
     public function getOriginalString() : string
118 118
     {
119 119
         return $this->originalString;
120 120
     }
121 121
     
122
-   /**
123
-    * Sets the delimiter character sequence used to prepend
124
-    * and append to the placeholders.
125
-    * 
126
-    * The delimiter's default is "999".
127
-    *
128
-    * Minimum characters: 2
129
-    * Invalid characters: Any characters that get URL encoded
130
-    *
131
-    * @param string $delimiter
132
-    * @return Mailcode_Parser_Safeguard
133
-    */
122
+    /**
123
+     * Sets the delimiter character sequence used to prepend
124
+     * and append to the placeholders.
125
+     * 
126
+     * The delimiter's default is "999".
127
+     *
128
+     * Minimum characters: 2
129
+     * Invalid characters: Any characters that get URL encoded
130
+     *
131
+     * @param string $delimiter
132
+     * @return Mailcode_Parser_Safeguard
133
+     */
134 134
     public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard
135 135
     {
136 136
         $validator = new Mailcode_Parser_Safeguard_DelimiterValidator($delimiter);
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
         return $this->delimiter;
147 147
     }
148 148
     
149
-   /**
150
-    * Retrieves the safe string in which all commands have been replaced
151
-    * by placeholder strings.
152
-    *
153
-    * @return string
154
-    * @throws Mailcode_Exception 
155
-    *
156
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
157
-    */
149
+    /**
150
+     * Retrieves the safe string in which all commands have been replaced
151
+     * by placeholder strings.
152
+     *
153
+     * @return string
154
+     * @throws Mailcode_Exception 
155
+     *
156
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
157
+     */
158 158
     public function makeSafe() : string
159 159
     {
160 160
         $this->requireValidCollection();
@@ -162,16 +162,16 @@  discard block
 block discarded – undo
162 162
         return $this->makeSafePartial();
163 163
     }
164 164
     
165
-   /**
166
-    * Like makeSafe(), but allows partial (invalid) commands: use this
167
-    * if the subject string may contain only part of the whole set of
168
-    * commands. 
169
-    * 
170
-    * Example: parsing a text with an opening if statement, without the 
171
-    * matching end statement.
172
-    * 
173
-    * @return string
174
-    */
165
+    /**
166
+     * Like makeSafe(), but allows partial (invalid) commands: use this
167
+     * if the subject string may contain only part of the whole set of
168
+     * commands. 
169
+     * 
170
+     * Example: parsing a text with an opening if statement, without the 
171
+     * matching end statement.
172
+     * 
173
+     * @return string
174
+     */
175 175
     public function makeSafePartial() : string
176 176
     {
177 177
         $placeholders = $this->getPlaceholders();
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
         $analyzer->analyze();
256 256
     }
257 257
     
258
-   /**
259
-    * Creates a formatting handler, which can be used to specify
260
-    * which formattings to use for the commands in the subject string.
261
-    * 
262
-    * @param Mailcode_StringContainer|string $subject
263
-    * @return Mailcode_Parser_Safeguard_Formatting
264
-    */
258
+    /**
259
+     * Creates a formatting handler, which can be used to specify
260
+     * which formattings to use for the commands in the subject string.
261
+     * 
262
+     * @param Mailcode_StringContainer|string $subject
263
+     * @return Mailcode_Parser_Safeguard_Formatting
264
+     */
265 265
     public function createFormatting($subject) : Mailcode_Parser_Safeguard_Formatting
266 266
     {
267 267
         if(is_string($subject))
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
         return new Mailcode_Parser_Safeguard_Formatting($this, $subject);
273 273
     }
274 274
     
275
-   /**
276
-    * Retrieves all placeholders that have to be added to
277
-    * the subject text.
278
-    * 
279
-    * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[]
280
-    */
275
+    /**
276
+     * Retrieves all placeholders that have to be added to
277
+     * the subject text.
278
+     * 
279
+     * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[]
280
+     */
281 281
     public function getPlaceholders()
282 282
     {
283 283
         if(isset($this->placeholders))
@@ -353,16 +353,16 @@  discard block
 block discarded – undo
353 353
         return $string;
354 354
     }
355 355
     
356
-   /**
357
-    * Makes the string whole again after transforming or filtering it,
358
-    * by replacing the command placeholders with the original commands.
359
-    *
360
-    * @param string $string
361
-    * @return string
362
-    * @throws Mailcode_Exception
363
-    *
364
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
365
-    */
356
+    /**
357
+     * Makes the string whole again after transforming or filtering it,
358
+     * by replacing the command placeholders with the original commands.
359
+     *
360
+     * @param string $string
361
+     * @return string
362
+     * @throws Mailcode_Exception
363
+     *
364
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
365
+     */
366 366
     public function makeWhole(string $string) : string
367 367
     {
368 368
         return $this->restore(
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
         );
373 373
     }
374 374
     
375
-   /**
376
-    * Like `makeWhole()`, but ignores missing command placeholders.
377
-    *
378
-    * @param string $string
379
-    * @return string
380
-    * @throws Mailcode_Exception
381
-    *
382
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
383
-    */
375
+    /**
376
+     * Like `makeWhole()`, but ignores missing command placeholders.
377
+     *
378
+     * @param string $string
379
+     * @return string
380
+     * @throws Mailcode_Exception
381
+     *
382
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
383
+     */
384 384
     public function makeWholePartial(string $string) : string
385 385
     {
386 386
         return $this->restore(
@@ -390,19 +390,19 @@  discard block
 block discarded – undo
390 390
         );
391 391
     }
392 392
 
393
-   /**
394
-    * Like `makeWhole()`, but replaces the commands with a syntax
395
-    * highlighted version, meant for human readable texts only.
396
-    * 
397
-    * Note: the commands lose their functionality (They cannot be 
398
-    * parsed from that string again).
399
-    *
400
-    * @param string $string
401
-    * @return string
402
-    * @throws Mailcode_Exception
403
-    *
404
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
405
-    */
393
+    /**
394
+     * Like `makeWhole()`, but replaces the commands with a syntax
395
+     * highlighted version, meant for human readable texts only.
396
+     * 
397
+     * Note: the commands lose their functionality (They cannot be 
398
+     * parsed from that string again).
399
+     *
400
+     * @param string $string
401
+     * @return string
402
+     * @throws Mailcode_Exception
403
+     *
404
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
405
+     */
406 406
     public function makeHighlighted(string $string) : string
407 407
     {
408 408
         return $this->restore(
@@ -412,15 +412,15 @@  discard block
 block discarded – undo
412 412
         );
413 413
     }
414 414
     
415
-   /**
416
-    * Like `makeHighlighted()`, but ignores missing command placeholders.
417
-    * 
418
-    * @param string $string
419
-    * @return string
420
-    * @throws Mailcode_Exception
421
-    *
422
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
423
-    */
415
+    /**
416
+     * Like `makeHighlighted()`, but ignores missing command placeholders.
417
+     * 
418
+     * @param string $string
419
+     * @return string
420
+     * @throws Mailcode_Exception
421
+     *
422
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
423
+     */
424 424
     public function makeHighlightedPartial(string $string) : string
425 425
     {
426 426
         return $this->restore(
@@ -430,11 +430,11 @@  discard block
 block discarded – undo
430 430
         );
431 431
     }
432 432
     
433
-   /**
434
-    * Retrieves the commands collection contained in the string.
435
-    * 
436
-    * @return Mailcode_Collection
437
-    */
433
+    /**
434
+     * Retrieves the commands collection contained in the string.
435
+     * 
436
+     * @return Mailcode_Collection
437
+     */
438 438
     public function getCollection() : Mailcode_Collection
439 439
     {
440 440
         if(isset($this->collection))
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
         return $this->getCollection()->isValid();
453 453
     }
454 454
     
455
-   /**
456
-    * @throws Mailcode_Exception
457
-    * 
458
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
459
-    */
455
+    /**
456
+     * @throws Mailcode_Exception
457
+     * 
458
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
459
+     */
460 460
     protected function requireValidCollection() : void
461 461
     {
462 462
         if($this->getCollection()->isValid())
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
         throw $exception;
480 480
     }
481 481
     
482
-   /**
483
-    * Retrieves a list of all placeholder IDs used in the text.
484
-    * 
485
-    * @return string[]
486
-    */
482
+    /**
483
+     * Retrieves a list of all placeholder IDs used in the text.
484
+     * 
485
+     * @return string[]
486
+     */
487 487
     public function getPlaceholderStrings() : array
488 488
     {
489 489
         if(is_array($this->placeholderStrings))
@@ -510,13 +510,13 @@  discard block
 block discarded – undo
510 510
         return in_array($subject, $ids, true);
511 511
     }
512 512
     
513
-   /**
514
-    * Retrieves a placeholder instance by its ID.
515
-    * 
516
-    * @param int $id
517
-    * @throws Mailcode_Exception If the placeholder was not found.
518
-    * @return Mailcode_Parser_Safeguard_Placeholder
519
-    */
513
+    /**
514
+     * Retrieves a placeholder instance by its ID.
515
+     * 
516
+     * @param int $id
517
+     * @throws Mailcode_Exception If the placeholder was not found.
518
+     * @return Mailcode_Parser_Safeguard_Placeholder
519
+     */
520 520
     public function getPlaceholderByID(int $id) : Mailcode_Parser_Safeguard_Placeholder
521 521
     {
522 522
         $placeholders = $this->getPlaceholders();
@@ -539,13 +539,13 @@  discard block
 block discarded – undo
539 539
         );
540 540
     }
541 541
     
542
-   /**
543
-    * Retrieves a placeholder instance by its replacement text.
544
-    * 
545
-    * @param string $string
546
-    * @throws Mailcode_Exception
547
-    * @return Mailcode_Parser_Safeguard_Placeholder
548
-    */
542
+    /**
543
+     * Retrieves a placeholder instance by its replacement text.
544
+     * 
545
+     * @param string $string
546
+     * @throws Mailcode_Exception
547
+     * @return Mailcode_Parser_Safeguard_Placeholder
548
+     */
549 549
     public function getPlaceholderByString(string $string) : Mailcode_Parser_Safeguard_Placeholder
550 550
     {
551 551
         $placeholders = $this->getPlaceholders();
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
     public const VALIDATION_EMPTY = 48801;
27 27
     public const VALIDATION_UNQUOTED_STRING_LITERALS = 48802;
28 28
     
29
-   /**
30
-    * @var string
31
-    */
29
+    /**
30
+     * @var string
31
+     */
32 32
     protected $statement;
33 33
     
34
-   /**
35
-    * @var OperationResult
36
-    */
34
+    /**
35
+     * @var OperationResult
36
+     */
37 37
     protected $result;
38 38
     
39
-   /**
40
-    * @var Mailcode_Parser_Statement_Tokenizer
41
-    */
39
+    /**
40
+     * @var Mailcode_Parser_Statement_Tokenizer
41
+     */
42 42
     protected $tokenizer;
43 43
     
44
-   /**
45
-    * @var Mailcode_Parser_Statement_Info|NULL
46
-    */
44
+    /**
45
+     * @var Mailcode_Parser_Statement_Info|NULL
46
+     */
47 47
     protected $info;
48 48
 
49 49
     /**
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         if($unknown)
124 124
         {
125 125
             $this->result->makeError(
126
-               t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
126
+                t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
127 127
                 self::VALIDATION_UNQUOTED_STRING_LITERALS
128 128
             );
129 129
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatting.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -32,29 +32,29 @@  discard block
 block discarded – undo
32 32
     public const ERROR_TOO_MANY_REPLACERS = 65902;
33 33
     public const ERROR_NO_FORMATTERS_ADDED = 65903;
34 34
     
35
-   /**
36
-    * @var Mailcode_Parser_Safeguard
37
-    */
35
+    /**
36
+     * @var Mailcode_Parser_Safeguard
37
+     */
38 38
     private $safeguard;
39 39
     
40
-   /**
41
-    * @var Mailcode_Parser_Safeguard_Formatter[]
42
-    */
40
+    /**
41
+     * @var Mailcode_Parser_Safeguard_Formatter[]
42
+     */
43 43
     private $formatters = array();
44 44
     
45
-   /**
46
-    * @var Mailcode_StringContainer
47
-    */
45
+    /**
46
+     * @var Mailcode_StringContainer
47
+     */
48 48
     private $subject;
49 49
     
50
-   /**
51
-    * @var boolean
52
-    */
50
+    /**
51
+     * @var boolean
52
+     */
53 53
     private $applied = false;
54 54
     
55
-   /**
56
-    * @var boolean
57
-    */
55
+    /**
56
+     * @var boolean
57
+     */
58 58
     private $partial = false;
59 59
     
60 60
     public function __construct(Mailcode_Parser_Safeguard $safeguard, Mailcode_StringContainer $subject)
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
         return $formatter;
97 97
     }
98 98
     
99
-   /**
100
-    * Adds a formatter that will surround all variables with
101
-    * markup to highlight them independently of command syntax
102
-    * highlighting.
103
-    * 
104
-    * This is used to mark variables visually even after commands
105
-    * have been replaced by the target system's post processing.
106
-    * Can be combined with a replacer and other formats.
107
-    * 
108
-    * @return Mailcode_Parser_Safeguard_Formatter_Type_MarkVariables
109
-    */
99
+    /**
100
+     * Adds a formatter that will surround all variables with
101
+     * markup to highlight them independently of command syntax
102
+     * highlighting.
103
+     * 
104
+     * This is used to mark variables visually even after commands
105
+     * have been replaced by the target system's post processing.
106
+     * Can be combined with a replacer and other formats.
107
+     * 
108
+     * @return Mailcode_Parser_Safeguard_Formatter_Type_MarkVariables
109
+     */
110 110
     public function formatWithMarkedVariables() : Mailcode_Parser_Safeguard_Formatter_Type_MarkVariables
111 111
     {
112 112
         $formatter = $this->createMarkVariables();
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
         }
201 201
     }
202 202
     
203
-   /**
204
-    * Counts the amount of replacer formatters that have been added.
205
-    * 
206
-    * @return int
207
-    */
203
+    /**
204
+     * Counts the amount of replacer formatters that have been added.
205
+     * 
206
+     * @return int
207
+     */
208 208
     private function countReplacers() : int
209 209
     {
210 210
         $count = 0;
@@ -220,37 +220,37 @@  discard block
 block discarded – undo
220 220
         return $count;
221 221
     }
222 222
 
223
-   /**
224
-    * Creates a formatter that adds HTML syntax highlighting
225
-    * for all commands in the specified string, intelligently
226
-    * checking the location of the commands to ensure that they
227
-    * can be syntax highlighted.
228
-    * 
229
-    * For example, commands in HTML attributes will not be
230
-    * highlighted, as this would break the HTML.
231
-    *  
232
-    * @return Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting
233
-    */
223
+    /**
224
+     * Creates a formatter that adds HTML syntax highlighting
225
+     * for all commands in the specified string, intelligently
226
+     * checking the location of the commands to ensure that they
227
+     * can be syntax highlighted.
228
+     * 
229
+     * For example, commands in HTML attributes will not be
230
+     * highlighted, as this would break the HTML.
231
+     *  
232
+     * @return Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting
233
+     */
234 234
     public function createHTMLHighlighting() : Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting
235 235
     {
236 236
         return new Mailcode_Parser_Safeguard_Formatter_Type_HTMLHighlighting($this);
237 237
     }
238 238
 
239
-   /**
240
-    * Creates the formatter that ensures that all commands
241
-    * are placed on a separate line in the subject string.
242
-    */
239
+    /**
240
+     * Creates the formatter that ensures that all commands
241
+     * are placed on a separate line in the subject string.
242
+     */
243 243
     public function createSingleLines() : Mailcode_Parser_Safeguard_Formatter_Type_SingleLines
244 244
     {
245 245
         return new Mailcode_Parser_Safeguard_Formatter_Type_SingleLines($this);
246 246
     }
247 247
     
248
-   /**
249
-    * Creates the formatter that replaces all commands by
250
-    * their normalized variants.
251
-    * 
252
-    * @return Mailcode_Parser_Safeguard_Formatter_Type_Normalized
253
-    */
248
+    /**
249
+     * Creates the formatter that replaces all commands by
250
+     * their normalized variants.
251
+     * 
252
+     * @return Mailcode_Parser_Safeguard_Formatter_Type_Normalized
253
+     */
254 254
     public function createNormalized() : Mailcode_Parser_Safeguard_Formatter_Type_Normalized
255 255
     {
256 256
         return new Mailcode_Parser_Safeguard_Formatter_Type_Normalized($this);
@@ -278,26 +278,26 @@  discard block
 block discarded – undo
278 278
         return $this->subject->getString();
279 279
     }
280 280
 
281
-   /**
282
-    * Whether the formatting is done partially: missing placeholders
283
-    * will simply be ignored.
284
-    * 
285
-    * @return bool
286
-    */
281
+    /**
282
+     * Whether the formatting is done partially: missing placeholders
283
+     * will simply be ignored.
284
+     * 
285
+     * @return bool
286
+     */
287 287
     public function isPartial() : bool
288 288
     {
289 289
         return $this->partial;
290 290
     }
291 291
     
292
-   /**
293
-    * The formatting will ignore missing placeholders. Use this if the
294
-    * formatting will be done on a text that may not contain all of the
295
-    * initial placeholders anymore.
296
-    * 
297
-    * This is like the safeguard's makeWholePartial() method.
298
-    * 
299
-    * @return Mailcode_Parser_Safeguard_Formatting
300
-    */
292
+    /**
293
+     * The formatting will ignore missing placeholders. Use this if the
294
+     * formatting will be done on a text that may not contain all of the
295
+     * initial placeholders anymore.
296
+     * 
297
+     * This is like the safeguard's makeWholePartial() method.
298
+     * 
299
+     * @return Mailcode_Parser_Safeguard_Formatting
300
+     */
301 301
     public function makePartial() : Mailcode_Parser_Safeguard_Formatting
302 302
     {
303 303
         $this->partial = true;
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
     public 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)
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
         );
99 99
     }
100 100
     
101
-   /**
102
-    * Retrieves all formatter-specific placeholder locations 
103
-    * in the subject string.
104
-    * 
105
-    * @return Mailcode_Parser_Safeguard_Formatter_Location[]
106
-    */
101
+    /**
102
+     * Retrieves all formatter-specific placeholder locations 
103
+     * in the subject string.
104
+     * 
105
+     * @return Mailcode_Parser_Safeguard_Formatter_Location[]
106
+     */
107 107
     protected function resolveLocations() : array
108 108
     {
109 109
         $placeholders = $this->formatting->getSafeguard()->getPlaceholders();
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
         return $result;
119 119
     }
120 120
     
121
-   /**
122
-    * Resolves the newline character used in the string.
123
-    * 
124
-    * @param string $subject
125
-    * @return string
126
-    */
121
+    /**
122
+     * Resolves the newline character used in the string.
123
+     * 
124
+     * @param string $subject
125
+     * @return string
126
+     */
127 127
     protected function resolveNewlineChar(string $subject) : string
128 128
     {
129 129
         $eol = ConvertHelper::detectEOLCharacter($subject);
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
         );
156 156
     }
157 157
  
158
-   /**
159
-    * @return string[]
160
-    */
158
+    /**
159
+     * @return string[]
160
+     */
161 161
     public function getLog() : array
162 162
     {
163 163
         return $this->log;
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
     public 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();
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
         );
197 197
     }
198 198
     
199
-   /**
200
-    * Retrieves the location's log messages, if any.
201
-    * @return string[]
202
-    */
199
+    /**
200
+     * Retrieves the location's log messages, if any.
201
+     * @return string[]
202
+     */
203 203
     public function getLog() : array
204 204
     {
205 205
         return $this->log;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard/Formatter/Type/HTMLHighlighting/Location.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 {
25 25
     public const COMMAND_MARKER = '__MAILCODE_COMMAND__';
26 26
     
27
-   /**
28
-    * @var boolean
29
-    */
27
+    /**
28
+     * @var boolean
29
+     */
30 30
     private $ancestryChecked = false;
31 31
     
32
-   /**
33
-    * @var array<int,array<int,string>>
34
-    */
32
+    /**
33
+     * @var array<int,array<int,string>>
34
+     */
35 35
     private $tagAncestry = array();
36 36
     
37 37
     protected function init() : void
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
         return !$this->isInTagAttributes() && !$this->isInExcludedTag();
44 44
     }
45 45
     
46
-   /**
47
-    * Retrieves the part of the subject string that comes
48
-    * before the command.
49
-    * 
50
-    * @return string
51
-    */
46
+    /**
47
+     * Retrieves the part of the subject string that comes
48
+     * before the command.
49
+     * 
50
+     * @return string
51
+     */
52 52
     private function getHaystackBefore() : string
53 53
     {
54 54
         $pos = $this->getStartPosition();
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
         return $this->subject->getSubstr(0, $pos).self::COMMAND_MARKER.'>';
66 66
     }
67 67
     
68
-   /**
69
-    * Whether the command is nested in one of the tags
70
-    * that have been added to the list of excluded tags.
71
-    * 
72
-    * @return bool
73
-    */
68
+    /**
69
+     * Whether the command is nested in one of the tags
70
+     * that have been added to the list of excluded tags.
71
+     * 
72
+     * @return bool
73
+     */
74 74
     protected function isInExcludedTag() : bool
75 75
     {
76 76
         $tagNames = $this->getParentTags();
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
         return false;
87 87
     }
88 88
     
89
-   /**
90
-    * Retrieves a list of the command's parent HTML tags, from
91
-    * highest to lowest.
92
-    * 
93
-    * @return string[]
94
-    */
89
+    /**
90
+     * Retrieves a list of the command's parent HTML tags, from
91
+     * highest to lowest.
92
+     * 
93
+     * @return string[]
94
+     */
95 95
     private function getParentTags() : array
96 96
     {
97 97
         $tags = $this->getTagAncestry();
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
         return $stack;
117 117
     }
118 118
     
119
-   /**
120
-    * Checks whether the command is located within the attributes
121
-    * of an HTML tag.
122
-    * 
123
-    * @return bool
124
-    */
119
+    /**
120
+     * Checks whether the command is located within the attributes
121
+     * of an HTML tag.
122
+     * 
123
+     * @return bool
124
+     */
125 125
     protected function isInTagAttributes() : bool
126 126
     {
127 127
         $tags = $this->getTagAncestry();
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
         return false;
140 140
     }
141 141
     
142
-   /**
143
-    * Retrieves a list of tag names that come as parents 
144
-    * above the command.
145
-    * 
146
-    * @return array<int,array<int,string>>
147
-    */
142
+    /**
143
+     * Retrieves a list of tag names that come as parents 
144
+     * above the command.
145
+     * 
146
+     * @return array<int,array<int,string>>
147
+     */
148 148
     private function getTagAncestry() : array
149 149
     {
150 150
         if($this->ancestryChecked)
Please login to merge, or discard this patch.