Passed
Push — master ( 62420e...b1849d )
by Sebastian
03:41
created
src/Mailcode/Variables/Collection.php 2 patches
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.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $fullName = $this->fixName($fullName);
64 64
         
65
-        foreach($this->variables as $variable)
65
+        foreach ($this->variables as $variable)
66 66
         {
67
-            if($variable->getFullName() === $fullName)
67
+            if ($variable->getFullName() === $fullName)
68 68
             {
69 69
                 return true;
70 70
             }
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
         
88 88
         $collection = new Mailcode_Variables_Collection_Regular();
89 89
         
90
-        foreach($this->variables as $variable)
90
+        foreach ($this->variables as $variable)
91 91
         {
92
-            if($variable->getFullName() === $fullName)
92
+            if ($variable->getFullName() === $fullName)
93 93
             {
94 94
                 $collection->add($variable);
95 95
             }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     {
120 120
         $entries = array();
121 121
         
122
-        foreach($this->variables as $variable)
122
+        foreach ($this->variables as $variable)
123 123
         {
124 124
             $entries[$variable->getHash()] = $variable;
125 125
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $entries = array();
138 138
         
139
-        foreach($this->variables as $variable)
139
+        foreach ($this->variables as $variable)
140 140
         {
141 141
             $entries[$variable->getFullName()] = $variable;
142 142
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $entries = array();
157 157
 
158
-        foreach($this->variables as $variable)
158
+        foreach ($this->variables as $variable)
159 159
         {
160 160
             $entries[$variable->getUniqueName()] = $variable;
161 161
         }
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
     {
181 181
         $result = array();
182 182
         
183
-        foreach($this->variables as $variable)
183
+        foreach ($this->variables as $variable)
184 184
         {
185 185
             $name = $variable->getFullName();
186 186
             
187
-            if(!in_array($name, $result))
187
+            if (!in_array($name, $result))
188 188
             {
189 189
                 $result[] = $name;
190 190
             }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $variables = $collection->getGroupedByHash();
225 225
         
226
-        foreach($variables as $variable)
226
+        foreach ($variables as $variable)
227 227
         {
228 228
             $this->add($variable);
229 229
         }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     {
236 236
         $variables = $this->getAll();
237 237
         
238
-        if(!empty($variables))
238
+        if (!empty($variables))
239 239
         {
240 240
             return array_shift($variables);
241 241
         }
Please login to merge, or discard this patch.
src/Mailcode/Traits/Commands/Validation/ListPropertyVariable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         // Split the variable name by the dot
45 45
         $parts = explode('.', undollarize($var->getFullName()));
46 46
 
47
-        if(count($parts) !== 2)
47
+        if (count($parts) !== 2)
48 48
         {
49 49
             $this->validationResult->makeError(
50 50
                 t('The variable %1$s is not a list property:', '<code>'.$var->getFullName().'</code>').' '.
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function getListVariable() : Mailcode_Variables_Variable
78 78
     {
79
-        if(isset($this->listVariable))
79
+        if (isset($this->listVariable))
80 80
         {
81 81
             return $this->listVariable;
82 82
         }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Misc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,12 +59,12 @@
 block discarded – undo
59 59
      * @throws Mailcode_Exception
60 60
      * @throws Mailcode_Factory_Exception
61 61
      */
62
-    public function for(string $sourceVariable, string $loopVariable, $breakAtValue = ''): Mailcode_Commands_Command_For
62
+    public function for (string $sourceVariable, string $loopVariable, $breakAtValue = ''): Mailcode_Commands_Command_For
63 63
     {
64 64
         $sourceVariable = dollarize($sourceVariable);
65 65
         $loopVariable = dollarize($loopVariable);
66 66
 
67
-        if($breakAtValue instanceof Mailcode_Variables_Variable) {
67
+        if ($breakAtValue instanceof Mailcode_Variables_Variable) {
68 68
             $breakAtValue = $breakAtValue->getFullName();
69 69
         }
70 70
 
Please login to merge, or discard this patch.
src/Mailcode/Date/FormatInfo.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 
149 149
             if (!in_array($char, $this->allowedChars)) {
150 150
                 $result->makeError(
151
-                    t('Invalid character in date format:') . ' ' .
152
-                    t('%1$s at position %2$s.', '<code>' . $char . '</code>', $i + 1),
151
+                    t('Invalid character in date format:').' '.
152
+                    t('%1$s at position %2$s.', '<code>'.$char.'</code>', $i + 1),
153 153
                     self::VALIDATION_INVALID_FORMAT_CHARACTER
154 154
                 );
155 155
 
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
         $groups = array_keys($grouped);
195 195
 
196 196
         foreach ($groups as $group) {
197
-            usort($grouped[$group], function (Mailcode_Date_FormatInfo_Character $a, Mailcode_Date_FormatInfo_Character $b) {
197
+            usort($grouped[$group], function(Mailcode_Date_FormatInfo_Character $a, Mailcode_Date_FormatInfo_Character $b) {
198 198
                 return strnatcasecmp($a->getChar(), $b->getChar());
199 199
             });
200 200
         }
201 201
 
202
-        uksort($grouped, function (string $a, string $b) {
202
+        uksort($grouped, function(string $a, string $b) {
203 203
             return strnatcasecmp($a, $b);
204 204
         });
205 205
 
Please login to merge, or discard this patch.
src/Mailcode/Collection/Error/Message.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@
 block discarded – undo
20 20
  */
21 21
 class Mailcode_Collection_Error_Message extends Mailcode_Collection_Error
22 22
 {
23
-    public function __construct(string $matchedText, int $code, string $message, ?object $subject=null)
23
+    public function __construct(string $matchedText, int $code, string $message, ?object $subject = null)
24 24
     {
25 25
         $this->matchedText = $matchedText;
26 26
         $this->code = $code;
27 27
         $this->message = $message;
28 28
 
29
-        if($subject instanceof Mailcode_Commands_Command)
29
+        if ($subject instanceof Mailcode_Commands_Command)
30 30
         {
31 31
             $this->command = $subject;
32 32
         }
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/Factory/CommandSets/Set/Set.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
                 $value = $this->instantiator->quoteString($value);
41 41
             }
42 42
 
43
-            $params = $variableName . ' = ' . $value;
43
+            $params = $variableName.' = '.$value;
44 44
         }
45 45
 
46 46
         $cmd = $this->commands->createCommand(
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets/Set/Variables.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         return $this->variables->createVariableByName($fullName);
31 31
     }
32 32
 
33
-    public function pathName(string $path, ?string $name=null) : Mailcode_Variables_Variable
33
+    public function pathName(string $path, ?string $name = null) : Mailcode_Variables_Variable
34 34
     {
35 35
         return $this->variables->createVariable($path, $name);
36 36
     }
Please login to merge, or discard this patch.
src/Mailcode/Factory/CommandSets.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
     private ?Mailcode_Factory_CommandSets_Set_ElseIf $elseIf = null;
28 28
     private ?Mailcode_Factory_CommandSets_Set_Variables $variables = null;
29 29
 
30
-    public function if() : Mailcode_Factory_CommandSets_Set_If
30
+    public function if () : Mailcode_Factory_CommandSets_Set_If
31 31
     {
32
-        if(!isset($this->if))
32
+        if (!isset($this->if))
33 33
         {
34 34
             $this->if = new Mailcode_Factory_CommandSets_Set_If();
35 35
         }
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
         return $this->if;
38 38
     }
39 39
     
40
-    public function elseIf() : Mailcode_Factory_CommandSets_Set_ElseIf
40
+    public function elseIf () : Mailcode_Factory_CommandSets_Set_ElseIf
41 41
     {
42
-        if(!isset($this->elseIf))
42
+        if (!isset($this->elseIf))
43 43
         {
44 44
             $this->elseIf = new Mailcode_Factory_CommandSets_Set_ElseIf();
45 45
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     
50 50
     public function show() : Mailcode_Factory_CommandSets_Set_Show
51 51
     {
52
-        if(!isset($this->show))
52
+        if (!isset($this->show))
53 53
         {
54 54
             $this->show = new Mailcode_Factory_CommandSets_Set_Show();
55 55
         }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     
60 60
     public function misc() : Mailcode_Factory_CommandSets_Set_Misc
61 61
     {
62
-        if(!isset($this->misc))
62
+        if (!isset($this->misc))
63 63
         {
64 64
             $this->misc = new Mailcode_Factory_CommandSets_Set_Misc();
65 65
         }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     
70 70
     public function set() : Mailcode_Factory_CommandSets_Set_Set
71 71
     {
72
-        if(!isset($this->set))
72
+        if (!isset($this->set))
73 73
         {
74 74
             $this->set = new Mailcode_Factory_CommandSets_Set_Set();
75 75
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function var() : Mailcode_Factory_CommandSets_Set_Variables
81 81
     {
82
-        if(!isset($this->variables))
82
+        if (!isset($this->variables))
83 83
         {
84 84
             $this->variables = new Mailcode_Factory_CommandSets_Set_Variables();
85 85
         }
Please login to merge, or discard this patch.