Passed
Push — master ( 689687...b6ef8f )
by Sebastian
02:28
created
src/Mailcode/Parser/Statement.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,24 +29,24 @@  discard block
 block discarded – undo
29 29
     
30 30
     const VALIDATION_UNQUOTED_STRING_LITERALS = 48802;
31 31
     
32
-   /**
33
-    * @var string
34
-    */
32
+    /**
33
+     * @var string
34
+     */
35 35
     protected $statement;
36 36
     
37
-   /**
38
-    * @var OperationResult
39
-    */
37
+    /**
38
+     * @var OperationResult
39
+     */
40 40
     protected $result;
41 41
     
42
-   /**
43
-    * @var Mailcode_Parser_Statement_Tokenizer
44
-    */
42
+    /**
43
+     * @var Mailcode_Parser_Statement_Tokenizer
44
+     */
45 45
     protected $tokenizer;
46 46
     
47
-   /**
48
-    * @var Mailcode_Parser_Statement_Info|NULL
49
-    */
47
+    /**
48
+     * @var Mailcode_Parser_Statement_Info|NULL
49
+     */
50 50
     protected $info;
51 51
     
52 52
     public function __construct(string $statement)
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         if($unknown)
103 103
         {
104 104
             $this->result->makeError(
105
-               t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
105
+                t('Unquoted string literal found:').' ('.htmlspecialchars($unknown->getMatchedText()).')',
106 106
                 self::VALIDATION_UNQUOTED_STRING_LITERALS
107 107
             );
108 108
         }
Please login to merge, or discard this patch.
src/Mailcode/Parser/Safeguard.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -61,50 +61,50 @@  discard block
 block discarded – undo
61 61
     
62 62
     const ERROR_NOT_A_SINGLE_LINES_FORMATTER = 47806;
63 63
     
64
-   /**
65
-    * @var Mailcode_Parser
66
-    */
64
+    /**
65
+     * @var Mailcode_Parser
66
+     */
67 67
     protected $parser;
68 68
     
69
-   /**
70
-    * @var Mailcode_Collection
71
-    */
69
+    /**
70
+     * @var Mailcode_Collection
71
+     */
72 72
     protected $commands;
73 73
     
74
-   /**
75
-    * @var string
76
-    */
74
+    /**
75
+     * @var string
76
+     */
77 77
     protected $originalString;
78 78
     
79
-   /**
80
-    * @var Mailcode_Collection
81
-    */
79
+    /**
80
+     * @var Mailcode_Collection
81
+     */
82 82
     protected $collection;
83 83
     
84
-   /**
85
-    * Counter for the placeholders, global for all placeholders.
86
-    * @var integer
87
-    */
84
+    /**
85
+     * Counter for the placeholders, global for all placeholders.
86
+     * @var integer
87
+     */
88 88
     private static $counter = 0;
89 89
     
90
-   /**
91
-    * @var Mailcode_Parser_Safeguard_Placeholder[]
92
-    */
90
+    /**
91
+     * @var Mailcode_Parser_Safeguard_Placeholder[]
92
+     */
93 93
     protected $placeholders;
94 94
     
95
-   /**
96
-    * @var string
97
-    */
95
+    /**
96
+     * @var string
97
+     */
98 98
     protected $delimiter = '__';
99 99
     
100
-   /**
101
-    * @var string[]|NULL
102
-    */
100
+    /**
101
+     * @var string[]|NULL
102
+     */
103 103
     protected $placeholderStrings;
104 104
     
105
-   /**
106
-    * @var Mailcode_Parser_Safeguard_Formatter
107
-    */
105
+    /**
106
+     * @var Mailcode_Parser_Safeguard_Formatter
107
+     */
108 108
     protected $formatter;
109 109
     
110 110
     public function __construct(Mailcode_Parser $parser, string $subject)
@@ -113,25 +113,25 @@  discard block
 block discarded – undo
113 113
         $this->originalString = $subject;
114 114
     }
115 115
     
