Passed
Pull Request — master (#20)
by
unknown
09:30
created
src/Mailcode/Traits/Commands/IfContains.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
     use Mailcode_Traits_Commands_Validation_Variable;
26 26
     use Mailcode_Traits_Commands_Validation_CaseSensitive;
27 27
     
28
-   /**
29
-    * @var Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[]
30
-    */
28
+    /**
29
+     * @var Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[]
30
+     */
31 31
     protected array $searchTerms = array();
32 32
     
33 33
     protected function getValidations() : array
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
         }
61 61
     }
62 62
     
63
-   /**
64
-    * Retrieves all search terms.
65
-    * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[]
66
-    */
63
+    /**
64
+     * Retrieves all search terms.
65
+     * @return Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral[]
66
+     */
67 67
     public function getSearchTerms() : array
68 68
     {
69 69
         return $this->searchTerms;
Please login to merge, or discard this patch.
src/Mailcode/Commands.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
     public const ERROR_INVALID_DUMMY_COMMAND_TYPE = 45903;
29 29
     public const ERROR_INVALID_COMMAND_CLASS = 45904;
30 30
     
31
-   /**
32
-    * @var Mailcode_Commands_Command[]
33
-    */
31
+    /**
32
+     * @var Mailcode_Commands_Command[]
33
+     */
34 34
     private array $commands = array();
35 35
     
36
-   /**
37
-    * @var array<string,Mailcode_Commands_Command>
38
-    */
36
+    /**
37
+     * @var array<string,Mailcode_Commands_Command>
38
+     */
39 39
     private static array $dummyCommands = array();
40 40
     
41
-   /**
42
-    * Retrieves a list of all available command IDs.
43
-    * 
44
-    * @return string[]
45
-    */
41
+    /**
42
+     * Retrieves a list of all available command IDs.
43
+     * 
44
+     * @return string[]
45
+     */
46 46
     public function getIDs() : array
47 47
     {
48 48
         static $ids = array();
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
         return $result;
89 89
     }
90 90
     
91
-   /**
92
-    * Gets an available command by its ID.
93
-    * 
94
-    * @param string $id
95
-    * @return Mailcode_Commands_Command
96
-    */
91
+    /**
92
+     * Gets an available command by its ID.
93
+     * 
94
+     * @param string $id
95
+     * @return Mailcode_Commands_Command
96
+     */
97 97
     public function getByID(string $id) : Mailcode_Commands_Command
98 98
     {
99 99
         static $instances = array();
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
         return $instances[$id];
107 107
     }
108 108
     
109
-   /**
110
-    * Retrieves the ID of a command by its name.
111
-    * 
112
-    * @param string $name
113
-    * @throws Mailcode_Exception
114
-    * @return string
115
-    * 
116
-    * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST
117
-    */
109
+    /**
110
+     * Retrieves the ID of a command by its name.
111
+     * 
112
+     * @param string $name
113
+     * @throws Mailcode_Exception
114
+     * @return string
115
+     * 
116
+     * @see Mailcode_Commands::ERROR_COMMAND_NAME_DOES_NOT_EXIST
117
+     */
118 118
     public function getIDByName(string $name) : string
119 119
     {
120 120
         $items = $this->getAll();
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
         return $class;
226 226
     }
227 227
     
228
-   /**
229
-    * Translates the command type to the expected class naming scheme.
230
-    * 
231
-    * Example: not-empty => NotEmpty
232
-    * 
233
-    * @param string $type
234
-    * @return string
235
-    */
228
+    /**
229
+     * Translates the command type to the expected class naming scheme.
230
+     * 
231
+     * Example: not-empty => NotEmpty
232
+     * 
233
+     * @param string $type
234
+     * @return string
235
+     */
236 236
     private function adjustTypeName(string $type) : string
237 237
     {
238 238
         $type = str_replace('-', ' ', $type);
Please login to merge, or discard this patch.
src/Mailcode/Variables/Collection.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
  */
21 21
 abstract class Mailcode_Variables_Collection
22 22
 {
23
-   /**
24
-    * @var Mailcode_Variables_Variable[]
25
-    */
23
+    /**
24
+     * @var Mailcode_Variables_Variable[]
25
+     */
26 26
     protected array $variables = array();
27 27
     
28 28
     public function __construct()
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
         return count($this->variables);
53 53
     }
54 54
     
55
-   /**
56
-    * Checks whether the collection contains a variable with the specified name.
57
-    * 
58
-    * @param string $fullName The variable name, with or without $ sign.
59
-    * @return bool
60
-    */
55
+    /**
56
+     * Checks whether the collection contains a variable with the specified name.
57
+     * 
58
+     * @param string $fullName The variable name, with or without $ sign.
59
+     * @return bool
60
+     */
61 61
     public function hasVariableName(string $fullName) : bool
62 62
     {
63 63
         $fullName = $this->fixName($fullName);
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
         return false;
74 74
     }
75 75
     
76
-   /**
77
-    * Retrieves a collection of all variable instances for
78
-    * the specified name (there can be several with differing
79
-    * matched texts because of spacing).
80
-    * 
81
-    * @param string $fullName
82
-    * @return Mailcode_Variables_Collection
83
-    */
76
+    /**
77
+     * Retrieves a collection of all variable instances for
78
+     * the specified name (there can be several with differing
79
+     * matched texts because of spacing).
80
+     * 
81
+     * @param string $fullName
82
+     * @return Mailcode_Variables_Collection
83
+     */
84 84
     public function getByFullName(string $fullName) : Mailcode_Variables_Collection
85 85
     {
86 86
         $fullName = $this->fixName($fullName);
@@ -98,23 +98,23 @@  discard block
 block discarded – undo
98 98
         return $collection;
99 99
     }
100 100
     
101
-   /**
102
-    * Prepends the $ sign to a variable name if it does not have it.
103
-    * 
104
-    * @param string $fullName
105
-    * @return string
106
-    */
101
+    /**
102
+     * Prepends the $ sign to a variable name if it does not have it.
103
+     * 
104
+     * @param string $fullName
105
+     * @return string
106
+     */
107 107
     protected function fixName(string $fullName) : string
108 108
     {
109 109
         return dollarize($fullName);
110 110
     }
111 111
     
112
-   /**
113
-    * Retrieves all variables, grouped by their hash - meaning
114
-    * unique matched strings.
115
-    * 
116
-    * @return Mailcode_Variables_Variable[]
117
-    */
112
+    /**
113
+     * Retrieves all variables, grouped by their hash - meaning
114
+     * unique matched strings.
115
+     * 
116
+     * @return Mailcode_Variables_Variable[]
117
+     */
118 118
     public function getGroupedByHash() : array
119 119
     {
120 120
         $entries = array();
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
         return $this->sortVariables($entries);
128 128
     }
129 129
     
130
-   /**
131
-    * Retrieves all variables, grouped by their name. 
132
-    * 
133
-    * @return Mailcode_Variables_Variable[]
134
-    */
130
+    /**
131
+     * Retrieves all variables, grouped by their name. 
132
+     * 
133
+     * @return Mailcode_Variables_Variable[]
134
+     */
135 135
     public function getGroupedByName() : array
136 136
     {
137 137
         $entries = array();
@@ -163,19 +163,19 @@  discard block
 block discarded – undo
163 163
         return $this->sortVariables($entries);
164 164
     }
165 165
     
166
-   /**
167
-    * Retrieves all variables, in the order they were addded.
168
-    * @return Mailcode_Variables_Variable[]
169
-    */
166
+    /**
167
+     * Retrieves all variables, in the order they were addded.
168
+     * @return Mailcode_Variables_Variable[]
169
+     */
170 170
     public function getAll()
171 171
     {
172 172
         return $this->variables;
173 173
     }
174 174
     
175
-   /**
176
-    * Retrieves the full names of the variables that are present in the collection.
177
-    * @return string[]
178
-    */
175
+    /**
176
+     * Retrieves the full names of the variables that are present in the collection.
177
+     * @return string[]
178
+     */
179 179
     public function getNames() : array
180 180
     {
181 181
         $result = array();
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
         return $result;
194 194
     }
195 195
     
196
-   /**
197
-    * Takes a list of variables and sorts them, throwing away
198
-    * the source array's keys.
199
-    * 
200
-    * @param Mailcode_Variables_Variable[] $entries
201
-    * @return Mailcode_Variables_Variable[]
202
-    */
196
+    /**
197
+     * Takes a list of variables and sorts them, throwing away
198
+     * the source array's keys.
199
+     * 
200
+     * @param Mailcode_Variables_Variable[] $entries
201
+     * @return Mailcode_Variables_Variable[]
202
+     */
203 203
     protected function sortVariables(array $entries)
204 204
     {
205 205
         $result = array_values($entries);
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
         return $result;
213 213
     }
214 214
 
215
-   /**
216
-    *  Merges the variables collection with the target collection
217
-    *  by inheriting all that collection's variables.
218
-    *  
219
-    * @param Mailcode_Variables_Collection $collection
220
-    * @return Mailcode_Variables_Collection
221
-    */
215
+    /**
216
+     *  Merges the variables collection with the target collection
217
+     *  by inheriting all that collection's variables.
218
+     *  
219
+     * @param Mailcode_Variables_Collection $collection
220
+     * @return Mailcode_Variables_Collection
221
+     */
222 222
     public function mergeWith(Mailcode_Variables_Collection $collection) : Mailcode_Variables_Collection
223 223
     {
224 224
         $variables = $collection->getGroupedByHash();
Please login to merge, or discard this patch.
src/Mailcode/Collection/Error.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@
 block discarded – undo
20 20
  */
21 21
 abstract class Mailcode_Collection_Error
22 22
 {
23
-   /**
24
-    * @var integer
25
-    */
23
+    /**
24
+     * @var integer
25
+     */
26 26
     protected int $code = 0;
27 27
 
28
-   /**
29
-    * @var string
30
-    */
28
+    /**
29
+     * @var string
30
+     */
31 31
     protected string $matchedText = '';
32 32
 
33
-   /**
34
-    * @var string
35
-    */
33
+    /**
34
+     * @var string
35
+     */
36 36
     protected string $message = '';
37 37
 
38 38
     protected ?Mailcode_Commands_Command $command = null;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
         Mailcode_Parser_Statement_Tokenizer_Process_SetNames::class,
52 52
     );
53 53
     
54
-   /**
55
-    * @var Mailcode_Parser_Statement
56
-    */
54
+    /**
55
+     * @var Mailcode_Parser_Statement
56
+     */
57 57
     protected Mailcode_Parser_Statement $statement;
58 58
     
59
-   /**
60
-    * @var string
61
-    */
59
+    /**
60
+     * @var string
61
+     */
62 62
     protected string $tokenized = '';
63 63
     
64 64
     /**
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
      */
67 67
     protected array $tokensOrdered = array();
68 68
     
69
-   /**
70
-    * @var string[]
71
-    */
69
+    /**
70
+     * @var string[]
71
+     */
72 72
     protected static array $ids = array();
73 73
 
74 74
     /**
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
         return $this->statement->getSourceCommand();
92 92
     }
93 93
 
94
-   /**
95
-    * Retrieves all tokens detected in the statement string, in 
96
-    * the order they were found.
97
-    * 
98
-    * @return Mailcode_Parser_Statement_Tokenizer_Token[]
99
-    */
94
+    /**
95
+     * Retrieves all tokens detected in the statement string, in 
96
+     * the order they were found.
97
+     * 
98
+     * @return Mailcode_Parser_Statement_Tokenizer_Token[]
99
+     */
100 100
     public function getTokens() : array
101 101
     {
102 102
         return $this->tokensOrdered;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
         return !empty($this->tokensOrdered);
108 108
     }
109 109
     
110
-   /**
111
-    * Whether there were any unknown tokens in the statement.
112
-    * 
113
-    * @return bool
114
-    */
110
+    /**
111
+     * Whether there were any unknown tokens in the statement.
112
+     * 
113
+     * @return bool
114
+     */
115 115
     public function hasUnknown() : bool
116 116
     {
117 117
         $unknown = $this->getUnknown();
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
         return !empty($unknown);
120 120
     }
121 121
     
122
-   /**
123
-    * Retrieves all unknown content tokens, if any.
124
-    * 
125
-    * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[]
126
-    */
122
+    /**
123
+     * Retrieves all unknown content tokens, if any.
124
+     * 
125
+     * @return Mailcode_Parser_Statement_Tokenizer_Token_Unknown[]
126
+     */
127 127
     public function getUnknown() : array
128 128
     {
129 129
         $result = array();
@@ -410,13 +410,13 @@  discard block
 block discarded – undo
410 410
         return $this;
411 411
     }
412 412
     
413
-   /**
414
-    * Generates a unique alphabet-based ID without numbers
415
-    * to use as token name, to avoid conflicts with the
416
-    * numbers detection.
417
-    *
418
-    * @return string
419
-    */
413
+    /**
414
+     * Generates a unique alphabet-based ID without numbers
415
+     * to use as token name, to avoid conflicts with the
416
+     * numbers detection.
417
+     *
418
+     * @return string
419
+     */
420 420
     protected function generateID() : string
421 421
     {
422 422
         static $alphas;
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token/StringLiteral.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
     }
36 36
 
37 37
     /**
38
-    * Retrieves the text with the surrounding quotes,
39
-    * and special characters escaped for Mailcode.
40
-    *
41
-    * @return string
42
-    */
38
+     * Retrieves the text with the surrounding quotes,
39
+     * and special characters escaped for Mailcode.
40
+     *
41
+     * @return string
42
+     */
43 43
     public function getNormalized() : string
44 44
     {
45 45
         return '"'.SpecialChars::escape($this->text).'"';
@@ -50,21 +50,21 @@  discard block
 block discarded – undo
50 50
         return true;
51 51
     }
52 52
     
53
-   /**
54
-    * Retrieves the text with the surrounding quotes.
55
-    * @return string
56
-    */
53
+    /**
54
+     * Retrieves the text with the surrounding quotes.
55
+     * @return string
56
+     */
57 57
     public function getValue() : string
58 58
     {
59 59
         return $this->getNormalized();
60 60
     }
61 61
     
62
-   /**
63
-    * Retrieves the text without the surrounding quotes,
64
-    * and special Mailcode characters not escaped.
65
-    *
66
-    * @return string
67
-    */
62
+    /**
63
+     * Retrieves the text without the surrounding quotes,
64
+     * and special Mailcode characters not escaped.
65
+     *
66
+     * @return string
67
+     */
68 68
     public function getText() : string
69 69
     {
70 70
         return SpecialChars::decode($this->text);
Please login to merge, or discard this patch.
src/Mailcode/Parser/Statement/Tokenizer/Token/Operand.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
         return true;
36 36
     }
37 37
     
38
-   /**
39
-    * Retrieves all known comparison operator signs.
40
-    * @return string[]
41
-    */
38
+    /**
39
+     * Retrieves all known comparison operator signs.
40
+     * @return string[]
41
+     */
42 42
     public static function getComparisonSigns() : array
43 43
     {
44 44
         return array(
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
         );
52 52
     }
53 53
     
54
-   /**
55
-    * Retrieves all known arithmetic operator signs.
56
-    * @return string[]
57
-    */
54
+    /**
55
+     * Retrieves all known arithmetic operator signs.
56
+     * @return string[]
57
+     */
58 58
     public static function getArithmeticSigns() : array
59 59
     {
60 60
         return array(
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
         );
66 66
     }
67 67
     
68
-   /**
69
-    * Whether the operator is comparison related (equals, not equals, smaller, greater...).
70
-    *  
71
-    * @return bool
72
-    */
68
+    /**
69
+     * Whether the operator is comparison related (equals, not equals, smaller, greater...).
70
+     *  
71
+     * @return bool
72
+     */
73 73
     public function isComparator() : bool
74 74
     {
75 75
         return 
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
         $this->isSmallerOrEquals();
82 82
     }
83 83
     
84
-   /**
85
-    * Whether the operator is calculation related (minus, plus, divide, multiply).
86
-    * 
87
-    * @return bool
88
-    */
84
+    /**
85
+     * Whether the operator is calculation related (minus, plus, divide, multiply).
86
+     * 
87
+     * @return bool
88
+     */
89 89
     public function isCalculator() : bool
90 90
     {
91 91
         return 
Please login to merge, or discard this patch.
src/Mailcode/Traits/Formatting/HTMLHighlighting.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -23,25 +23,25 @@  discard block
 block discarded – undo
23 23
  */
24 24
 trait Mailcode_Traits_Formatting_HTMLHighlighting
25 25
 {
26
-   /**
27
-    * Stored this way, so we can use isset() instead
28
-    * of using in_array, which is some magnitudes slower.
29
-    * The boolean value is not used otherwise.
30
-    *
31
-    * @var array<string,bool>
32
-    */
26
+    /**
27
+     * Stored this way, so we can use isset() instead
28
+     * of using in_array, which is some magnitudes slower.
29
+     * The boolean value is not used otherwise.
30
+     *
31
+     * @var array<string,bool>
32
+     */
33 33
     private array $excludeTags = array(
34 34
         'style' => true, // NOTE: style tags are excluded natively on the parser level.
35 35
         'script' => true
36 36
     );
37 37
     
38
-   /**
39
-    * Adds an HTML tag name to the list of tags within which
40
-    * commands may not be highlighted.
41
-    *
42
-    * @param string $tagName Case-insensitive.
43
-    * @return $this
44
-    */
38
+    /**
39
+     * Adds an HTML tag name to the list of tags within which
40
+     * commands may not be highlighted.
41
+     *
42
+     * @param string $tagName Case-insensitive.
43
+     * @return $this
44
+     */
45 45
     public function excludeTag(string $tagName) : self
46 46
     {
47 47
         $tagName = strtolower($tagName);
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
         return $this;
52 52
     }
53 53
     
54
-   /**
55
-    * Adds several excluded tag names at once.
56
-    *
57
-    * @param string[] $tagNames
58
-    * @return $this
59
-    */
54
+    /**
55
+     * Adds several excluded tag names at once.
56
+     *
57
+     * @param string[] $tagNames
58
+     * @return $this
59
+     */
60 60
     public function excludeTags(array $tagNames) : self
61 61
     {
62 62
         foreach($tagNames as $tagName)
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
         return $this;
68 68
     }
69 69
     
70
-   /**
71
-    * Whether the specified tag name is in the exclusion list.
72
-    *
73
-    * @param string $tagName
74
-    * @return bool
75
-    */
70
+    /**
71
+     * Whether the specified tag name is in the exclusion list.
72
+     *
73
+     * @param string $tagName
74
+     * @return bool
75
+     */
76 76
     public function isTagExcluded(string $tagName) : bool
77 77
     {
78 78
         $tagName = strtolower($tagName);
Please login to merge, or discard this patch.
src/Mailcode/Variables/Variable.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -32,34 +32,34 @@
 block discarded – undo
32 32
     public const VALIDATION_ERROR_PATH_UNDERSCORE = 48203;
33 33
     public const VALIDATION_ERROR_NAME_UNDERSCORE = 48204;
34 34
     
35
-   /**
36
-    * @var string
37
-    */
35
+    /**
36
+     * @var string
37
+     */
38 38
     protected string $path;
39 39
     
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected string $name;
44 44
     
45
-   /**
46
-    * @var string
47
-    */
45
+    /**
46
+     * @var string
47
+     */
48 48
     protected string $matchedText;
49 49
     
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected string $hash = '';
54 54
     
55
-   /**
56
-    * @var OperationResult|NULL
57
-    */
55
+    /**
56
+     * @var OperationResult|NULL
57
+     */
58 58
     protected ?OperationResult $validationResult = null;
59 59
     
60
-   /**
61
-    * @var array<string>
62
-    */
60
+    /**
61
+     * @var array<string>
62
+     */
63 63
     protected array $validations = array(
64 64
         'number_path',
65 65
         'number_name',
Please login to merge, or discard this patch.