Passed
Push — master ( 9d70d1...e76473 )
by Sebastian
03:43
created
src/SVNHelper/Command.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
     public const SVN_ERROR_TYPE_WARNING = 'warning';
22 22
     
23 23
     /**
24
-    * @var SVNHelper
25
-    */
24
+     * @var SVNHelper
25
+     */
26 26
     protected $helper;
27 27
     
28
-   /**
29
-    * @var SVNHelper_Target
30
-    */
28
+    /**
29
+     * @var SVNHelper_Target
30
+     */
31 31
     protected $target;
32 32
     
33
-   /**
34
-    * @var SVNHelper_CommandResult|NULL
35
-    */
33
+    /**
34
+     * @var SVNHelper_CommandResult|NULL
35
+     */
36 36
     protected ?SVNHelper_CommandResult $result;
37 37
     
38 38
     public function __construct(SVNHelper $helper, SVNHelper_Target $target)
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
         $this->target = $target;
42 42
     }
43 43
     
44
-   /**
45
-    * @return SVNHelper
46
-    */
44
+    /**
45
+     * @return SVNHelper
46
+     */
47 47
     public function getSVN()
48 48
     {
49 49
         return $this->helper;
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
         return $cmd;
101 101
     }
102 102
 
103
-   /**
104
-    * Executes the specified command, and returns a result
105
-    * instance to read the results.
106
-    * 
107
-    * @param string $mode The command mode, e.g. commit / update...
108
-    * @param string $path The path to apply the command to
109
-    * @param array $params
110
-    * @return SVNHelper_CommandResult
111
-    */
103
+    /**
104
+     * Executes the specified command, and returns a result
105
+     * instance to read the results.
106
+     * 
107
+     * @param string $mode The command mode, e.g. commit / update...
108
+     * @param string $path The path to apply the command to
109
+     * @param array $params
110
+     * @return SVNHelper_CommandResult
111
+     */
112 112
     protected function execCommand($mode, $path=null, $params=array())
113 113
     {
114 114
         $relative = $this->helper->relativizePath($path);
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
         return $this->result;
196 196
     }
197 197
     
198
-   /**
199
-    * Retrieves the type of command, e.g. "Commit"
200
-    * @return string
201
-    */
198
+    /**
199
+     * Retrieves the type of command, e.g. "Commit"
200
+     * @return string
201
+     */
202 202
     public function getType()