116
-   /**
117
-    * Retrieves the string the safeguard was created for.
118
-    * 
119
-    * @return string
120
-    */
116
+    /**
117
+     * Retrieves the string the safeguard was created for.
118
+     * 
119
+     * @return string
120
+     */
121 121
     public function getOriginalString() : string
122 122
     {
123 123
         return $this->originalString;
124 124
     }
125 125
     
126
-   /**
127
-    * Sets the delimiter character sequence used to prepend
128
-    * and append to the placeholders.
129
-    * 
130
-    * The delimiter's default is "__" (two underscores).
131
-    * 
132
-    * @param string $delimiter
133
-    * @return Mailcode_Parser_Safeguard
134
-    */
126
+    /**
127
+     * Sets the delimiter character sequence used to prepend
128
+     * and append to the placeholders.
129
+     * 
130
+     * The delimiter's default is "__" (two underscores).
131
+     * 
132
+     * @param string $delimiter
133
+     * @return Mailcode_Parser_Safeguard
134
+     */
135 135
     public function setDelimiter(string $delimiter) : Mailcode_Parser_Safeguard
136 136
     {
137 137
         if(empty($delimiter))
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
         return $this->delimiter;
154 154
     }
155 155
     
156
-   /**
157
-    * Retrieves the safe string in which all commands have been replaced
158
-    * by placeholder strings.
159
-    *
160
-    * @return string
161
-    * @throws Mailcode_Exception 
162
-    *
163
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
164
-    */
156
+    /**
157
+     * Retrieves the safe string in which all commands have been replaced
158
+     * by placeholder strings.
159
+     *
160
+     * @return string
161
+     * @throws Mailcode_Exception 
162
+     *
163
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
164
+     */
165 165
     public function makeSafe() : string
166 166
     {
167 167
         $this->requireValidCollection();
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
         );
202 202
     }
203 203
     
204
-   /**
205
-    * Enables the formatter that ensures that all commands that
206
-    * @return Mailcode_Parser_Safeguard_Formatter_SingleLines
207
-    */
204
+    /**
205
+     * Enables the formatter that ensures that all commands that
206
+     * @return Mailcode_Parser_Safeguard_Formatter_SingleLines
207
+     */
208 208
     public function selectSingleLinesFormatter() : Mailcode_Parser_Safeguard_Formatter_SingleLines
209 209
     {
210 210
         $formatter = $this->selectFormatter('SingleLines');
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
         );
225 225
     }
226 226
     
227
-   /**
228
-    * Retrieves an associative array with pairs of
229
-    * [placeholder string => replacement text]. 
230
-    * 
231
-    * @param bool $highlighted
232
-    * @return string[]string
233
-    */
227
+    /**
228
+     * Retrieves an associative array with pairs of
229
+     * [placeholder string => replacement text]. 
230
+     * 
231
+     * @param bool $highlighted
232
+     * @return string[]string
233
+     */
234 234
     protected function getReplaces(bool $highlighted=false) : array
235 235
     {
236 236
         $placeholders = $this->getPlaceholders();
@@ -257,12 +257,12 @@  discard block
 block discarded – undo
257 257
     }
258 258
     
259 259
     
260
-   /**
261
-    * Retrieves all placeholders that have to be added to
262
-    * the subject text.
263
-    * 
264
-    * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[]
265
-    */
260
+    /**
261
+     * Retrieves all placeholders that have to be added to
262
+     * the subject text.
263
+     * 
264
+     * @return \Mailcode\Mailcode_Parser_Safeguard_Placeholder[]
265
+     */
266 266
     public function getPlaceholders()
267 267
     {
268 268
         if(isset($this->placeholders))
@@ -314,46 +314,46 @@  discard block
 block discarded – undo
314 314
         return str_replace($placeholderStrings, array_values($replaces), $string);
315 315
     }
316 316
     
