Passed
Push — master ( aecd40...074997 )
by Sebastian
10:13 queued 07:17
created
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/UnicodeHandling.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * @var array<string,string>|NULL
29 29
      */
30
-    protected static ?array $utfBoms = null;
30
+    protected static ? array $utfBoms = null;
31 31
 
32 32
     /**
33 33
      * @var string[]|NULL
34 34
      */
35
-    protected static ?array $encodings = null;
35
+    protected static ? array $encodings = null;
36 36
 
37 37
     public function __construct()
38 38
     {
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 
71 71
         fclose($fp);
72 72
 
73
-        foreach(self::$utfBoms as $bom => $value)
73
+        foreach (self::$utfBoms as $bom => $value)
74 74
         {
75
-            if(mb_strpos($text, $value) === 0)
75
+            if (mb_strpos($text, $value) === 0)
76 76
             {
77 77
                 return $bom;
78 78
             }
@@ -83,23 +83,23 @@  discard block
 block discarded – undo
83 83
 
84 84
     private function initBOMs() : void
85 85
     {
86
-        if(isset(self::$utfBoms))
86
+        if (isset(self::$utfBoms))
87 87
         {
88 88
             return;
89 89
         }
90 90
 
91 91
         self::$utfBoms = array(
92
-            'UTF32-BE' => chr(0x00) . chr(0x00) . chr(0xFE) . chr(0xFF),
93
-            'UTF32-LE' => chr(0xFF) . chr(0xFE) . chr(0x00) . chr(0x00),
94
-            'UTF16-BE' => chr(0xFE) . chr(0xFF),
95
-            'UTF16-LE' => chr(0xFF) . chr(0xFE),
96
-            'UTF8' => chr(0xEF) . chr(0xBB) . chr(0xBF)
92
+            'UTF32-BE' => chr(0x00).chr(0x00).chr(0xFE).chr(0xFF),
93
+            'UTF32-LE' => chr(0xFF).chr(0xFE).chr(0x00).chr(0x00),
94
+            'UTF16-BE' => chr(0xFE).chr(0xFF),
95
+            'UTF16-LE' => chr(0xFF).chr(0xFE),
96
+            'UTF8' => chr(0xEF).chr(0xBB).chr(0xBF)
97 97
         );
98 98
     }
99 99
 
100 100
     private function initEncodings() : void
101 101
     {
102
-        if(isset(self::$encodings))
102
+        if (isset(self::$encodings))
103 103
         {
104 104
             return;
105 105
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
         self::$encodings = array();
110 110
 
111
-        foreach($encodings as $string)
111
+        foreach ($encodings as $string)
112 112
         {
113 113
             $withHyphen = str_replace('UTF', 'UTF-', $string);
114 114
 
Please login to merge, or discard this patch.
src/FileHelper/FileInfo/FileSender.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $this->file = $info;
36 36
     }
37 37
 
38
-    public function send(?string $fileName = null, bool $asAttachment=true) : void
38
+    public function send(?string $fileName = null, bool $asAttachment = true) : void
39 39
     {
40 40
         $this->file
41 41
             ->requireExists()
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         header("Cache-Control: public", true);
55 55
         header("Content-Description: File Transfer", true);
56
-        header("Content-Type: " . $this->detectMime(), true);
56
+        header("Content-Type: ".$this->detectMime(), true);
57 57
 
58 58
         header(sprintf(
59 59
             "Content-Disposition: %s; filename=%s",
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
     private function resolveDisposition(bool $asAttachment) : string
71 71
     {
72
-        if($asAttachment)
72
+        if ($asAttachment)
73 73
         {
74 74
             return 'attachment';
75 75
         }
Please login to merge, or discard this patch.
src/FileHelper/FileInfo/LineReader.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 
48 48
         $file = new SplFileObject($this->file->getPath());
49 49
 
50
-        if($file->eof()) {
50
+        if ($file->eof()) {
51 51
             return '';
52 52
         }
53 53
 
54
-        $targetLine = $lineNumber-1;
54
+        $targetLine = $lineNumber - 1;
55 55
 
56 56
         $file->seek($targetLine);
57 57
 
58
-        if($file->key() !== $targetLine)
58
+        if ($file->key() !== $targetLine)
59 59
         {
60 60
             return null;
61 61
         }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $number = $spl->key();
77 77
 
78 78
         // if seeking to the end the cursor is still at 0, there are no lines.
79
-        if($number === 0)
79
+        if ($number === 0)
80 80
         {
81 81
             // since it's a very small file, to get reliable results,
82 82
             // we read its contents and use that to determine what
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
             // that this is not practical to solve with the SplFileObject.
85 85
             $content = file_get_contents($path);
86 86
 
87
-            if(empty($content)) {
87
+            if (empty($content)) {
88 88
                 return 0;
89 89
             }
90 90
         }
91 91
 
92 92
         // return the line number we were able to reach + 1 (key is zero-based)
93
-        return $number+1;
93
+        return $number + 1;
94 94
     }
95 95
 
96 96
     /**
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
      * @return string[]
99 99
      * @throws FileHelper_Exception
100 100
      */
101
-    public function getLines(int $amount=0) : array
101
+    public function getLines(int $amount = 0) : array
102 102
     {
103 103
         $this->file->requireExists();
104 104
 
105 105
         $fn = fopen($this->file->getPath(), 'rb');
106 106
 
107
-        if($fn === false)
107
+        if ($fn === false)
108 108
         {
109 109
             throw new FileHelper_Exception(
110 110
                 'Could not open file for reading.',
@@ -120,19 +120,19 @@  discard block
 block discarded – undo
120 120
         $counter = 0;
121 121
         $first = true;
122 122
 
123
-        while(!feof($fn))
123
+        while (!feof($fn))
124 124
         {
125 125
             $counter++;
126 126
 
127 127
             $line = fgets($fn);
128 128
 
129 129
             // can happen with zero length files
130
-            if($line === false) {
130
+            if ($line === false) {
131 131
                 continue;
132 132
             }
133 133
 
134 134
             // the first line may contain a unicode BOM marker.
135
-            if($first)
135
+            if ($first)
136 136
             {
137 137
                 $line = ConvertHelper::stripUTFBom($line);
138 138
                 $first = false;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
             $result[] = $line;
142 142
 
143
-            if($amount > 0 && $counter === $amount) {
143
+            if ($amount > 0 && $counter === $amount) {
144 144
                 break;
145 145
             }
146 146
         }
Please login to merge, or discard this patch.
src/FileHelper/FileInfo/NameFixer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,13 +49,13 @@
 block discarded – undo
49 49
 
50 50
         $name = str_replace(array_keys($replaces), array_values($replaces), $name);
51 51
 
52
-        while(strpos($name, '  ') !== false) {
52
+        while (strpos($name, '  ') !== false) {
53 53
             $name = str_replace('  ', ' ', $name);
54 54
         }
55 55
 
56 56
         $name = str_replace(array_keys($replaces), array_values($replaces), $name);
57 57
 
58
-        while(strpos($name, '..') !== false) {
58
+        while (strpos($name, '..') !== false) {
59 59
             $name = str_replace('..', '.', $name);
60 60
         }
61 61
 
Please login to merge, or discard this patch.
src/FileHelper/PathsReducer.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @param string[] $paths
37 37
      * @throws FileHelper_Exception
38 38
      */
39
-    public function __construct(array $paths=array())
39
+    public function __construct(array $paths = array())
40 40
     {
41 41
         $this->addPaths($paths);
42 42
     }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function addPaths(array $paths) : PathsReducer
51 51
     {
52
-        foreach($paths as $path) {
52
+        foreach ($paths as $path) {
53 53
             $this->addPath($path);
54 54
         }
55 55
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     {
67 67
         $path = FileHelper::normalizePath($path);
68 68
 
69
-        if(!in_array($path, $this->paths, true)) {
69
+        if (!in_array($path, $this->paths, true)) {
70 70
             $this->paths[] = $path;
71 71
         }
72 72
 
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
     {
84 84
         $split = $this->splitPaths();
85 85
 
86
-        if(empty($split)) {
86
+        if (empty($split)) {
87 87
             return array();
88 88
         }
89 89
 
90
-        while($this->shiftPart($split) === true) {}
90
+        while ($this->shiftPart($split) === true) {}
91 91
 
92 92
         return $this->joinPaths($split);
93 93
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $result = array();
102 102
 
103 103
         foreach ($split as $entry) {
104
-            if(!empty($entry)) {
104
+            if (!empty($entry)) {
105 105
                 $result[] = implode('/', $entry);
106 106
             }
107 107
         }
@@ -118,22 +118,22 @@  discard block
 block discarded – undo
118 118
         $current = null;
119 119
         $result = array();
120 120
 
121
-        foreach($split as $entry)
121
+        foreach ($split as $entry)
122 122
         {
123
-            if(empty($entry)) {
123
+            if (empty($entry)) {
124 124
                 return false;
125 125
             }
126 126
 
127 127
             $part = array_shift($entry);
128
-            if(empty($entry)) {
128
+            if (empty($entry)) {
129 129
                 return false;
130 130
             }
131 131
 
132
-            if($current === null) {
132
+            if ($current === null) {
133 133
                 $current = $part;
134 134
             }
135 135
 
136
-            if($part !== $current) {
136
+            if ($part !== $current) {
137 137
                 return false;
138 138
             }
139 139
 
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $split = array();
154 154
 
155
-        foreach($this->paths as $path) {
155
+        foreach ($this->paths as $path) {
156 156
             $entry = ConvertHelper::explodeTrim('/', $path);
157
-            if(!empty($entry)) {
157
+            if (!empty($entry)) {
158 158
                 $split[] = $entry;
159 159
             }
160 160
         }
Please login to merge, or discard this patch.
src/Traits/AttributableTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
      * @param bool $enabled
75 75
      * @return $this
76 76
      */
77
-    public function prop(string $name, bool $enabled=true) : self
77
+    public function prop(string $name, bool $enabled = true) : self
78 78
     {
79 79
         $this->getAttributes()->prop($name, $enabled);
80 80
         return $this;
Please login to merge, or discard this patch.
src/Traits/Classable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function addClass($name)
43 43
     {
44
-        if(!in_array($name, $this->classes, true)) {
44
+        if (!in_array($name, $this->classes, true)) {
45 45
             $this->classes[] = $name;
46 46
         }
47 47
         
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function addClasses(array $names) : self
56 56
     {
57
-        foreach($names as $name) {
57
+        foreach ($names as $name) {
58 58
             $this->addClass($name);
59 59
         }
60 60
         
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $idx = array_search($name, $this->classes, true);
76 76
         
77
-        if($idx !== false) {
77
+        if ($idx !== false) {
78 78
             unset($this->classes[$idx]);
79 79
             sort($this->classes);
80 80
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     */
109 109
     public function classesToAttribute() : string
110 110
     {
111
-        if(!empty($this->classes))
111
+        if (!empty($this->classes))
112 112
         {
113 113
             return sprintf(
114 114
                 ' class="%s" ',
Please login to merge, or discard this patch.
src/Traits/Optionable.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function setOption(string $name, $value) : self
43 43
     {
44
-        if(!isset($this->options)) {
44
+        if (!isset($this->options)) {
45 45
             $this->options = $this->getDefaultOptions();
46 46
         }
47 47
         
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     */
59 59
     public function setOptions(array $options) : self
60 60
     {
61
-        foreach($options as $name => $value) {
61
+        foreach ($options as $name => $value) {
62 62
             $this->setOption($name, $value);
63 63
         }
64 64
         
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
     * @param mixed $default The default value to return if the option does not exist.
76 76
     * @return mixed
77 77
     */
78
-    public function getOption(string $name, $default=null)
78
+    public function getOption(string $name, $default = null)
79 79
     {
80
-        if(!isset($this->options))
80
+        if (!isset($this->options))
81 81
         {
82 82
             $this->options = $this->getDefaultOptions();
83 83
         }
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
     * @param string $default Used if the option does not exist, is invalid, or empty.
96 96
     * @return string
97 97
     */
98
-    public function getStringOption(string $name, string $default='') : string
98
+    public function getStringOption(string $name, string $default = '') : string
99 99
     {
100 100
         $value = $this->getOption($name, false);
101 101
         
102
-        if((is_string($value) || is_numeric($value)) && !empty($value)) {
102
+        if ((is_string($value) || is_numeric($value)) && !empty($value)) {
103 103
             return (string)$value;
104 104
         }
105 105
         
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
      * @param bool $default
117 117
      * @return bool
118 118
      */
119
-    public function getBoolOption(string $name, bool $default=false) : bool
119
+    public function getBoolOption(string $name, bool $default = false) : bool
120 120
     {
121
-        if($this->getOption($name) === true)
121
+        if ($this->getOption($name) === true)
122 122
         {
123 123
             return true;
124 124
         }
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
     * @param int $default
136 136
     * @return int
137 137
     */
138
-    public function getIntOption(string $name, int $default=0) : int
138
+    public function getIntOption(string $name, int $default = 0) : int
139 139
     {
140 140
         $value = $this->getOption($name);
141
-        if(ConvertHelper::isInteger($value)) {
141
+        if (ConvertHelper::isInteger($value)) {
142 142
             return (int)$value;
143 143
         }
144 144
         
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public function getArrayOption(string $name) : array
157 157
     {
158 158
         $val = $this->getOption($name);
159
-        if(is_array($val)) {
159
+        if (is_array($val)) {
160 160
             return $val;
161 161
         }
162 162
         
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     */
173 173
     public function hasOption(string $name) : bool
174 174
     {
175
-        if(!isset($this->options)) {
175
+        if (!isset($this->options)) {
176 176
             $this->options = $this->getDefaultOptions();
177 177
         }
178 178
         
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     */
187 187
     public function getOptions() : array
188 188
     {
189
-        if(!isset($this->options)) {
189
+        if (!isset($this->options)) {
190 190
             $this->options = $this->getDefaultOptions();
191 191
         }
192 192
         
Please login to merge, or discard this patch.