203 203
     {
204 204
         return str_replace('SVNHelper_Command_', '', get_class($this));   
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     
57 57
     public function execute()
58 58
     {
59
-        if(isset($this->result))
59
+        if (isset($this->result))
60 60
         {
61 61
             return $this->result;
62 62
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         putenv('LC_ALL='.$locale);
68 68
         
69 69
         $this->result = $this->_execute();
70
-        if(!$this->result instanceof SVNHelper_CommandResult) {
70
+        if (!$this->result instanceof SVNHelper_CommandResult) {
71 71
             throw new SVNHelper_Exception(
72 72
                 'Not a valid SVN command result',
73 73
                 sprintf(
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     
84 84
     abstract protected function _execute();
85 85
 
86
-    protected function buildCommand($mode, $path=null, $params=array())
86
+    protected function buildCommand($mode, $path = null, $params = array())
87 87
     {
88 88
         $params[] = 'non-interactive';
89 89
         $params[] = 'username '.$this->helper->getAuthUser();
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         
92 92
         $cmd = 'svn '.$mode.' '.$path.' ';
93 93
         
94
-        foreach($params as $param) {
94
+        foreach ($params as $param) {
95 95
             $cmd .= '--'.$param.' ';
96 96
         }
97 97
         
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     * @param array $params
110 110
     * @return SVNHelper_CommandResult
111 111
     */
112
-    protected function execCommand($mode, $path=null, $params=array())
112
+    protected function execCommand($mode, $path = null, $params = array())
113 113
     {
114 114
         $relative = $this->helper->relativizePath($path);
115 115
         
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         exec($cmd, $output);
125 125
         
126 126
         $lines = array();
127
-        foreach($output as $line) {
127
+        foreach ($output as $line) {
128 128
             $lines[] = mb_strtolower(trim(utf8_encode($line)));
129 129
         }
130 130
         
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         //
137 137
         // Can happen for example when the path is not under version
138 138
         // control.
139
-        if(isset($lines[0]) && substr($lines[0], 0, 7) == 'skipped')
139
+        if (isset($lines[0]) && substr($lines[0], 0, 7) == 'skipped')
140 140
         {
141 141
             $tokens = explode('--', $lines[0]);
142 142
             $message = trim(array_pop($tokens));
@@ -157,20 +157,20 @@  discard block
 block discarded – undo
157 157
         // svn: w123456: warning message
158 158
         else
159 159
         {
160
-            foreach($lines as $line) 
160
+            foreach ($lines as $line) 
161 161
             {
162
-                if(strstr($line, 'svn:')) 
162
+                if (strstr($line, 'svn:')) 
163 163
                 {
164 164
                     $result = array();
165 165
                     preg_match_all('/svn:[ ]*(e|warning:[ ]*w)([0-9]+):(.*)/', $line, $result, PREG_PATTERN_ORDER);
166 166
                     
167
-                    if(isset($result[1]) && isset($result[1][0])) 
167
+                    if (isset($result[1]) && isset($result[1][0])) 
168 168
                     {
169 169
                         $message = trim($result[3][0]);
170 170
                         $code = trim($result[2][0]);
171 171
                         $type = self::SVN_ERROR_TYPE_ERROR;
172 172
                         
173
-                        if($result[1][0] != 'e') {
173
+                        if ($result[1][0] != 'e') {
174 174
                             $type = self::SVN_ERROR_TYPE_WARNING;
175 175
                         }
176 176
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         
184 184
         $result = new SVNHelper_CommandResult($this, $cmd, $lines, $errorMessages);
185 185
         
186
-        if($result->isError()) {
186
+        if ($result->isError()) {
187 187
             $this->log(sprintf('[%s] | Command returned errors.', $relative));
188 188
         } 
189 189
         
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     
207 207
     protected function throwExceptionUnexpected(SVNHelper_CommandResult $result)
208 208
     {
209
-        if($result->isConnectionFailed()) {
209
+        if ($result->isConnectionFailed()) {
210 210
             $this->throwException(
211 211
                 t('Could not connect to the remote SVN repository'), 
212 212
                 '', 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             );
216 216
         }
217 217
         
218
-        if($result->hasConflicts()) {
218
+        if ($result->hasConflicts()) {
219 219
             $this->throwException(
220 220
                 t('SVN command reported conflicts'), 
221 221
                 '', 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             );
225 225
         }
226 226
         
227
-        if($result->hasLocks()) {
227
+        if ($result->hasLocks()) {
228 228
             $this->throwException(
229 229
                 t('The target SVN folder or file is locked.'), 
230 230
                 '', 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         );
242 242
     }
243 243
     
244
-    protected function throwException($message, $details, $code, SVNHelper_CommandResult $result, $previous=null)
244
+    protected function throwException($message, $details, $code, SVNHelper_CommandResult $result, $previous = null)
245 245
     {
246 246
         $body = 
247 247
         '<p>'.
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
         '</p>'.
257 257
         '<ul>';
258 258
             $errors = $result->getErrorMessages();
259
-            foreach($errors as $error) {
259
+            foreach ($errors as $error) {
260 260
                 $body .= 
261 261
                 '<li>'.
262 262
                     $error.
Please login to merge, or discard this patch.
src/SVNHelper/CommandError.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
     public function hasAnyErrorCode(array $codes) : bool
120 120
     {
121 121
         $items = array();
122
-        foreach($codes as $code) {
122
+        foreach ($codes as $code) {
123 123
             $items[] = $this->filterCode($code);
124 124
         }
125 125
         
Please login to merge, or discard this patch.
src/FileHelper/FolderInfo.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function factory(string $path) : FolderInfo
27 27
     {
28
-        if(!isset(self::$infoCache[$path]))
28
+        if (!isset(self::$infoCache[$path]))
29 29
         {
30 30
             self::$infoCache[$path] = new FolderInfo($path);
31 31
         }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         parent::__construct($path);
56 56
 
57
-        if(!self::is_dir($this->path))
57
+        if (!self::is_dir($this->path))
58 58
         {
59 59
             throw new FileHelper_Exception(
60 60
                 'Not a folder',
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $path = trim($path);
78 78
 
79
-        if($path === '' || $path === '.' || $path === '..')
79
+        if ($path === '' || $path === '.' || $path === '..')
80 80
         {
81 81
             return false;
82 82
         }
83 83
 
84
-        if(is_dir($path))
84
+        if (is_dir($path))
85 85
         {
86 86
             return true;
87 87
         }
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function delete() : FolderInfo
101 101
     {
102
-        if(!$this->exists())
102
+        if (!$this->exists())
103 103
         {
104 104
             return $this;
105 105
         }
106 106
 
107
-        if(rmdir($this->path))
107
+        if (rmdir($this->path))
108 108
         {
109 109
             return $this;
110 110
         }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function create() : FolderInfo
132 132
     {
133
-        if(is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path))
133
+        if (is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path))
134 134
         {
135 135
             return $this;
136 136
         }
Please login to merge, or discard this patch.
src/FileHelper/FolderTree.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public static function delete(string $rootFolder) : bool
21 21
     {
22
-        if(!file_exists($rootFolder))
22
+        if (!file_exists($rootFolder))
23 23
         {
24 24
             return true;
25 25
         }
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
         foreach ($d as $item)
30 30
         {
31
-            if(self::processDeleteItem($item) === false)
31
+            if (self::processDeleteItem($item) === false)
32 32
             {
33 33
                 return false;
34 34
             }
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 
112 112
         if ($item->isDir())
113 113
         {
114
-            self::copy($itemPath, $target . '/' . $baseName);
114
+            self::copy($itemPath, $target.'/'.$baseName);
115 115
         }
116
-        else if($item->isFile())
116
+        else if ($item->isFile())
117 117
         {
118
-            FileHelper::copyFile($itemPath, $target . '/' . $baseName);
118
+            FileHelper::copyFile($itemPath, $target.'/'.$baseName);
119 119
         }
120 120
     }
121 121
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@  discard block
 block discarded – undo
65 65
             try
66 66
             {
67 67
                 FileHelper::deleteFile($itemPath);
68
-            }
69
-            catch (FileHelper_Exception $e)
68
+            } catch (FileHelper_Exception $e)
70 69
             {
71 70
                 return false;
72 71
             }
@@ -112,8 +111,7 @@  discard block
 block discarded – undo
112 111
         if ($item->isDir())
113 112
         {
114 113
             self::copy($itemPath, $target . '/' . $baseName);
115
-        }
116
-        else if($item->isFile())
114
+        } else if($item->isFile())
117 115
         {
118 116
             FileHelper::copyFile($itemPath, $target . '/' . $baseName);
119 117
         }
Please login to merge, or discard this patch.
src/FileHelper/FolderFinder.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function __construct($path)
30 30
     {
31
-        if($path instanceof FolderInfo)
31
+        if ($path instanceof FolderInfo)
32 32
         {
33 33
             $this->folder = $path;
34 34
         }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         );
47 47
     }
48 48
 
49
-    public function makeRecursive(bool $recursive=true) : self
49
+    public function makeRecursive(bool $recursive = true) : self
50 50
     {
51 51
         return $this->setOption(self::OPTION_RECURSIVE, $recursive);
52 52
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
         $result = array();
78 78
 
79
-        foreach($this->folders as $folder)
79
+        foreach ($this->folders as $folder)
80 80
         {
81 81
             $result[] = $this->resolvePath($folder);
82 82
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
     private function resolvePath(FolderInfo $folder) : string
98 98
     {
99
-        if(!$this->isPathModeAbsolute())
99
+        if (!$this->isPathModeAbsolute())
100 100
         {
101 101
             return $folder->getRelativeTo($this->folder);
102 102
         }
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $d = new DirectoryIterator($folder->getPath());
119 119
 
120
-        foreach($d as $item)
120
+        foreach ($d as $item)
121 121
         {
122
-            if($item->isDir() && !$item->isDot())
122
+            if ($item->isDir() && !$item->isDot())
123 123
             {
124 124
                 $this->processFolder(FileHelper::getFolderInfo($item->getPathname()));
125 125
             }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $this->folders[] = $folder;
142 142
 
143
-        if($this->isRecursive())
143
+        if ($this->isRecursive())
144 144
         {
145 145
             $this->scanFolder($folder);
146 146
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@
 block discarded – undo
31 31
         if($path instanceof FolderInfo)
32 32
         {
33 33
             $this->folder = $path;
34
-        }
35
-        else
34
+        } else
36 35
         {
37 36
             $this->folder = FileHelper::getFolderInfo(FileHelper::getPathInfo($path)->getPath());
38 37
         }
Please login to merge, or discard this patch.
src/FileHelper/FileFinder.php 3 patches
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -42,23 +42,23 @@  discard block
 block discarded – undo
42 42
     public const OPTION_PATHMODE = 'pathmode';
43 43
 
44 44
     /**
45
-    * @var string
46
-    */
45
+     * @var string
46
+     */
47 47
     protected string $path;
48 48
     
49
-   /**
50
-    * @var string[]
51
-    */
49
+    /**
50
+     * @var string[]
51
+     */
52 52
     protected array $found = array();
53 53
     
54
-   /**
55
-    * The path must exist when the class is instantiated: its
56
-    * real path will be determined to work with.
57
-    * 
58
-    * @param string $path The absolute path to the target folder.
59
-    * @throws FileHelper_Exception
60
-    * @see FileFinder::ERROR_PATH_DOES_NOT_EXIST
61
-    */
54
+    /**
55
+     * The path must exist when the class is instantiated: its
56
+     * real path will be determined to work with.
57
+     * 
58
+     * @param string $path The absolute path to the target folder.
59
+     * @throws FileHelper_Exception
60
+     * @see FileFinder::ERROR_PATH_DOES_NOT_EXIST
61
+     */
62 62
     public function __construct(string $path)
63 63
     {
64 64
         $real = realpath($path);
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
         );
91 91
     }
92 92
     
93
-   /**
94
-    * Enables extension stripping, to return file names without extension.
95
-    * 
96
-    * @return FileFinder
97
-    */
93
+    /**
94
+     * Enables extension stripping, to return file names without extension.
95
+     * 
96
+     * @return FileFinder
97
+     */
98 98
     public function stripExtensions() : FileFinder
99 99
     {
100 100
         return $this->setOption('strip-extensions', true);
@@ -111,46 +111,46 @@  discard block
 block discarded – undo
111 111
         return $this->setOption('recursive', $enabled);
112 112
     }
113 113
     
114
-   /**
115
-    * Retrieves all extensions that were added to
116
-    * the list of included extensions.
117
-    * 
118
-    * @return string[]
119
-    */
114
+    /**
115
+     * Retrieves all extensions that were added to
116
+     * the list of included extensions.
117
+     * 
118
+     * @return string[]
119
+     */
120 120
     public function getIncludeExtensions() : array
121 121
     {
122 122
         return $this->getArrayOption(self::OPTION_INCLUDE_EXTENSIONS);
123 123
     }
124 124
     
125
-   /**
126
-    * Includes a single extension in the file search: only
127
-    * files with this extension will be used in the results.
128
-    * 
129
-    * NOTE: Included extensions take precedence before excluded
130
-    * extensions. If any excluded extensions are specified, they
131
-    * will be ignored.
132
-    * 
133
-    * @param string $extension Extension name, without dot (`php` for example).
134
-    * @return FileFinder
135
-    * @see FileFinder::includeExtensions()
136
-    */
125
+    /**
126
+     * Includes a single extension in the file search: only
127
+     * files with this extension will be used in the results.
128
+     * 
129
+     * NOTE: Included extensions take precedence before excluded
130
+     * extensions. If any excluded extensions are specified, they
131
+     * will be ignored.
132
+     * 
133
+     * @param string $extension Extension name, without dot (`php` for example).
134
+     * @return FileFinder
135
+     * @see FileFinder::includeExtensions()
136
+     */
137 137
     public function includeExtension(string $extension) : FileFinder
138 138
     {
139 139
         return $this->includeExtensions(array($extension));
140 140
     }
141 141
     
142
-   /**
143
-    * Includes several extensions in the file search: only
144
-    * files with these extensions wil be used in the results.
145
-    * 
146
-    * NOTE: Included extensions take precedence before excluded
147
-    * extensions. If any excluded extensions are specified, they
148
-    * will be ignored.
149
-    * 
150
-    * @param string[] $extensions Extension names, without dot (`php` for example).
151
-    * @return FileFinder
152
-    * @see FileFinder::includeExtension()
153
-    */
142
+    /**
143
+     * Includes several extensions in the file search: only
144
+     * files with these extensions wil be used in the results.
145
+     * 
146
+     * NOTE: Included extensions take precedence before excluded
147
+     * extensions. If any excluded extensions are specified, they
148
+     * will be ignored.
149
+     * 
150
+     * @param string[] $extensions Extension names, without dot (`php` for example).
151
+     * @return FileFinder
152
+     * @see FileFinder::includeExtension()
153
+     */
154 154
     public function includeExtensions(array $extensions) : FileFinder
155 155
     {
156 156
         $items = $this->getIncludeExtensions();
@@ -161,37 +161,37 @@  discard block
 block discarded – undo
161 161
         return $this;
162 162
     }
163 163
 
164
-   /**
165
-    * Retrieves a list of all extensions currently set as 
166
-    * excluded from the search.
167
-    * 
168
-    * @return string[]
169
-    */
164
+    /**
165
+     * Retrieves a list of all extensions currently set as 
166
+     * excluded from the search.
167
+     * 
168
+     * @return string[]
169
+     */
170 170
     public function getExcludeExtensions() : array
171 171
     {
172 172
         return $this->getArrayOption(self::OPTION_EXCLUDE_EXTENSIONS);
173 173
     }
174 174
     
175
-   /**
176
-    * Excludes a single extension from the search.
177
-    * 
178
-    * @param string $extension Extension name, without dot (`php` for example).
179
-    * @return FileFinder
180
-    * @see FileFinder::excludeExtensions()
181
-    */
175
+    /**
176
+     * Excludes a single extension from the search.
177
+     * 
178
+     * @param string $extension Extension name, without dot (`php` for example).
179
+     * @return FileFinder
180
+     * @see FileFinder::excludeExtensions()
181
+     */
182 182
     public function excludeExtension(string $extension) : FileFinder
183 183
     {
184 184
         return $this->excludeExtensions(array($extension));
185 185
     }
186 186
 
187
-   /**
188
-    * Add several extensions to the list of extensions to
189
-    * exclude from the file search.
190
-    *  
191
-    * @param string[] $extensions Extension names, without dot (`php` for example).
192
-    * @return FileFinder
193
-    * @see FileFinder::excludeExtension()
194
-    */
187
+    /**
188
+     * Add several extensions to the list of extensions to
189
+     * exclude from the file search.
190
+     *  
191
+     * @param string[] $extensions Extension names, without dot (`php` for example).
192
+     * @return FileFinder
193
+     * @see FileFinder::excludeExtension()
194
+     */
195 195
     public function excludeExtensions(array $extensions) : FileFinder
196 196
     {
197 197
         $items = $this->getExcludeExtensions();
@@ -202,52 +202,52 @@  discard block
 block discarded – undo
202 202
         return $this;
203 203
     }
204 204
     
205
-   /**
206
-    * In this mode, the entire path to the file will be stripped,
207
-    * leaving only the file name in the files list.
208
-    * 
209
-    * @return FileFinder
210
-    */
205
+    /**
206
+     * In this mode, the entire path to the file will be stripped,
207
+     * leaving only the file name in the files list.
208
+     * 
209
+     * @return FileFinder
210
+     */
211 211
     public function setPathmodeStrip() : FileFinder
212 212
     {
213 213
         return $this->setPathmode(self::PATH_MODE_STRIP);
214 214
     }
215 215
     
216
-   /**
217
-    * In this mode, only the path relative to the source folder
218
-    * will be included in the files list.
219
-    * 
220
-    * @return FileFinder
221
-    */
216
+    /**
217
+     * In this mode, only the path relative to the source folder
218
+     * will be included in the files list.
219
+     * 
220
+     * @return FileFinder
221
+     */
222 222
     public function setPathmodeRelative() : FileFinder
223 223
     {
224 224
         return $this->setPathmode(self::PATH_MODE_RELATIVE);
225 225
     }
226 226
     
227
-   /**
228
-    * In this mode, the full, absolute paths to the files will
229
-    * be included in the files list.
230
-    * 
231
-    * @return FileFinder
232
-    */
227
+    /**
228
+     * In this mode, the full, absolute paths to the files will
229
+     * be included in the files list.
230
+     * 
231
+     * @return FileFinder
232
+     */
233 233
     public function setPathmodeAbsolute() : FileFinder
234 234
     {
235 235
         return $this->setPathmode(self::PATH_MODE_ABSOLUTE);
236 236
     }
237 237
     
238
-   /**
239
-    * This sets a character or string to replace the slashes
240
-    * in the paths with. 
241
-    * 
242
-    * This is used for example in the `getPHPClassNames()` 
243
-    * method, to return files from subfolders as class names
244
-    * using the "_" character:
245
-    * 
246
-    * Subfolder/To/File.php => Subfolder_To_File.php
247
-    * 
248
-    * @param string $character
249
-    * @return FileFinder
250
-    */
238
+    /**
239
+     * This sets a character or string to replace the slashes
240
+     * in the paths with. 
241
+     * 
242
+     * This is used for example in the `getPHPClassNames()` 
243
+     * method, to return files from subfolders as class names
244
+     * using the "_" character:
245
+     * 
246
+     * Subfolder/To/File.php => Subfolder_To_File.php
247
+     * 
248
+     * @param string $character
249
+     * @return FileFinder
250
+     */
251 251
     public function setSlashReplacement(string $character) : FileFinder
252 252
     {
253 253
         return $this->setOption('slash-replacement', $character);
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
         return $this->setOption(self::OPTION_PATHMODE, $mode);
271 271
     }
272 272
     
273
-   /**
274
-    * Retrieves a list of all matching file names/paths,
275
-    * depending on the selected options.
276
-    * 
277
-    * @return string[]
278
-    */
273
+    /**
274
+     * Retrieves a list of all matching file names/paths,
275
+     * depending on the selected options.
276
+     * 
277
+     * @return string[]
278
+     */
279 279
     public function getAll() : array
280 280
     {
281 281
         $this->find($this->path, true);
@@ -283,24 +283,24 @@  discard block
 block discarded – undo
283 283
         return $this->found;
284 284
     }
285 285
     
286
-   /**
287
-    * Retrieves only PHP files. Can be combined with other
288
-    * options like enabling recursion into subfolders.
289
-    * 
290
-    * @return string[]
291
-    */
286
+    /**
287
+     * Retrieves only PHP files. Can be combined with other
288
+     * options like enabling recursion into subfolders.
289
+     * 
290
+     * @return string[]
291
+     */
292 292
     public function getPHPFiles() : array
293 293
     {
294 294
         $this->includeExtensions(array('php'));
295 295
         return $this->getAll();
296 296
     }
297 297
     
298
-   /**
299
-    * Generates PHP class names from file paths: it replaces
300
-    * slashes with underscores, and removes file extensions.
301
-    * 
302
-    * @return string[] An array of PHP file names without extension.
303
-    */
298
+    /**
299
+     * Generates PHP class names from file paths: it replaces
300
+     * slashes with underscores, and removes file extensions.
301
+     * 
302
+     * @return string[] An array of PHP file names without extension.
303
+     */
304 304
     public function getPHPClassNames() : array
305 305
     {
306 306
         $this->includeExtensions(array('php'));
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
         return $path;
372 372
     }
373 373
     
374
-   /**
375
-    * Checks whether the specified extension is allowed 
376
-    * with the current settings.
377
-    * 
378
-    * @param string $extension
379
-    * @return bool
380
-    */
374
+    /**
375
+     * Checks whether the specified extension is allowed 
376
+     * with the current settings.
377
+     * 
378
+     * @param string $extension
379
+     * @return bool
380
+     */
381 381
     protected function filterExclusion(string $extension) : bool
382 382
     {
383 383
         $include = $this->getOption(self::OPTION_INCLUDE_EXTENSIONS);
@@ -399,12 +399,12 @@  discard block
 block discarded – undo
399 399
         return true;
400 400
     }
401 401
     
402
-   /**
403
-    * Adjusts the path according to the selected path mode.
404
-    * 
405
-    * @param string $path
406
-    * @return string
407
-    */
402
+    /**
403
+     * Adjusts the path according to the selected path mode.
404
+     * 
405
+     * @param string $path
406
+     * @return string
407
+     */
408 408
     protected function filterPath(string $path) : string
409 409
     {
410 410
         switch($this->getStringOption(self::OPTION_PATHMODE))
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @see \AppUtils\FileHelper\FileFinder
8 8
  */
9 9
 
10
-declare(strict_types = 1);
10
+declare(strict_types=1);
11 11
 
12 12
 namespace AppUtils\FileHelper;
13 13
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $real = realpath($path);
65 65
         
66
-        if($real === false) 
66
+        if ($real === false) 
67 67
         {
68 68
             throw new FileHelper_Exception(
69 69
                 'Target path does not exist',
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      * @param bool $enabled
107 107
      * @return FileFinder
108 108
      */
109
-    public function makeRecursive(bool $enabled=true) : FileFinder
109
+    public function makeRecursive(bool $enabled = true) : FileFinder
110 110
     {
111 111
         return $this->setOption('recursive', $enabled);
112 112
     }
@@ -311,22 +311,22 @@  discard block
 block discarded – undo
311 311
         return $this->getAll();
312 312
     }
313 313
     
314
-    protected function find(string $path, bool $isRoot=false) : void
314
+    protected function find(string $path, bool $isRoot = false) : void
315 315
     {
316
-        if($isRoot) {
316
+        if ($isRoot) {
317 317
             $this->found = array();
318 318
         }
319 319
         
320 320
         $recursive = $this->getBoolOption('recursive');
321 321
         
322 322
         $d = new DirectoryIterator($path);
323
-        foreach($d as $item)
323
+        foreach ($d as $item)
324 324
         {
325 325
             $pathname = $item->getPathname();
326 326
             
327
-            if($item->isDir())
327
+            if ($item->isDir())
328 328
             {
329
-                if($recursive && !$item->isDot()) {
329
+                if ($recursive && !$item->isDot()) {
330 330
                     $this->find($pathname);
331 331
                 }
332 332
                 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             
336 336
             $file = $this->filterFile($pathname);
337 337
             
338
-            if($file !== null) 
338
+            if ($file !== null) 
339 339
             {
340 340
                 $this->found[] = $file;
341 341
             }
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
         
349 349
         $extension = FileHelper::getExtension($path);
350 350
         
351
-        if(!$this->filterExclusion($extension)) {
351
+        if (!$this->filterExclusion($extension)) {
352 352
             return null;
353 353
         }
354 354
         
355 355
         $path = $this->filterPath($path);
356 356
         
357
-        if($this->getOption('strip-extensions') === true)
357
+        if ($this->getOption('strip-extensions') === true)
358 358
         {
359 359
             $path = str_replace('.'.$extension, '', $path);
360 360
         }
361 361
         
362
-        if($path === '') {
362
+        if ($path === '') {
363 363
             return null;
364 364
         }
365 365
         
366 366
         $replace = $this->getOption('slash-replacement');
367
-        if(!empty($replace)) {
367
+        if (!empty($replace)) {
368 368
             $path = str_replace('/', $replace, $path);
369 369
         }
370 370
         
@@ -383,15 +383,15 @@  discard block
 block discarded – undo
383 383
         $include = $this->getOption(self::OPTION_INCLUDE_EXTENSIONS);
384 384
         $exclude = $this->getOption(self::OPTION_EXCLUDE_EXTENSIONS);
385 385
         
386
-        if(!empty($include))
386
+        if (!empty($include))
387 387
         {
388
-            if(!in_array($extension, $include, true)) {
388
+            if (!in_array($extension, $include, true)) {
389 389
                 return false;
390 390
             }
391 391
         }
392
-        else if(!empty($exclude))
392
+        else if (!empty($exclude))
393 393
         {
394
-            if(in_array($extension, $exclude, true)) {
394
+            if (in_array($extension, $exclude, true)) {
395 395
                 return false;
396 396
             }
397 397
         }
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     */
408 408
     protected function filterPath(string $path) : string
409 409
     {
410
-        switch($this->getStringOption(self::OPTION_PATHMODE))
410
+        switch ($this->getStringOption(self::OPTION_PATHMODE))
411 411
         {
412 412
             case self::PATH_MODE_STRIP:
413 413
                 return basename($path);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -388,8 +388,7 @@
 block discarded – undo
388 388
             if(!in_array($extension, $include, true)) {
389 389
                 return false;
390 390
             }
391
-        }
392
-        else if(!empty($exclude))
391
+        } else if(!empty($exclude))
393 392
         {
394 393
             if(in_array($extension, $exclude, true)) {
395 394
                 return false;
Please login to merge, or discard this patch.
src/FileHelper/SerializedFile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
             )
51 51
         );
52 52
 
53
-        if($result !== false) {
53
+        if ($result !== false) {
54 54
             return $result;
55 55
         }
56 56
 
Please login to merge, or discard this patch.
src/FileHelper/CLICommandChecker.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $os = $this->getOS();
61 61
 
62
-        if(isset(self::$osCommands[$os]))
62
+        if (isset(self::$osCommands[$os]))
63 63
         {
64 64
             return self::$osCommands[$os];
65 65
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function exists(string $command) : bool
85 85
     {
86
-        if(isset(self::$checked[$command]))
86
+        if (isset(self::$checked[$command]))
87 87
         {
88 88
             return self::$checked[$command];
89 89
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             $pipes
115 115
         );
116 116
 
117
-        if($process === false)
117
+        if ($process === false)
118 118
         {
119 119
             return '';
120 120
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
         proc_close($process);
128 128
 
129
-        if($stdout === false)
129
+        if ($stdout === false)
130 130
         {
131 131
             return '';
132 132
         }
Please login to merge, or discard this patch.
src/FileHelper/FileInfo.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public static function factory(string $path) : FileInfo
41 41
     {
42
-        if(!isset(self::$infoCache[$path]))
42
+        if (!isset(self::$infoCache[$path]))
43 43
         {
44 44
             self::$infoCache[$path] = new FileInfo($path);
45 45
         }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         parent::__construct($path);
71 71
 
72
-        if(!self::is_file($this->path))
72
+        if (!self::is_file($this->path))
73 73
         {
74 74
             throw new FileHelper_Exception(
75 75
                 'Not a file path',
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $path = trim($path);
85 85
 
86
-        if(empty($path))
86
+        if (empty($path))
87 87
         {
88 88
             return false;
89 89
         }
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
         return is_file($path) || pathinfo($path, PATHINFO_EXTENSION) !== '';
92 92
     }
93 93
 
94
-    public function removeExtension(bool $keepPath=false) : string
94
+    public function removeExtension(bool $keepPath = false) : string
95 95
     {
96
-        if(!$keepPath)
96
+        if (!$keepPath)
97 97
         {
98 98
             return pathinfo($this->getName(), PATHINFO_FILENAME);
99 99
         }
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
         return implode('/', $parts);
108 108
     }
109 109
 
110
-    public function getExtension(bool $lowercase=true) : string
110
+    public function getExtension(bool $lowercase = true) : string
111 111
     {
112 112
         $ext = pathinfo($this->path, PATHINFO_EXTENSION);
113 113
 
114
-        if($lowercase)
114
+        if ($lowercase)
115 115
         {
116 116
             $ext = mb_strtolower($ext);
117 117
         }
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function delete() : FileInfo
129 129
     {
130
-        if(!$this->exists())
130
+        if (!$this->exists())
131 131
         {
132 132
             return $this;
133 133
         }
134 134
 
135
-        if(unlink($this->path))
135
+        if (unlink($this->path))
136 136
         {
137 137
             return $this;
138 138
         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     {
160 160
         $this->checkCopyPrerequisites($targetPath);
161 161
 
162
-        if(copy($this->path, $targetPath))
162
+        if (copy($this->path, $targetPath))
163 163
         {
164 164
             return self::factory($targetPath);
165 165
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public function getLineReader() : LineReader
213 213
     {
214
-        if(!isset($this->lineReader))
214
+        if (!isset($this->lineReader))
215 215
         {
216 216
             $this->lineReader = new LineReader($this);
217 217
         }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
         $result = file_get_contents($this->getPath());
232 232
 
233
-        if($result !== false) {
233
+        if ($result !== false) {
234 234
             return $result;
235 235
         }
236 236
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      */
253 253
     public function putContents(string $content) : FileInfo
254 254
     {
255
-        if($this->exists())
255
+        if ($this->exists())
256 256
         {
257 257
             $this->requireWritable();
258 258
         }
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                 ->requireWritable();
264 264
         }
265 265
 
266
-        if(file_put_contents($this->path, $content) !== false)
266
+        if (file_put_contents($this->path, $content) !== false)
267 267
         {
268 268
             return $this;
269 269
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -255,8 +255,7 @@
 block discarded – undo
255 255
         if($this->exists())
256 256
         {
257 257
             $this->requireWritable();
258
-        }
259
-        else
258
+        } else
260 259
         {
261 260
             FolderInfo::factory(dirname($this->path))
262 261
                 ->create()
Please login to merge, or discard this patch.