317
-   /**
318
-    * Makes the string whole again after transforming or filtering it,
319
-    * by replacing the command placeholders with the original commands.
320
-    *
321
-    * @param string $string
322
-    * @return string
323
-    * @throws Mailcode_Exception
324
-    *
325
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
326
-    * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING
327
-    */
317
+    /**
318
+     * Makes the string whole again after transforming or filtering it,
319
+     * by replacing the command placeholders with the original commands.
320
+     *
321
+     * @param string $string
322
+     * @return string
323
+     * @throws Mailcode_Exception
324
+     *
325
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
326
+     * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING
327
+     */
328 328
     public function makeWhole(string $string) : string
329 329
     {
330 330
         return $this->restore($string, false);
331 331
     }
332 332
 
333
-   /**
334
-    * Like makeWhole(), but replaces the commands with a syntax
335
-    * highlighted version, meant for human readable texts only.
336
-    * 
337
-    * Note: the commands lose their functionality (They cannot be 
338
-    * parsed from that string again).
339
-    *
340
-    * @param string $string
341
-    * @return string
342
-    * @throws Mailcode_Exception
343
-    *
344
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
345
-    * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING
346
-    */
333
+    /**
334
+     * Like makeWhole(), but replaces the commands with a syntax
335
+     * highlighted version, meant for human readable texts only.
336
+     * 
337
+     * Note: the commands lose their functionality (They cannot be 
338
+     * parsed from that string again).
339
+     *
340
+     * @param string $string
341
+     * @return string
342
+     * @throws Mailcode_Exception
343
+     *
344
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
345
+     * @see Mailcode_Parser_Safeguard::ERROR_COMMAND_PLACEHOLDER_MISSING
346
+     */
347 347
     public function makeHighlighted(string $string) : string
348 348
     {
349 349
         return $this->restore($string, true);
350 350
     }
351 351
     
352
-   /**
353
-    * Retrieves the commands collection contained in the string.
354
-    * 
355
-    * @return Mailcode_Collection
356
-    */
352
+    /**
353
+     * Retrieves the commands collection contained in the string.
354
+     * 
355
+     * @return Mailcode_Collection
356
+     */
357 357
     public function getCollection() : Mailcode_Collection
358 358
     {
359 359
         if(isset($this->collection))
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
         return $this->getCollection()->isValid();
372 372
     }
373 373
     
374
-   /**
375
-    * @throws Mailcode_Exception
376
-    * 
377
-    * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
378
-    */
374
+    /**
375
+     * @throws Mailcode_Exception
376
+     * 
377
+     * @see Mailcode_Parser_Safeguard::ERROR_INVALID_COMMANDS
378
+     */
379 379
     protected function requireValidCollection() : void
380 380
     {
381 381
         if($this->getCollection()->isValid())
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
         );
395 395
     }
396 396
     
397
-   /**
398
-    * Retrieves a list of all placeholder IDs used in the text.
399
-    * 
400
-    * @return string[]
401
-    */
397
+    /**
398
+     * Retrieves a list of all placeholder IDs used in the text.
399
+     * 
400
+     * @return string[]
401
+     */
402 402
     public function getPlaceholderStrings() : array
403 403
     {
404 404
         if(is_array($this->placeholderStrings))
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
         return in_array($subject, $ids);
426 426
     }
427 427
     
428
-   /**
429
-    * Retrieves a placeholder instance by its ID.
430
-    * 
431
-    * @param int $id
432
-    * @throws Mailcode_Exception If the placeholder was not found.
433
-    * @return Mailcode_Parser_Safeguard_Placeholder
434
-    */
428
+    /**
429
+     * Retrieves a placeholder instance by its ID.
430
+     * 
431
+     * @param int $id
432
+     * @throws Mailcode_Exception If the placeholder was not found.
433
+     * @return Mailcode_Parser_Safeguard_Placeholder
434
+     */
435 435
     public function getPlaceholderByID(int $id) : Mailcode_Parser_Safeguard_Placeholder
436 436
     {
437 437
         $placeholders = $this->getPlaceholders();
@@ -454,13 +454,13 @@  discard block
 block discarded – undo
454 454
         );
455 455
     }
456 456
     
