Passed
Push — master ( 18ea48...3da677 )
by Sebastian
02:23
created
src/CSVHelper/Builder.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         return $this->setOption('separatorChar', $char);
18 18
     }
19 19
     
20
-    public function setTrailingNewline($useNewline=true)
20
+    public function setTrailingNewline($useNewline = true)
21 21
     {
22 22
         return $this->setOption('trailingNewline', $useNewline);
23 23
     }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $args = $args[0];
39 39
         }
40 40
 
41
-        $this->lines[] = '"' . implode('"'.$this->getOption('separatorChar').'"', $args) . '"';
41
+        $this->lines[] = '"'.implode('"'.$this->getOption('separatorChar').'"', $args).'"';
42 42
         
43 43
         return $this;
44 44
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $csv = implode(PHP_EOL, $this->lines);
56 56
 
57
-        if($this->getOption('trailingNewline')) {
57
+        if ($this->getOption('trailingNewline')) {
58 58
             $csv .= PHP_EOL;
59 59
         }
60 60
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     
66 66
     public function setOption($name, $value)
67 67
     {
68
-        if(!isset($this->options)) {
68
+        if (!isset($this->options)) {
69 69
             $this->options = $this->getDefaultOptions();
70 70
         }
71 71
         
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
     
76 76
     public function setOptions($options)
77 77
     {
78
-        foreach($options as $name => $value) {
78
+        foreach ($options as $name => $value) {
79 79
             $this->setOption($name, $value);
80 80
         }
81 81
         
82 82
         return $this;
83 83
     }
84 84
     
85
-    public function getOption($name, $default=null)
85
+    public function getOption($name, $default = null)
86 86
     {
87
-        if(!isset($this->options)) {
87
+        if (!isset($this->options)) {
88 88
             $this->options = $this->getDefaultOptions();
89 89
         }
90 90
         
91
-        if(isset($this->options[$name])) {
91
+        if (isset($this->options[$name])) {
92 92
             return $this->options[$name];
93 93
         }
94 94
         
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     
98 98
     public function hasOption($name)
99 99
     {
100
-        if(!isset($this->options)) {
100
+        if (!isset($this->options)) {
101 101
             $this->options = $this->getDefaultOptions();
102 102
         }
103 103
         
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     
107 107
     public function getOptions()
108 108
     {
109
-        if(!isset($this->options)) {
109
+        if (!isset($this->options)) {
110 110
             $this->options = $this->getDefaultOptions();
111 111
         }
112 112
         
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     
116 116
     public function isOption($name, $value)
117 117
     {
118
-        if($this->getOption($name) === $value) {
118
+        if ($this->getOption($name) === $value) {
119 119
             return true;
120 120
         }
121 121
         
Please login to merge, or discard this patch.
src/FileHelper/PHPClassInfo.php 2 patches
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
     
37 37
     protected $classes = array();
38 38
     
39
-   /**
40
-    * The namespace detected in the file, if any.
41
-    * @var string
42
-    */
39
+    /**
40
+     * The namespace detected in the file, if any.
41
+     * @var string
42
+     */
43 43
     protected $namespace = '';
44 44
     
45
-   /**
46
-    * @param string $path The path to the PHP file to parse.
47
-    * @throws FileHelper_Exception
48
-    * @see FileHelper::findPHPClasses()
49
-    */
45
+    /**
46
+     * @param string $path The path to the PHP file to parse.
47
+     * @throws FileHelper_Exception
48
+     * @see FileHelper::findPHPClasses()
49
+     */
50 50
     public function __construct(string $path)
51 51
     {
52 52
         $this->path = realpath($path);
@@ -66,66 +66,66 @@  discard block
 block discarded – undo
66 66
         $this->parseFile();
67 67
     }
68 68
     
69
-   /**
70
-    * The name of the namespace of the classes in the file, if any.
71
-    * @return string
72
-    */
69
+    /**
70
+     * The name of the namespace of the classes in the file, if any.
71
+     * @return string
72
+     */
73 73
     public function getNamespace() : string
74 74
     {
75 75
         return $this->namespace;
76 76
     }
77 77
     
78
-   /**
79
-    * Whether the file contains a namespace.
80
-    * @return bool
81
-    */
78
+    /**
79
+     * Whether the file contains a namespace.
80
+     * @return bool
81
+     */
82 82
     public function hasNamespace() : bool
83 83
     {
84 84
         return !empty($this->namespace);
85 85
     }
86 86
     
87
-   /**
88
-    * The absolute path to the file.
89
-    * @return string
90
-    */
87
+    /**
88
+     * The absolute path to the file.
89
+     * @return string
90
+     */
91 91
     public function getPath() : string
92 92
     {
93 93
         return $this->path;
94 94
     }
95 95
    
96
-   /**
97
-    * Whether any classes were found in the file.
98
-    * @return bool
99
-    */
96
+    /**
97
+     * Whether any classes were found in the file.
98
+     * @return bool
99
+     */
100 100
     public function hasClasses() : bool
101 101
     {
102 102
         return !empty($this->classes);
103 103
     }
104 104
     
105
-   /**
106
-    * The names of the classes that were found in the file (with namespace if any).
107
-    * @return string[]
108
-    */
105
+    /**
106
+     * The names of the classes that were found in the file (with namespace if any).
107
+     * @return string[]
108
+     */
109 109
     public function getClassNames() : array
110 110
     {
111 111
         return array_keys($this->classes);
112 112
     }
113 113
     
114
-   /**
115
-    * Retrieves all classes that were detected in the file,
116
-    * which can be used to retrieve more information about
117
-    * them.
118
-    * 
119
-    * @return FileHelper_PHPClassInfo_Class[]
120
-    */
114
+    /**
115
+     * Retrieves all classes that were detected in the file,
116
+     * which can be used to retrieve more information about
117
+     * them.
118
+     * 
119
+     * @return FileHelper_PHPClassInfo_Class[]
120
+     */
121 121
     public function getClasses()
122 122
     {
123 123
         return $this->classes;
124 124
     }
125 125
     
126
-   /**
127
-    * @throws FileHelper_Exception
128
-    */
126
+    /**
127
+     * @throws FileHelper_Exception
128
+     */
129 129
     protected function parseFile()
130 130
     {
131 131
         $code = file_get_contents($this->path);
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
         }
181 181
     }
182 182
     
183
-   /**
184
-    * Strips all whitespace from the string, replacing it with 
185
-    * regular spaces (newlines, tabs, etc.).
186
-    * 
187
-    * @param string $string
188
-    * @return string
189
-    */
183
+    /**
184
+     * Strips all whitespace from the string, replacing it with 
185
+     * regular spaces (newlines, tabs, etc.).
186
+     * 
187
+     * @param string $string
188
+     * @return string
189
+     */
190 190
     protected function stripWhitespace(string $string) : string 
191 191
     {
192 192
         return preg_replace('/[\s]/', ' ', $string);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $this->path = realpath($path);
53 53
         
54
-        if($this->path === false)
54
+        if ($this->path === false)
55 55
         {
56 56
             throw new FileHelper_Exception(
57 57
                 'Cannot extract file information: file not found.',
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     {
131 131
         $code = file_get_contents($this->path);
132 132
         
133
-        if($code === false) 
133
+        if ($code === false) 
134 134
         {
135 135
             throw new FileHelper_Exception(
136 136
                 'Cannot open file for parsing.',
@@ -149,24 +149,24 @@  discard block
 block discarded – undo
149 149
         
150 150
         $result = array();
151 151
         preg_match_all('/namespace[\s]+([^;]+);/six', $code, $result, PREG_PATTERN_ORDER);
152
-        if(isset($result[0]) && isset($result[0][0])) {
152
+        if (isset($result[0]) && isset($result[0][0])) {
153 153
             $this->namespace = trim($result[1][0]);
154 154
         }
155 155
         
156 156
         $result = array();
157 157
         preg_match_all('/(abstract|final)[\s]+class[\s]+([\sa-z0-9\\\\_,]+){|class[\s]+([\sa-z0-9\\\\_,]+){/six', $code, $result, PREG_PATTERN_ORDER);
158 158
 
159
-        if(!isset($result[0]) || !isset($result[0][0])) {
159
+        if (!isset($result[0]) || !isset($result[0][0])) {
160 160
             return;
161 161
         }
162 162
         
163 163
         $indexes = array_keys($result[0]);
164 164
         
165
-        foreach($indexes as $idx)
165
+        foreach ($indexes as $idx)
166 166
         {
167 167
             $keyword = $result[1][$idx];
168 168
             $declaration = $result[2][$idx];
169
-            if(empty($keyword)) {
169
+            if (empty($keyword)) {
170 170
                 $declaration = $result[3][$idx];
171 171
             }
172 172
             
Please login to merge, or discard this patch.
src/FileHelper/FileFinder.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -147,8 +147,7 @@  discard block
 block discarded – undo
147 147
                 if($this->getOption('recursive') === true && !$item->isDot()) {
148 148
                     $this->find($item->getPathname());
149 149
                 }
150
-            }
151
-            else
150
+            } else
152 151
             {
153 152
                 $file = $this->filterFile($item->getPathname());
154 153
                 if($file) {
@@ -172,8 +171,7 @@  discard block
 block discarded – undo
172 171
             if(!in_array($info['extension'], $include)) {
173 172
                 return false;
174 173
             }
175
-        }
176
-        else if(!empty($exclude))
174
+        } else if(!empty($exclude))
177 175
         {
178 176
             if(in_array($info['extension'], $exclude)) {
179 177
                 return false;
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
     
32 32
     const PATH_MODE_STRIP = 'strip';
33 33
     
34
-   /**
35
-    * @var string
36
-    */
34
+    /**
35
+     * @var string
36
+     */
37 37
     protected $path;
38 38
     
39 39
     public function __construct(string $path)
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @see FileHelper_FileFinder
8 8
  */
9 9
 
10
-declare(strict_types = 1);
10
+declare(strict_types=1);
11 11
 
12 12
 namespace AppUtils;
13 13
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     
126 126
     public function getAll() : array
127 127
     {
128
-        if(!isset($this->found)) {
128
+        if (!isset($this->found)) {
129 129
             $this->find($this->path, true);
130 130
         }
131 131
         
@@ -150,25 +150,25 @@  discard block
 block discarded – undo
150 150
     
151 151
     protected $found;
152 152
     
153
-    protected function find($path, $isRoot=false)
153
+    protected function find($path, $isRoot = false)
154 154
     {
155
-        if($isRoot) {
155
+        if ($isRoot) {
156 156
             $this->found = array();
157 157
         }
158 158
         
159 159
         $d = new \DirectoryIterator($path);
160
-        foreach($d as $item)
160
+        foreach ($d as $item)
161 161
         {
162
-            if($item->isDir())
162
+            if ($item->isDir())
163 163
             {
164
-                if($this->getOption('recursive') === true && !$item->isDot()) {
164
+                if ($this->getOption('recursive') === true && !$item->isDot()) {
165 165
                     $this->find($item->getPathname());
166 166
                 }
167 167
             }
168 168
             else
169 169
             {
170 170
                 $file = $this->filterFile($item->getPathname());
171
-                if($file) {
171
+                if ($file) {
172 172
                     $this->found[] = $file;
173 173
                 }
174 174
             }
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
         $include = $this->getOption('include-extensions');
185 185
         $exclude = $this->getOption('exclude-extensions');
186 186
         
187
-        if(!empty($include))
187
+        if (!empty($include))
188 188
         {
189
-            if(!in_array($info['extension'], $include)) {
189
+            if (!in_array($info['extension'], $include)) {
190 190
                 return false;
191 191
             }
192 192
         }
193
-        else if(!empty($exclude))
193
+        else if (!empty($exclude))
194 194
         {
195
-            if(in_array($info['extension'], $exclude)) {
195
+            if (in_array($info['extension'], $exclude)) {
196 196
                 return false;
197 197
             }
198 198
         }
199 199
         
200
-        switch($this->getOption('pathmode'))
200
+        switch ($this->getOption('pathmode'))
201 201
         {
202 202
             case self::PATH_MODE_STRIP:
203 203
                 $path = basename($path);
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
                 break;
214 214
         }
215 215
         
216
-        if($this->getOption('strip-extensions') === true)
216
+        if ($this->getOption('strip-extensions') === true)
217 217
         {
218 218
             $path = str_replace('.'.$info['extension'], '', $path);
219 219
         }
220 220
         
221 221
         $replace = $this->getOption('slash-replacement');
222
-        if(!empty($replace)) {
222
+        if (!empty($replace)) {
223 223
             $path = str_replace('/', $replace, $path);
224 224
         }
225 225
         
Please login to merge, or discard this patch.
src/FileHelper/MimeTypes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@
 block discarded – undo
221 221
      */
222 222
     public static function getMime($extension)
223 223
     {
224
-        if(isset(self::$mimeTypes[$extension])) {
224
+        if (isset(self::$mimeTypes[$extension])) {
225 225
             return self::$mimeTypes[$extension];
226 226
         }
227 227
 
Please login to merge, or discard this patch.
src/FileHelper/PHPClassInfo/Class.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -22,51 +22,51 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class FileHelper_PHPClassInfo_Class 
24 24
 {
25
-   /**
26
-    * @var FileHelper_PHPClassInfo
27
-    */
25
+    /**
26
+     * @var FileHelper_PHPClassInfo
27
+     */
28 28
     protected $info;
29 29
 
30
-   /**
31
-    * @var bool
32
-    */
30
+    /**
31
+     * @var bool
32
+     */
33 33
     protected $abstract = false;
34 34
     
35
-   /**
36
-    * @var bool
37
-    */
35
+    /**
36
+     * @var bool
37
+     */
38 38
     protected $final = false;
39 39
     
40
-   /**
41
-    * @var string
42
-    */
40
+    /**
41
+     * @var string
42
+     */
43 43
     protected $extends = '';
44 44
     
45
-   /**
46
-    * @var string[]
47
-    */
45
+    /**
46
+     * @var string[]
47
+     */
48 48
     protected $implements = array();
49 49
     
50
-   /**
51
-    * @var string
52
-    */
50
+    /**
51
+     * @var string
52
+     */
53 53
     protected $name;
54 54
     
55
-   /**
56
-    * @var string
57
-    */
55
+    /**
56
+     * @var string
57
+     */
58 58
     protected $declaration;
59 59
     
60
-   /**
61
-    * @var string
62
-    */
60
+    /**
61
+     * @var string
62
+     */
63 63
     protected $keyword;
64 64
     
65
-   /**
66
-    * @param FileHelper_PHPClassInfo $info The class info instance.
67
-    * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass".
68
-    * @param string $keyword The class keyword, if any, i.e. "abstract" or "final".
69
-    */
65
+    /**
66
+     * @param FileHelper_PHPClassInfo $info The class info instance.
67
+     * @param string $declaration The full class declaration, e.g. "class SomeName extends SomeOtherClass".
68
+     * @param string $keyword The class keyword, if any, i.e. "abstract" or "final".
69
+     */
70 70
     public function __construct(FileHelper_PHPClassInfo $info, string $declaration, string $keyword)
71 71
     {
72 72
         $this->info = $info;
@@ -76,31 +76,31 @@  discard block
 block discarded – undo
76 76
         $this->analyzeCode();
77 77
     }
78 78
     
79
-   /**
80
-    * Check if this class is a subclass of the specified
81
-    * class name.
82
-    * 
83
-    * @param string $className
84
-    * @return bool
85
-    */
79
+    /**
80
+     * Check if this class is a subclass of the specified
81
+     * class name.
82
+     * 
83
+     * @param string $className
84
+     * @return bool
85
+     */
86 86
     public function isSublassOf(string $className) : bool
87 87
     {
88 88
         return is_subclass_of($this->getNameNS(), $className);
89 89
     }
90 90
     
91
-   /**
92
-    * The class name without namespace.
93
-    * @return string
94
-    */
91
+    /**
92
+     * The class name without namespace.
93
+     * @return string
94
+     */
95 95
     public function getName() : string
96 96
     {
97 97
         return $this->name;
98 98
     }
99 99
     
100
-   /**
101
-    * The absolute class name with namespace (if any).
102
-    * @return string
103
-    */
100
+    /**
101
+     * The absolute class name with namespace (if any).
102
+     * @return string
103
+     */
104 104
     public function getNameNS() : string
105 105
     {
106 106
         $name = $this->getName();
@@ -112,48 +112,48 @@  discard block
 block discarded – undo
112 112
         return $name;
113 113
     }
114 114
     
115
-   /**
116
-    * Whether it is an abstract class.
117
-    * @return bool
118
-    */
115
+    /**
116
+     * Whether it is an abstract class.
117
+     * @return bool
118
+     */
119 119
     public function isAbstract() : bool
120 120
     {
121 121
         return $this->abstract;
122 122
     }
123 123
     
124
-   /**
125
-    * Whether it is a final class.
126
-    * @return bool
127
-    */
124
+    /**
125
+     * Whether it is a final class.
126
+     * @return bool
127
+     */
128 128
     public function isFinal() : bool
129 129
     {
130 130
         return $this->final;
131 131
     }
132 132
 
133
-   /**
134
-    * The name of the class that this class extends (with namespace, if specified).
135
-    * @return string
136
-    */
133
+    /**
134
+     * The name of the class that this class extends (with namespace, if specified).
135
+     * @return string
136
+     */
137 137
     public function getExtends() : string
138 138
     {
139 139
         return $this->extends;
140 140
     }
141 141
     
142
-   /**
143
-    * A list of interfaces the class implements, if any.
144
-    * @return array
145
-    */
142
+    /**
143
+     * A list of interfaces the class implements, if any.
144
+     * @return array
145
+     */
146 146
     public function getImplements() : array
147 147
     {
148 148
         return $this->implements;
149 149
     }
150 150
     
151
-   /**
152
-    * The class declaration string, with normalized spaces and sorted interface names.
153
-    * NOTE: does not include the keyword "abstract" or "final".
154
-    * 
155
-    * @return string
156
-    */
151
+    /**
152
+     * The class declaration string, with normalized spaces and sorted interface names.
153
+     * NOTE: does not include the keyword "abstract" or "final".
154
+     * 
155
+     * @return string
156
+     */
157 157
     public function getDeclaration() : string
158 158
     {
159 159
         $parts = array();
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
         return implode(' ', $parts);
174 174
     }
175 175
     
176
-   /**
177
-    * The keyword before "class", e.g. "abstract".
178
-    * @return string
179
-    */
176
+    /**
177
+     * The keyword before "class", e.g. "abstract".
178
+     * @return string
179
+     */
180 180
     public function getKeyword() : string
181 181
     {
182 182
         return $this->keyword;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $name = $this->getName();
107 107
         
108
-        if($this->info->hasNamespace()) {
108
+        if ($this->info->hasNamespace()) {
109 109
             $name = $this->info->getNamespace().'\\'.$this->name;
110 110
         }
111 111
         
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
         $parts[] = 'class';
161 161
         $parts[] = $this->getName();
162 162
         
163
-        if(!empty($this->extends)) {
163
+        if (!empty($this->extends)) {
164 164
             $parts[] = 'extends';
165 165
             $parts[] = $this->extends;
166 166
         }
167 167
         
168
-        if(!empty($this->implements)) {
168
+        if (!empty($this->implements)) {
169 169
             $parts[] = 'implements';
170 170
             $parts[] = implode(', ', $this->implements);
171 171
         }
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
     
185 185
     protected function analyzeCode()
186 186
     {
187
-        if($this->keyword == 'abstract') {
187
+        if ($this->keyword == 'abstract') {
188 188
             $this->abstract = true;
189
-        } else if($this->keyword == 'final') {
189
+        } else if ($this->keyword == 'final') {
190 190
             $this->final = true;
191 191
         }
192 192
         
@@ -203,16 +203,16 @@  discard block
 block discarded – undo
203 203
         
204 204
         $tokenName = 'none';
205 205
         
206
-        foreach($parts as $part)
206
+        foreach ($parts as $part)
207 207
         {
208 208
             $part = str_replace(',', '', $part);
209 209
             $part = trim($part);
210
-            if(empty($part)) {
210
+            if (empty($part)) {
211 211
                 continue;
212 212
             }
213 213
             
214 214
             $name = strtolower($part);
215
-            if($name == 'extends' || $name == 'implements') {
215
+            if ($name == 'extends' || $name == 'implements') {
216 216
                 $tokenName = $name;
217 217
                 continue;
218 218
             }
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
         
223 223
         $this->implements = $tokens['implements'];
224 224
         
225
-        if(!empty($this->implements)) {
225
+        if (!empty($this->implements)) {
226 226
             usort($this->implements, function(string $a, string $b) {
227 227
                 return strnatcasecmp($a, $b);
228 228
             });
229 229
         }
230 230
         
231
-        if(!empty($tokens['extends'])) {
231
+        if (!empty($tokens['extends'])) {
232 232
             $this->extends = $tokens['extends'][0];
233 233
         }
234 234
     }
Please login to merge, or discard this patch.
src/ImageHelper/Size.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,23 +18,23 @@  discard block
 block discarded – undo
18 18
     
19 19
     public function __construct(array $size)
20 20
     {
21
-        if(!isset($size['width'])) {
21
+        if (!isset($size['width'])) {
22 22
             $size['width'] = $size[0];
23 23
         }
24 24
         
25
-        if(!isset($size['height'])) {
25
+        if (!isset($size['height'])) {
26 26
             $size['height'] = $size[1];
27 27
         }
28 28
         
29
-        if(!isset($size[0])) {
29
+        if (!isset($size[0])) {
30 30
             $size[0] = $size['width'];
31 31
         }
32 32
         
33
-        if(!isset($size[1])) {
33
+        if (!isset($size[1])) {
34 34
             $size[1] = $size['height'];
35 35
         }
36 36
         
37
-        if(!isset($size['channels'])) {
37
+        if (!isset($size['channels'])) {
38 38
             $size['channels'] = 1;
39 39
         }
40 40
         
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     
69 69
     public function offsetGet($offset)
70 70
     {
71
-        if(isset($this->size[$offset])) {
71
+        if (isset($this->size[$offset])) {
72 72
             return $this->size[$offset];
73 73
         }
74 74
         
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     
78 78
     public function offsetSet($offset, $value)
79 79
     {
80
-        if(is_null($offset)) {
80
+        if (is_null($offset)) {
81 81
             $this->size[] = $value;
82 82
         } else {
83 83
             $this->size[$offset] = $value;
Please login to merge, or discard this patch.
examples/URLInfo/highlighting.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
  * @author Sebastian Mordziol <[email protected]>
8 8
  */
9 9
 
10
-   /**
11
-    * Examples environment config
12
-    */
10
+    /**
11
+     * Examples environment config
12
+     */
13 13
     require_once '../prepend.php';
14 14
 
15 15
     use function AppUtils\parseURL;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 		<br>
43 43
         <?php
44 44
         
45
-            foreach($urls as $url)
45
+            foreach ($urls as $url)
46 46
             {
47 47
                 $info = parseURL($url);
48 48
                 
Please login to merge, or discard this patch.
examples/prepend.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@
 block discarded – undo
17 17
         die('<b>ERROR:</b> Autoloader not present. Run composer update first.');
18 18
     }
19 19
     
20
-   /**
21
-    * The composer autoloader
22
-    */
20
+    /**
21
+     * The composer autoloader
22
+     */
23 23
     require_once $autoload;
24 24
 
25
-   /**
26
-    * Translation global function.
27
-    * @return string
28
-    */
25
+    /**
26
+     * Translation global function.
27
+     * @return string
28
+     */
29 29
     function t()
30 30
     {
31 31
         return call_user_func_array('\AppLocalize\t', func_get_args());
32 32
     }
33 33
     
34
-   /**
35
-    * Translation global function.
36
-    * @return string
37
-    */
34
+    /**
35
+     * Translation global function.
36
+     * @return string
37
+     */
38 38
     function pt()
39 39
     {
40 40
         return call_user_func_array('\AppLocalize\pt', func_get_args());
41 41
     }
42 42
     
43
-   /**
44
-    * Translation global function.
45
-    * @return string
46
-    */
43
+    /**
44
+     * Translation global function.
45
+     * @return string
46
+     */
47 47
     function pts()
48 48
     {
49 49
         return call_user_func_array('\AppLocalize\pts', func_get_args());
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     $autoload = realpath($root.'/../vendor/autoload.php');
13 13
     
14 14
     // we need the autoloader to be present
15
-    if($autoload === false) 
15
+    if ($autoload === false) 
16 16
     {
17 17
         die('<b>ERROR:</b> Autoloader not present. Run composer update first.');
18 18
     }
Please login to merge, or discard this patch.
src/CSVHelper.php 2 patches
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
         
51 51
     }
52 52
 
53
-   /**
54
-    * Creates and returns a new instance of the CSV builder which
55
-    * can be used to build CSV from scratch.
56
-    * 
57
-    * @return CSVHelper_Builder
58
-    */
53
+    /**
54
+     * Creates and returns a new instance of the CSV builder which
55
+     * can be used to build CSV from scratch.
56
+     * 
57
+     * @return CSVHelper_Builder
58
+     */
59 59
     public static function createBuilder()
60 60
     {
61 61
         return new CSVHelper_Builder();
62 62
     }
63 63
 
64
-   /**
65
-    * @var string
66
-    */
64
+    /**
65
+     * @var string
66
+     */
67 67
     protected $csv = '';
68 68
     
69 69
     protected $data = array();
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
     
73 73
     protected $headersPosition = self::HEADERS_NONE;
74 74
     
75
-   /**
76
-    * Loads CSV data from a string. 
77
-    * 
78
-    * Note: Use the {@link hasErrors()} method to 
79
-    * check if the string could be parsed correctly
80
-    * afterwards.
81
-    * 
82
-    * @param string $string
83
-    * @return CSVHelper
84
-    */
75
+    /**
76
+     * Loads CSV data from a string. 
77
+     * 
78
+     * Note: Use the {@link hasErrors()} method to 
79
+     * check if the string could be parsed correctly
80
+     * afterwards.
81
+     * 
82
+     * @param string $string
83
+     * @return CSVHelper
84
+     */
85 85
     public function loadString($string)
86 86
     {
87 87
         // remove any UTF byte order marks that may still be present in the string
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
         return $this;
96 96
     }
97 97
     
98
-   /**
99
-    * Loads CSV data from a file.
100
-    * 
101
-    * Note: Use the {@link hasErrors()} method to 
102
-    * check if the string could be parsed correctly
103
-    * afterwards.
104
-    * 
105
-    * @param string $file
106
-    * @throws FileHelper_Exception
107
-    * @return CSVHelper
108
-    * 
109
-    * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
110
-    * @see FileHelper::ERROR_CANNOT_READ_FILE_CONTENTS
111
-    */
98
+    /**
99
+     * Loads CSV data from a file.
100
+     * 
101
+     * Note: Use the {@link hasErrors()} method to 
102
+     * check if the string could be parsed correctly
103
+     * afterwards.
104
+     * 
105
+     * @param string $file
106
+     * @throws FileHelper_Exception
107
+     * @return CSVHelper
108
+     * 
109
+     * @see FileHelper::ERROR_FILE_DOES_NOT_EXIST
110
+     * @see FileHelper::ERROR_CANNOT_READ_FILE_CONTENTS
111
+     */
112 112
     public function loadFile(string $file) : CSVHelper
113 113
     {
114 114
         $csv = FileHelper::readContents($file);
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
     
123 123
     protected $rowCount = 0;
124 124
     
125
-   /**
126
-    * Specifies that headers are positioned on top, horizontally.
127
-    * @return CSVHelper
128
-    */
125
+    /**
126
+     * Specifies that headers are positioned on top, horizontally.
127
+     * @return CSVHelper
128
+     */
129 129
     public function setHeadersTop()
130 130
     {
131 131
         return $this->setHeadersPosition(self::HEADERS_TOP);
132 132
     }
133 133
     
134
-   /**
135
-    * Specifies that headers are positioned on the left, vertically.
136
-    * @return CSVHelper
137
-    */
134
+    /**
135
+     * Specifies that headers are positioned on the left, vertically.
136
+     * @return CSVHelper
137
+     */
138 138
     public function setHeadersLeft()
139 139
     {
140 140
         return $this->setHeadersPosition(self::HEADERS_LEFT);
141 141
     }
142 142
     
143
-   /**
144
-    * Specifies that there are no headers in the file (default).
145
-    * @return CSVHelper
146
-    */
143
+    /**
144
+     * Specifies that there are no headers in the file (default).
145
+     * @return CSVHelper
146
+     */
147 147
     public function setHeadersNone()
148 148
     {
149 149
         return $this->setHeadersPosition(self::HEADERS_NONE);
@@ -173,18 +173,18 @@  discard block
 block discarded – undo
173 173
         return false;
174 174
     }
175 175
     
176
-   /**
177
-    * Specifies where the headers are positioned in the
178
-    * CSV, or turns them off entirely. Use the class constants
179
-    * to ensure the value is correct.
180
-    * 
181
-    * @param string $position
182
-    * @throws CSVHelper_Exception
183
-    * @return CSVHelper
184
-    * @see CSVHelper::HEADERS_LEFT
185
-    * @see CSVHelper::HEADERS_TOP
186
-    * @see CSVHelper::HEADERS_NONE
187
-    */
176
+    /**
177
+     * Specifies where the headers are positioned in the
178
+     * CSV, or turns them off entirely. Use the class constants
179
+     * to ensure the value is correct.
180
+     * 
181
+     * @param string $position
182
+     * @throws CSVHelper_Exception
183
+     * @return CSVHelper
184
+     * @see CSVHelper::HEADERS_LEFT
185
+     * @see CSVHelper::HEADERS_TOP
186
+     * @see CSVHelper::HEADERS_NONE
187
+     */
188 188
     public function setHeadersPosition($position)
189 189
     {
190 190
         $validPositions = array(
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
         return $this;
212 212
     }
213 213
     
214
-   /**
215
-    * Resets all internal data, allowing to start entirely anew
216
-    * with a new file, or to start building a new CSV file from
217
-    * scratch.
218
-    * 
219
-    * @return CSVHelper
220
-    */
214
+    /**
215
+     * Resets all internal data, allowing to start entirely anew
216
+     * with a new file, or to start building a new CSV file from
217
+     * scratch.
218
+     * 
219
+     * @return CSVHelper
220
+     */
221 221
     public function reset()
222 222
     {
223 223
         $this->data = array();
@@ -234,19 +234,19 @@  discard block
 block discarded – undo
234 234
         return $this->data;
235 235
     }
236 236
     
237
-   /**
238
-    * Retrieves the row at the specified index.
239
-    * If there is no data at the index, this will
240
-    * return an array populated with empty strings
241
-    * for all available columns.
242
-    * 
243
-    * Tip: Use the {@link rowExists()} method to check
244
-    * whether the specified row exists.
245
-    * 
246
-    * @param integer $index
247
-    * @return array()
248
-    * @see rowExists()
249
-    */
237
+    /**
238
+     * Retrieves the row at the specified index.
239
+     * If there is no data at the index, this will
240
+     * return an array populated with empty strings
241
+     * for all available columns.
242
+     * 
243
+     * Tip: Use the {@link rowExists()} method to check
244
+     * whether the specified row exists.
245
+     * 
246
+     * @param integer $index
247
+     * @return array()
248
+     * @see rowExists()
249
+     */
250 250
     public function getRow($index)
251 251
     {
252 252
         if(isset($this->data[$index])) {
@@ -256,63 +256,63 @@  discard block
 block discarded – undo
256 256
         return array_fill(0, $this->rowCount, '');
257 257
     }
258 258
     
259
-   /**
260
-    * Checks whether the specified row exists in the data set.
261
-    * @param integer $index
262
-    * @return boolean
263
-    */
259
+    /**
260
+     * Checks whether the specified row exists in the data set.
261
+     * @param integer $index
262
+     * @return boolean
263
+     */
264 264
     public function rowExists($index)
265 265
     {
266 266
         return isset($this->data[$index]);
267 267
     }
268 268
     
269
-   /**
270
-    * Counts the amount of rows in the parsed CSV,
271
-    * excluding the headers if any, depending on 
272
-    * their position.
273
-    * 
274
-    * @return integer
275
-    */
269
+    /**
270
+     * Counts the amount of rows in the parsed CSV,
271
+     * excluding the headers if any, depending on 
272
+     * their position.
273
+     * 
274
+     * @return integer
275
+     */
276 276
     public function countRows()
277 277
     {
278 278
         return $this->rowCount;
279 279
     }
280 280
     
281
-   /**
282
-    * Counts the amount of rows in the parsed CSV, 
283
-    * excluding the headers if any, depending on
284
-    * their position.
285
-    * 
286
-    * @return integer
287
-    */
281
+    /**
282
+     * Counts the amount of rows in the parsed CSV, 
283
+     * excluding the headers if any, depending on
284
+     * their position.
285
+     * 
286
+     * @return integer
287
+     */
288 288
     public function countColumns()
289 289
     {
290 290
         return $this->columnCount;
291 291
     }
292 292
     
293
-   /**
294
-    * Retrieves the headers, if any. Specify the position of the
295
-    * headers first to ensure this works correctly.
296
-    * 
297
-    * @return array Indexed array with header names.
298
-    */
293
+    /**
294
+     * Retrieves the headers, if any. Specify the position of the
295
+     * headers first to ensure this works correctly.
296
+     * 
297
+     * @return array Indexed array with header names.
298
+     */
299 299
     public function getHeaders()
300 300
     {
301 301
         return $this->headers;
302 302
     }
303 303
     
304
-   /**
305
-    * Retrieves the column at the specified index. If there
306
-    * is no column at the index, this returns an array
307
-    * populated with empty strings.
308
-    * 
309
-    * Tip: Use the {@link columnExists()} method to check
310
-    * whether a column exists.
311
-    * 
312
-    * @param integer $index
313
-    * @return string[]
314
-    * @see columnExists()
315
-    */
304
+    /**
305
+     * Retrieves the column at the specified index. If there
306
+     * is no column at the index, this returns an array
307
+     * populated with empty strings.
308
+     * 
309
+     * Tip: Use the {@link columnExists()} method to check
310
+     * whether a column exists.
311
+     * 
312
+     * @param integer $index
313
+     * @return string[]
314
+     * @see columnExists()
315
+     */
316 316
     public function getColumn($index)
317 317
     {
318 318
         $data = array();
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
         return $data;
329 329
     }
330 330
     
331
-   /**
332
-    * Checks whether the specified column exists in the data set.
333
-    * @param integer $index
334
-    * @return boolean
335
-    */
331
+    /**
332
+     * Checks whether the specified column exists in the data set.
333
+     * @param integer $index
334
+     * @return boolean
335
+     */
336 336
     public function columnExists($index)
337 337
     {
338 338
         if($index < $this->columnCount) {
@@ -396,22 +396,22 @@  discard block
 block discarded – undo
396 396
         }
397 397
     }
398 398
     
399
-   /**
400
-    * Checks whether any errors have been encountered
401
-    * while parsing the CSV.
402
-    * 
403
-    * @return boolean
404
-    * @see getErrorMessages()
405
-    */
399
+    /**
400
+     * Checks whether any errors have been encountered
401
+     * while parsing the CSV.
402
+     * 
403
+     * @return boolean
404
+     * @see getErrorMessages()
405
+     */
406 406
     public function hasErrors()
407 407
     {
408 408
         return !empty($this->errors);
409 409
     }
410 410
     
411
-   /**
412
-    * Retrieves all error messages.
413
-    * @return array
414
-    */
411
+    /**
412
+     * Retrieves all error messages.
413
+     * @return array
414
+     */
415 415
     public function getErrorMessages()
416 416
     {
417 417
         return $this->errors;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     
167 167
     public function isHeadersPosition($position)
168 168
     {
169
-        if($this->headersPosition === $position) {
169
+        if ($this->headersPosition === $position) {
170 170
             return true;
171 171
         }
172 172
         
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
             self::HEADERS_TOP
194 194
         );
195 195
         
196
-        if(!in_array($position, $validPositions)) {
196
+        if (!in_array($position, $validPositions)) {
197 197
             throw new CSVHelper_Exception(
198 198
                 'Invalid headers position',
199 199
                 sprintf(
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     */
250 250
     public function getRow($index)
251 251
     {
252
-        if(isset($this->data[$index])) {
252
+        if (isset($this->data[$index])) {
253 253
             return $this->data[$index];
254 254
         }
255 255
         
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
     public function getColumn($index)
317 317
     {
318 318
         $data = array();
319
-        for($i=0; $i < $this->rowCount; $i++) {
319
+        for ($i = 0; $i < $this->rowCount; $i++) {
320 320
             $value = '';
321
-            if(isset($this->data[$i][$index])) {
321
+            if (isset($this->data[$i][$index])) {
322 322
                 $value = $this->data[$i][$index];
323 323
             }
324 324
             
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
     */
336 336
     public function columnExists($index)
337 337
     {
338
-        if($index < $this->columnCount) {
338
+        if ($index < $this->columnCount) {
339 339
             return true;
340 340
         }
341 341
         
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
     {
347 347
         $this->reset();
348 348
         
349
-        if(empty(trim($this->csv))) {
349
+        if (empty(trim($this->csv))) {
350 350
             $this->addError('Tried to parse an empty CSV string.');
351 351
             return;
352 352
         }
@@ -361,12 +361,12 @@  discard block
 block discarded – undo
361 361
         $parser->delimiter = $this->detectSeparator();
362 362
         
363 363
         $result = $parser->parse_string(/** @scrutinizer ignore-type */ $this->csv);
364
-        if(!$result) {
364
+        if (!$result) {
365 365
             $this->addError('The CSV string could not be parsed.');
366 366
             return;
367 367
         }
368 368
         
369
-        switch($this->headersPosition)
369
+        switch ($this->headersPosition)
370 370
         {
371 371
             case self::HEADERS_TOP:
372 372
                 $this->headers = array_shift($result);
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
             case self::HEADERS_LEFT:
376 376
                 $keep = array();
377 377
                 $total = count($result);
378
-                for($i=0; $i < $total; $i++) {
378
+                for ($i = 0; $i < $total; $i++) {
379 379
                     $row = $result[$i];
380 380
                     $this->headers[] = array_shift($row);
381 381
                     $keep[] = $row;
@@ -388,9 +388,9 @@  discard block
 block discarded – undo
388 388
         $this->data = $result;
389 389
         $this->rowCount = count($this->data);
390 390
         
391
-        for($i=0; $i < $this->rowCount; $i++) {
391
+        for ($i = 0; $i < $this->rowCount; $i++) {
392 392
             $amount = count($this->data[$i]);
393
-            if($amount > $this->columnCount) {
393
+            if ($amount > $this->columnCount) {
394 394
                 $this->columnCount = $amount;
395 395
             }
396 396
         }
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
             ',,' => ','
435 435
         );
436 436
         
437
-        foreach($search as $char => $separator) {
438
-            if(strstr($this->csv, $char)) {
437
+        foreach ($search as $char => $separator) {
438
+            if (strstr($this->csv, $char)) {
439 439
                 return $separator;
440 440
             }
441 441
         }
Please login to merge, or discard this patch.