457
-   /**
458
-    * Retrieves a placeholder instance by its replacement text.
459
-    * 
460
-    * @param string $string
461
-    * @throws Mailcode_Exception
462
-    * @return Mailcode_Parser_Safeguard_Placeholder
463
-    */
457
+    /**
458
+     * Retrieves a placeholder instance by its replacement text.
459
+     * 
460
+     * @param string $string
461
+     * @throws Mailcode_Exception
462
+     * @return Mailcode_Parser_Safeguard_Placeholder
463
+     */
464 464
     public function getPlaceholderByString(string $string) : Mailcode_Parser_Safeguard_Placeholder
465 465
     {
466 466
         $placeholders = $this->getPlaceholders();
Please login to merge, or discard this patch.
src/Mailcode/Commands.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
     
28 28
     const ERROR_INVALID_DUMMY_COMMAND_TYPE = 45903;
29 29
     
30
-   /**
31
-    * @var Mailcode_Commands_Command[]
32
-    */
30
+    /**
31
+     * @var Mailcode_Commands_Command[]
32
+     */
33 33
     private $commands = array();
34 34
     
35
-   /**
36
-    * @var string[]Mailcode_Commands_Command
37
-    */
35
+    /**
36
+     * @var string[]Mailcode_Commands_Command
37
+     */
38 38
     private static $dummyCommands = array();
39 39
     
40
-   /**
41
-    * Retrieves a list of all available command IDs.
42
-    * 
43
-    * @return string[]
44
-    */
40
+    /**
41
+     * Retrieves a list of all available command IDs.
42
+     * 
43
+     * @return string[]
44
+     */
45 45
     public function getIDs() : array
46 46
     {
47 47
         static $ids = array();
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
         return $ids;
55 55
     }
56 56
     
57
-   /**
58
-    * Retrieves a list of all available commands, sorted by label.
59
-    * 
60
-    * NOTE: These instances are only used for information purposes.
61
-    * 
62
-    * @return Mailcode_Commands_Command[]
63
-    */
57
+    /**
58
+     * Retrieves a list of all available commands, sorted by label.
59
+     * 
60
+     * NOTE: These instances are only used for information purposes.
61
+     * 
62
+     * @return Mailcode_Commands_Command[]
63
+     */
64 64
     public function getAll()
65 65
     {
66 66
         if(!empty($this->commands)) {
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
         return $result;
87 87
     }
88 88
     
89
-   /**
90
-    * Gets an available command by its ID.
91
-    * 
92
-    * @param string $id
93
-    * @return Mailcode_Commands_Command
94
-    */
89
+    /**
90
+     * Gets an available command by its ID.
91
+     * 
92
+     * @param string $id
93
+     * @return Mailcode_Commands_Command
94
+     */
95 95
     public function getByID(string $id) : Mailcode_Commands_Command
96 96
     {
97 97
         static $instances = array();
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
         return $instances[$id];
105 105
     }
106 106
     
107
-   /**
108
-    * Retrieves the ID of a command by its name.
109
-    * 
110
-    * @param string $name
111
-    * @throws Mailcode_Exception
112
-    * @return string
113
-    * 
114
-    * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST
115
-    */
107
+    /**
108
+     * Retrieves the ID of a command by its name.
109
+     * 
110
+     * @param string $name
111
+     * @throws Mailcode_Exception
112
+     * @return string
113
+     * 
114
+     * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST
115
+     */
116 116
     public function getIDByName(string $name) : string
117 117
     {
118 118
         $items = $this->getAll();
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
         return in_array($id, $ids);
142 142
     }
143 143
     
144
-   /**
145
-    * Checks wether the specified name exists.
146
-    * 
147
-    * @param string $name For example: "showvar".
148
-    * @return bool
149
-    */
144
+    /**
145
+     * Checks wether the specified name exists.
146
+     * 
147
+     * @param string $name For example: "showvar".
148
+     * @return bool
149
+     */
150 150
     public function nameExists(string $name) : bool
151 151
     {
152 152
         $items = $this->getAll();
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
         return $class;
201 201
     }
202 202
     
203
-   /**
204
-    * Retrieves the dummy command of the specified type, which
205
-    * is used to retrieve information on the command's capabilities.
206
-    *  
207
-    * @param string $id
208
-    * @return Mailcode_Commands_Command
209
-    */
203
+    /**
204
+     * Retrieves the dummy command of the specified type, which
205
+     * is used to retrieve information on the command's capabilities.
206
+     *  
207
+     * @param string $id
208
+     * @return Mailcode_Commands_Command
209
+     */
210 210
     private function getDummyCommand(string $id) : Mailcode_Commands_Command
211 211
     {
212 212
         if(!isset(self::$dummyCommands[$id]))
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/IfVariable.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
  */
24 24
 trait Mailcode_Traits_Commands_IfVariable
25 25
 {
26
-   /**
27
-    * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL
28
-    */
26
+    /**
27
+     * @var Mailcode_Parser_Statement_Tokenizer_Token_Variable|NULL
28
+     */
29 29
     protected $variableToken;
30 30
     
31
-   /**
32
-    * @var Mailcode_Parser_Statement_Tokenizer_Token_Operand|NULL
33
-    */
31
+    /**
32
+     * @var Mailcode_Parser_Statement_Tokenizer_Token_Operand|NULL
33
+     */
34 34
     protected $comparisonToken;
35 35
     
36
-   /**
37
-    * @var Mailcode_Parser_Statement_Tokenizer_Type_Value|NULL
38
-    */
36
+    /**
37
+     * @var Mailcode_Parser_Statement_Tokenizer_Type_Value|NULL
38
+     */
39 39
     protected $valueToken;
40 40
     
41 41
     protected function getValidations() : array
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
         );
124 124
     }
125 125
     
126
-   /**
127
-    * Retrieves the variable being compared.
128
-    *
129
-    * @return Mailcode_Variables_Variable
130
-    */
126
+    /**
127
+     * Retrieves the variable being compared.
128
+     *
129
+     * @return Mailcode_Variables_Variable
130
+     */
131 131
     public function getVariable() : Mailcode_Variables_Variable
132 132
     {
133 133
         if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
         );
143 143
     }
144 144
     
145
-   /**
146
-    * Retrieves the comparison operator sign.
147
-    * 
148
-    * @throws Mailcode_Exception
149
-    * @return string The comparison string, e.g. "==", "!=", etc.
150
-    */
145
+    /**
146
+     * Retrieves the comparison operator sign.
147
+     * 
148
+     * @throws Mailcode_Exception
149
+     * @return string The comparison string, e.g. "==", "!=", etc.
150
+     */
151 151
     public function getComparator() : string
152 152
     {
153 153
         if($this->comparisonToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Operand)
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
         );
163 163
     }
164 164
     
165
-   /**
166
-    * Retrieves the unquoted value 
167
-    * @return string
168
-    */
165
+    /**
166
+     * Retrieves the unquoted value 
167
+     * @return string
168
+     */
169 169
     public function getValue() : string
170 170
     {
171 171
         if($this->valueToken instanceof Mailcode_Parser_Statement_Tokenizer_Type_Value)
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/IfContains.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
      */
29 29
     protected $variableToken;
30 30
 
31
-   /**
32
-    * @var Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral|NULL
33
-    */
31
+    /**
32
+     * @var Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral|NULL
33
+     */
34 34
     protected $stringToken;
35 35
     
36
-   /**
37
-    * @var boolean
38
-    */
36
+    /**
37
+     * @var boolean
38
+     */
39 39
     protected $caseInsensitive = false;
40 40
     
41 41
     protected function getValidations() : array
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
         );
132 132
     }
133 133
 
134
-   /**
135
-    * Retrieves the variable being compared.
136
-    *
137
-    * @return Mailcode_Variables_Variable
138
-    */
134
+    /**
135
+     * Retrieves the variable being compared.
136
+     *
137
+     * @return Mailcode_Variables_Variable
138
+     */
139 139
     public function getVariable() : Mailcode_Variables_Variable
140 140
     {
141 141
         if($this->variableToken instanceof Mailcode_Parser_Statement_Tokenizer_Token_Variable)
Please login to merge, or discard this patch.