Passed
Push — master ( 4f13bc...123cfe )
by Sebastian
02:27
created
src/ConvertHelper/WordWrapper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
         return $this->getBoolOption('cut');
64 64
     }
65 65
     
66
-    public function setCuttingEnabled(bool $enabled=true) : ConvertHelper_WordWrapper
66
+    public function setCuttingEnabled(bool $enabled = true) : ConvertHelper_WordWrapper
67 67
     {
68 68
         $this->setOption('cut', $enabled);
69 69
         return $this;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,8 +92,7 @@
 block discarded – undo
92 92
                 if (mb_strlen($actual.$word) <= $width)
93 93
                 {
94 94
                     $actual .= $word.' ';
95
-                }
96
-                else
95
+                } else
97 96
                 {
98 97
                     if ($actual != '') {
99 98
                         $line .= rtrim($actual).$break;
Please login to merge, or discard this patch.
src/ConvertHelper/DateInterval.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
     const TOKEN_MONTHS = 'm';
38 38
     const TOKEN_YEARS = 'y';
39 39
     
40
-   /**
41
-    * @var \DateInterval
42
-    */
40
+    /**
41
+     * @var \DateInterval
42
+     */
43 43
     protected $interval;
44 44
     
45
-   /**
46
-    * @var int
47
-    */
45
+    /**
46
+     * @var int
47
+     */
48 48
     protected $seconds;
49 49
     
50 50
     protected function __construct(int $seconds)
@@ -69,33 +69,33 @@  discard block
 block discarded – undo
69 69
         $this->interval = $interval;
70 70
     }
71 71
     
72
-   /**
73
-    * Creates the interval from a specific amount of seconds.
74
-    * 
75
-    * @param int $seconds
76
-    * @return \AppUtils\ConvertHelper_DateInterval
77
-    */
72
+    /**
73
+     * Creates the interval from a specific amount of seconds.
74
+     * 
75
+     * @param int $seconds
76
+     * @return \AppUtils\ConvertHelper_DateInterval
77
+     */
78 78
     public static function fromSeconds(int $seconds)
79 79
     {
80 80
         return new ConvertHelper_DateInterval($seconds);
81 81
     }
82 82
     
83
-   /**
84
-    * Creates the interval from an existing regular interval instance.
85
-    * 
86
-    * @param \DateInterval $interval
87
-    * @return \AppUtils\ConvertHelper_DateInterval
88
-    */
83
+    /**
84
+     * Creates the interval from an existing regular interval instance.
85
+     * 
86
+     * @param \DateInterval $interval
87
+     * @return \AppUtils\ConvertHelper_DateInterval
88
+     */
89 89
     public static function fromInterval(\DateInterval $interval)
90 90
     {
91 91
         return self::fromSeconds(ConvertHelper::interval2seconds($interval));
92 92
     }
93 93
     
94
-   /**
95
-    * Retrieves the PHP native date interval.
96
-    * 
97
-    * @return \DateInterval
98
-    */
94
+    /**
95
+     * Retrieves the PHP native date interval.
96
+     * 
97
+     * @return \DateInterval
98
+     */
99 99
     public function getInterval() : \DateInterval
100 100
     {
101 101
         return $this->interval;
@@ -131,31 +131,31 @@  discard block
 block discarded – undo
131 131
         return $this->getToken(self::TOKEN_YEARS);
132 132
     }
133 133
     
134
-   /**
135
-    * Retrieves a specific time token, e.g. "h" (for hours).
136
-    * Using the constants to specifiy the tokens is recommended.
137
-    * 
138
-    * @param string $token
139
-    * @return int
140
-    * 
141
-    * @see ConvertHelper_DateInterval::TOKEN_SECONDS
142
-    * @see ConvertHelper_DateInterval::TOKEN_MINUTES
143
-    * @see ConvertHelper_DateInterval::TOKEN_HOURS
144
-    * @see ConvertHelper_DateInterval::TOKEN_DAYS
145
-    * @see ConvertHelper_DateInterval::TOKEN_MONTHS
146
-    * @see ConvertHelper_DateInterval::TOKEN_YEARS
147
-    */
134
+    /**
135
+     * Retrieves a specific time token, e.g. "h" (for hours).
136
+     * Using the constants to specifiy the tokens is recommended.
137
+     * 
138
+     * @param string $token
139
+     * @return int
140
+     * 
141
+     * @see ConvertHelper_DateInterval::TOKEN_SECONDS
142
+     * @see ConvertHelper_DateInterval::TOKEN_MINUTES
143
+     * @see ConvertHelper_DateInterval::TOKEN_HOURS
144
+     * @see ConvertHelper_DateInterval::TOKEN_DAYS
145
+     * @see ConvertHelper_DateInterval::TOKEN_MONTHS
146
+     * @see ConvertHelper_DateInterval::TOKEN_YEARS
147
+     */
148 148
     public function getToken(string $token) : int
149 149
     {
150 150
         return (int)$this->interval->$token;
151 151
     }
152 152
     
153
-   /**
154
-    * The total amount of seconds in the interval (including
155
-    * everything, from seconds to days, months, years...).
156
-    * 
157
-    * @return int
158
-    */
153
+    /**
154
+     * The total amount of seconds in the interval (including
155
+     * everything, from seconds to days, months, years...).
156
+     * 
157
+     * @return int
158
+     */
159 159
     public function getTotalSeconds() : int
160 160
     {
161 161
         return $this->seconds;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
         
58 58
         $interval = $d2->diff($d1);
59 59
         
60
-        if($interval === false) 
60
+        if ($interval === false) 
61 61
         {
62 62
             throw new ConvertHelper_Exception(
63 63
                 'Cannot create interval',
Please login to merge, or discard this patch.
src/ConvertHelper/DurationConverter.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -26,39 +26,39 @@  discard block
 block discarded – undo
26 26
     const ERROR_NO_DATE_FROM_SET = 43401;
27 27
     
28 28
     
29
-   /**
30
-    * @var int
31
-    */
29
+    /**
30
+     * @var int
31
+     */
32 32
     protected $dateFrom;
33 33
     
34
-   /**
35
-    * @var int
36
-    */
34
+    /**
35
+     * @var int
36
+     */
37 37
     protected $dateTo;
38 38
     
39
-   /**
40
-    * @var bool
41
-    */
39
+    /**
40
+     * @var bool
41
+     */
42 42
     protected $future = false;
43 43
     
44
-   /**
45
-    * @var string
46
-    */
44
+    /**
45
+     * @var string
46
+     */
47 47
     protected $interval = '';
48 48
     
49
-   /**
50
-    * @var int
51
-    */
49
+    /**
50
+     * @var int
51
+     */
52 52
     protected $difference = 0;
53 53
     
54
-   /**
55
-    * @var int
56
-    */
54
+    /**
55
+     * @var int
56
+     */
57 57
     protected $dateDiff = 0;
58 58
     
59
-   /**
60
-    * @var array
61
-    */
59
+    /**
60
+     * @var array
61
+     */
62 62
     protected static $texts;
63 63
     
64 64
     public function __construct()
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
         unset(self::$texts);
79 79
     }
80 80
     
81
-   /**
82
-    * Sets the origin date to calculate from.
83
-    * 
84
-    * NOTE: if this is further in the future than
85
-    * the to: date, it will be considered as a 
86
-    * calculation for something to come, i.e. 
87
-    * "In two days".
88
-    *  
89
-    * @param \DateTime $date
90
-    * @return ConvertHelper_DurationConverter
91
-    */
81
+    /**
82
+     * Sets the origin date to calculate from.
83
+     * 
84
+     * NOTE: if this is further in the future than
85
+     * the to: date, it will be considered as a 
86
+     * calculation for something to come, i.e. 
87
+     * "In two days".
88
+     *  
89
+     * @param \DateTime $date
90
+     * @return ConvertHelper_DurationConverter
91
+     */
92 92
     public function setDateFrom(\DateTime $date) : ConvertHelper_DurationConverter
93 93
     {
94 94
         $this->dateFrom = ConvertHelper::date2timestamp($date);
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
         return $this;
97 97
     }
98 98
     
99
-   /**
100
-    * Sets the date to calculate to. Defaults to 
101
-    * the current time if not set.
102
-    * 
103
-    * @param \DateTime $date
104
-    * @return ConvertHelper_DurationConverter
105
-    */
99
+    /**
100
+     * Sets the date to calculate to. Defaults to 
101
+     * the current time if not set.
102
+     * 
103
+     * @param \DateTime $date
104
+     * @return ConvertHelper_DurationConverter
105
+     */
106 106
     public function setDateTo(\DateTime $date) : ConvertHelper_DurationConverter
107 107
     {
108 108
         $this->dateTo = ConvertHelper::date2timestamp($date);
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
         return $this;
111 111
     }
112 112
     
113
-   /**
114
-    * Converts the specified dates to a human readable string.
115
-    * 
116
-    * @throws ConvertHelper_Exception
117
-    * @return string
118
-    * 
119
-    * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
120
-    */
113
+    /**
114
+     * Converts the specified dates to a human readable string.
115
+     * 
116
+     * @throws ConvertHelper_Exception
117
+     * @return string
118
+     * 
119
+     * @see ConvertHelper_DurationConverter::ERROR_NO_DATE_FROM_SET
120
+     */
121 121
     public function convert() : string
122 122
     {
123 123
         $this->initTexts();
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     
64 64
     public function __construct()
65 65
     {
66
-        if(class_exists('\AppLocalize\Localization')) {
66
+        if (class_exists('\AppLocalize\Localization')) {
67 67
             \AppLocalize\Localization::onLocaleChanged(array($this, 'handle_localeChanged'));
68 68
         }
69 69
     }
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
         
126 126
         $epoch = 'past';
127 127
         $key = 'singular';
128
-        if($this->dateDiff > 1) {
128
+        if ($this->dateDiff > 1) {
129 129
             $key = 'plural';
130 130
         }
131 131
         
132
-        if($this->future) {
132
+        if ($this->future) {
133 133
             $epoch = 'future'; 
134 134
         }
135 135
         
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     
143 143
     protected function initTexts()
144 144
     {
145
-        if(isset(self::$texts)) {
145
+        if (isset(self::$texts)) {
146 146
             return;
147 147
         }
148 148
         
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         $day = (int)date("j", $this->dateTo);
229 229
         $year = (int)date("Y", $this->dateFrom);
230 230
         
231
-        while(mktime($hour, $min, $sec, $month + ($months_difference), $day, $year) < $this->dateTo)
231
+        while (mktime($hour, $min, $sec, $month + ($months_difference), $day, $year) < $this->dateTo)
232 232
         {
233 233
             $months_difference++;
234 234
         }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     
249 249
     protected function resolveCalculations() : void
250 250
     {
251
-        if(!isset($this->dateFrom))
251
+        if (!isset($this->dateFrom))
252 252
         {
253 253
             throw new ConvertHelper_Exception(
254 254
                 'No date from has been specified.',
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         }
259 259
         
260 260
         // no date to set? Assume we want to use today.
261
-        if(!isset($this->dateTo))
261
+        if (!isset($this->dateTo))
262 262
         {
263 263
             $this->dateTo = time();
264 264
         }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         
338 338
         $difference = $this->dateTo - $this->dateFrom;
339 339
         
340
-        if($difference < 0)
340
+        if ($difference < 0)
341 341
         {
342 342
             $difference = $difference * -1;
343 343
             $this->future = true;
Please login to merge, or discard this patch.
src/ConvertHelper/IntervalConverter.php 2 patches
Indentation   +38 added lines, -39 removed lines patch added patch discarded remove patch
@@ -17,21 +17,20 @@  discard block
 block discarded – undo
17 17
  * @package Application Utils
18 18
  * @subpackage ConvertHelper
19 19
  * @author Sebastian Mordziol <[email protected]>
20
-
21 20
  * @see ConvertHelper::interval2string()
22 21
  */
23 22
 class ConvertHelper_IntervalConverter
24 23
 {
25 24
     const ERROR_MISSING_TRANSLATION = 43501;
26 25
     
27
-   /**
28
-    * @var array
29
-    */
26
+    /**
27
+     * @var array
28
+     */
30 29
     protected static $texts;
31 30
     
32
-   /**
33
-    * @var array
34
-    */
31
+    /**
32
+     * @var array
33
+     */
35 34
     protected $tokens = array('y', 'm', 'd', 'h', 'i', 's');
36 35
     
37 36
     public function __construct()
@@ -41,25 +40,25 @@  discard block
 block discarded – undo
41 40
         }
42 41
     }
43 42
     
44
-   /**
45
-    * Called whenever the application locale has changed,
46
-    * to reset the internal translation cache.
47
-    */
43
+    /**
44
+     * Called whenever the application locale has changed,
45
+     * to reset the internal translation cache.
46
+     */
48 47
     public function handle_localeChanged()
49 48
     {
50 49
         unset(self::$texts);
51 50
     }
52 51
     
53
-   /**
54
-    * Converts the specified interval to a human readable
55
-    * string, e.g. "2 hours and 4 minutes".
56
-    * 
57
-    * @param \DateInterval $interval
58
-    * @return string
59
-    * @throws ConvertHelper_Exception
60
-    * 
61
-    * @see ConvertHelper_IntervalConverter::ERROR_MISSING_TRANSLATION
62
-    */
52
+    /**
53
+     * Converts the specified interval to a human readable
54
+     * string, e.g. "2 hours and 4 minutes".
55
+     * 
56
+     * @param \DateInterval $interval
57
+     * @return string
58
+     * @throws ConvertHelper_Exception
59
+     * 
60
+     * @see ConvertHelper_IntervalConverter::ERROR_MISSING_TRANSLATION
61
+     */
63 62
     public function toString(\DateInterval $interval) : string
64 63
     {
65 64
         $this->initTexts();
@@ -88,14 +87,14 @@  discard block
 block discarded – undo
88 87
         return t('%1$s and %2$s', implode(', ', $parts), $last);
89 88
     }
90 89
     
91
-   /**
92
-    * Translates the selected time token, e.g. "y" (for year).
93
-    * 
94
-    * @param string $token
95
-    * @param ConvertHelper_DateInterval $interval
96
-    * @throws ConvertHelper_Exception
97
-    * @return string
98
-    */
90
+    /**
91
+     * Translates the selected time token, e.g. "y" (for year).
92
+     * 
93
+     * @param string $token
94
+     * @param ConvertHelper_DateInterval $interval
95
+     * @throws ConvertHelper_Exception
96
+     * @return string
97
+     */
99 98
     protected function translateToken(string $token, ConvertHelper_DateInterval $interval) : string
100 99
     {
101 100
         $value = $interval->getToken($token);
@@ -123,13 +122,13 @@  discard block
 block discarded – undo
123 122
         );
124 123
     }
125 124
     
126
-   /**
127
-    * Resolves all time tokens that need to be translated in
128
-    * the subject interval, depending on its length.
129
-    * 
130
-    * @param ConvertHelper_DateInterval $interval
131
-    * @return array
132
-    */
125
+    /**
126
+     * Resolves all time tokens that need to be translated in
127
+     * the subject interval, depending on its length.
128
+     * 
129
+     * @param ConvertHelper_DateInterval $interval
130
+     * @return array
131
+     */
133 132
     protected function resolveTokens(ConvertHelper_DateInterval $interval) : array
134 133
     {
135 134
         $offset = 0;
@@ -147,9 +146,9 @@  discard block
 block discarded – undo
147 146
         return array();
148 147
     }
149 148
     
150
-   /**
151
-    * Initializes the translateable strings.
152
-    */
149
+    /**
150
+     * Initializes the translateable strings.
151
+     */
153 152
     protected function initTexts() : void
154 153
     {
155 154
         if(isset(self::$texts)) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     
37 37
     public function __construct()
38 38
     {
39
-        if(class_exists('\AppLocalize\Localization')) {
39
+        if (class_exists('\AppLocalize\Localization')) {
40 40
             \AppLocalize\Localization::onLocaleChanged(array($this, 'handle_localeChanged'));
41 41
         }
42 42
     }
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
         $keep = $this->resolveTokens($interval);
70 70
 
71 71
         $parts = array();
72
-        foreach($keep as $token)
72
+        foreach ($keep as $token)
73 73
         {
74 74
             $value = $interval->getToken($token);
75
-            if($value === 0) {
75
+            if ($value === 0) {
76 76
                 continue;
77 77
             }
78 78
             
79 79
             $parts[] = $this->translateToken($token, $interval);
80 80
         }
81 81
         
82
-        if(count($parts) == 1) {
82
+        if (count($parts) == 1) {
83 83
             return $parts[0];
84 84
         }
85 85
         
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         $value = $interval->getToken($token);
102 102
         
103 103
         $suffix = 'p';
104
-        if($value == 1) { $suffix = 's'; }
104
+        if ($value == 1) { $suffix = 's'; }
105 105
         $token .= $suffix;
106 106
         
107
-        if(!isset(self::$texts[$token]))
107
+        if (!isset(self::$texts[$token]))
108 108
         {
109 109
             throw new ConvertHelper_Exception(
110 110
                 'Missing interval translation',
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $offset = 0;
136 136
         
137
-        foreach($this->tokens as $token) 
137
+        foreach ($this->tokens as $token) 
138 138
         {
139
-            if($interval->getToken($token) > 0) 
139
+            if ($interval->getToken($token) > 0) 
140 140
             {
141 141
                 return array_slice($this->tokens, $offset);
142 142
             }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     */
153 153
     protected function initTexts() : void
154 154
     {
155
-        if(isset(self::$texts)) {
155
+        if (isset(self::$texts)) {
156 156
             return;
157 157
         }
158 158
         
Please login to merge, or discard this patch.
src/ZIPHelper.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
         'WriteThreshold' => 100
37 37
     );
38 38
     
39
-   /**
40
-    * @var string
41
-    */
39
+    /**
40
+     * @var string
41
+     */
42 42
     protected $file;
43 43
     
44
-   /**
45
-    * @var \ZipArchive
46
-    */
44
+    /**
45
+     * @var \ZipArchive
46
+     */
47 47
     protected $zip;
48 48
     
49 49
     public function __construct(string $targetFile)
@@ -51,35 +51,35 @@  discard block
 block discarded – undo
51 51
         $this->file = $targetFile;
52 52
     }
53 53
     
54
-   /**
55
-    * Sets an option, among the available options:
56
-    * 
57
-    * <ul>
58
-    * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li>
59
-    * </ul>
60
-    * 
61
-    * @param string $name
62
-    * @param mixed $value
63
-    * @return ZIPHelper
64
-    */
54
+    /**
55
+     * Sets an option, among the available options:
56
+     * 
57
+     * <ul>
58
+     * <li>WriteThreshold: The amount of files to add before the zip is automatically written to disk and re-opened to release the file handles. Set to 0 to disable.</li>
59
+     * </ul>
60
+     * 
61
+     * @param string $name
62
+     * @param mixed $value
63
+     * @return ZIPHelper
64
+     */
65 65
     public function setOption(string $name, $value) : ZIPHelper
66 66
     {
67 67
         $this->options[$name] = $value;
68 68
         return $this;
69 69
     }
70 70
     
71
-   /**
72
-    * Adds a file to the zip. By default, the file is stored
73
-    * with the same name in the root of the zip. Use the optional
74
-    * parameter to change the location in the zip.
75
-    * 
76
-    * @param string $filePath
77
-    * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root.
78
-    * @throws ZIPHelper_Exception
79
-    * @return bool
80
-    * 
81
-    * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST
82
-    */
71
+    /**
72
+     * Adds a file to the zip. By default, the file is stored
73
+     * with the same name in the root of the zip. Use the optional
74
+     * parameter to change the location in the zip.
75
+     * 
76
+     * @param string $filePath
77
+     * @param string|null $zipPath If no path is specified, file will be added with the same name in the ZIP's root.
78
+     * @throws ZIPHelper_Exception
79
+     * @return bool
80
+     * 
81
+     * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST
82
+     */
83 83
     public function addFile(string $filePath, ?string $zipPath=null) : bool
84 84
     {
85 85
         $this->open();
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
         return $fileName;
256 256
     }
257 257
     
258
-   /**
259
-    * Like {@link ZIPHelper::download()}, but deletes the
260
-    * file after sending it to the browser.
261
-    * 
262
-    * @param string|NULL $fileName Override the ZIP's file name for the download
263
-    * @see ZIPHelper::download()
264
-    */
258
+    /**
259
+     * Like {@link ZIPHelper::download()}, but deletes the
260
+     * file after sending it to the browser.
261
+     * 
262
+     * @param string|NULL $fileName Override the ZIP's file name for the download
263
+     * @see ZIPHelper::download()
264
+     */
265 265
     public function downloadAndDelete(?string $fileName=null)
266 266
     {
267 267
         $this->download($fileName);
@@ -269,14 +269,14 @@  discard block
 block discarded – undo
269 269
         FileHelper::deleteFile($this->file);
270 270
     }
271 271
 
272
-   /**
273
-    * Extracts all files and folders from the zip to the 
274
-    * target folder. If no folder is specified, the files
275
-    * are extracted into the same folder as the zip itself.
276
-    * 
277
-    * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder.
278
-    * @return boolean
279
-    */
272
+    /**
273
+     * Extracts all files and folders from the zip to the 
274
+     * target folder. If no folder is specified, the files
275
+     * are extracted into the same folder as the zip itself.
276
+     * 
277
+     * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder.
278
+     * @return boolean
279
+     */
280 280
     public function extractAll(?string $outputFolder=null) : bool
281 281
     {
282 282
         if(empty($outputFolder)) {
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
     }
290 290
 
291 291
     
292
-   /**
293
-    * @return \ZipArchive
294
-    */
292
+    /**
293
+     * @return \ZipArchive
294
+     */
295 295
     public function getArchive() : \ZipArchive
296 296
     {
297 297
         $this->open();
@@ -299,14 +299,14 @@  discard block
 block discarded – undo
299 299
         return $this->zip;
300 300
     }
301 301
     
302
-   /**
303
-    * JSON encodes the specified data and adds the json as
304
-    * a file in the ZIP archive.
305
-    * 
306
-    * @param mixed $data
307
-    * @param string $zipPath
308
-    * @return boolean
309
-    */
302
+    /**
303
+     * JSON encodes the specified data and adds the json as
304
+     * a file in the ZIP archive.
305
+     * 
306
+     * @param mixed $data
307
+     * @param string $zipPath
308
+     * @return boolean
309
+     */
310 310
     public function addJSON($data, $zipPath)
311 311
     {
312 312
         return $this->addString(
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     
31 31
     const ERROR_OPENING_ZIP_FILE = 338003;
32 32
     
33
-    const ERROR_CANNOT_SAVE_FILE_TO_DISK =338004;
33
+    const ERROR_CANNOT_SAVE_FILE_TO_DISK = 338004;
34 34
     
35 35
     protected $options = array(
36 36
         'WriteThreshold' => 100
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     * 
81 81
     * @see FileHelper::ERROR_SOURCE_FILE_DOES_NOT_EXIST
82 82
     */
83
-    public function addFile(string $filePath, ?string $zipPath=null) : bool
83
+    public function addFile(string $filePath, ?string $zipPath = null) : bool
84 84
     {
85 85
         $this->open();
86 86
         
@@ -126,16 +126,16 @@  discard block
 block discarded – undo
126 126
     
127 127
     protected function open()
128 128
     {
129
-        if($this->open) {
129
+        if ($this->open) {
130 130
             return;
131 131
         }
132 132
         
133
-        if(!isset($this->zip)) {
133
+        if (!isset($this->zip)) {
134 134
             $this->zip = new \ZipArchive();
135 135
         }
136 136
         
137 137
         $flag = null;
138
-        if(!file_exists($this->file)) {
138
+        if (!file_exists($this->file)) {
139 139
             $flag = \ZipArchive::CREATE;
140 140
         }
141 141
         
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     {
176 176
         $this->fileTracker++;
177 177
 
178
-        if($this->options['WriteThreshold'] < 1) {
178
+        if ($this->options['WriteThreshold'] < 1) {
179 179
             return;
180 180
         }
181 181
         
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     
189 189
     protected function close()
190 190
     {
191
-        if(!$this->open) {
191
+        if (!$this->open) {
192 192
             return;
193 193
         }
194 194
         
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
             throw new ZIPHelper_Exception(
198 198
                 'Could not save ZIP file to disk',
199 199
                 sprintf(
200
-                    'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, ' .
201
-                    'including adding files that do not exist on disk, trying to create an empty zip, ' .
200
+                    'Tried saving the ZIP file [%1$s], but the write failed. This can have several causes, '.
201
+                    'including adding files that do not exist on disk, trying to create an empty zip, '.
202 202
                     'or trying to save to a directory that does not exist.',
203 203
                     $this->file
204 204
                 ),
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     {
214 214
         $this->open();
215 215
         
216
-        if($this->countFiles() < 1) 
216
+        if ($this->countFiles() < 1) 
217 217
         {
218 218
             throw new ZIPHelper_Exception(
219 219
                 'No files in the zip file',
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
      * @throws ZIPHelper_Exception
238 238
      * @return string The file name that was sent (useful in case none was specified).
239 239
      */
240
-    public function download(?string $fileName=null) : string
240
+    public function download(?string $fileName = null) : string
241 241
     {
242 242
         $this->save();
243 243
         
244
-        if(empty($fileName)) {
244
+        if (empty($fileName)) {
245 245
             $fileName = basename($this->file);
246 246
         }
247 247
         
248 248
         header('Content-type: application/zip');
249
-        header('Content-Disposition: attachment; filename=' . $fileName);
250
-        header('Content-length: ' . filesize($this->file));
249
+        header('Content-Disposition: attachment; filename='.$fileName);
250
+        header('Content-length: '.filesize($this->file));
251 251
         header('Pragma: no-cache');
252 252
         header('Expires: 0');
253 253
         readfile($this->file);
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     * @param string|NULL $fileName Override the ZIP's file name for the download
263 263
     * @see ZIPHelper::download()
264 264
     */
265
-    public function downloadAndDelete(?string $fileName=null)
265
+    public function downloadAndDelete(?string $fileName = null)
266 266
     {
267 267
         $this->download($fileName);
268 268
         
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
     * @param string|NULL $outputFolder If no folder is specified, uses the target file's folder.
278 278
     * @return boolean
279 279
     */
280
-    public function extractAll(?string $outputFolder=null) : bool
280
+    public function extractAll(?string $outputFolder = null) : bool
281 281
     {
282
-        if(empty($outputFolder)) {
282
+        if (empty($outputFolder)) {
283 283
             $outputFolder = dirname($this->file);
284 284
         }
285 285
         
Please login to merge, or discard this patch.
src/SVNHelper/CommandResult.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -4,37 +4,37 @@  discard block
 block discarded – undo
4 4
 
5 5
 class SVNHelper_CommandResult
6 6
 {
7
-   /**
8
-    * @var SVNHelper_Command
9
-    */
7
+    /**
8
+     * @var SVNHelper_Command
9
+     */
10 10
     protected $command;
11 11
     
12
-   /**
13
-    * @var string[]
14
-    */
12
+    /**
13
+     * @var string[]
14
+     */
15 15
     protected $output;
16 16
     
17
-   /**
18
-    * @var SVNHelper_CommandError[]
19
-    */
17
+    /**
18
+     * @var SVNHelper_CommandError[]
19
+     */
20 20
     protected $errors = array();
21 21
     
22
-   /**
23
-    * @var SVNHelper_CommandError[]
24
-    */
22
+    /**
23
+     * @var SVNHelper_CommandError[]
24
+     */
25 25
     protected $warnings = array();
26 26
     
27
-   /**
28
-    * The actual command that has been executed
29
-    * @var string
30
-    */
27
+    /**
28
+     * The actual command that has been executed
29
+     * @var string
30
+     */
31 31
     protected $commandLine;
32 32
     
33
-   /**
34
-    * @param SVNHelper_Command $command
35
-    * @param string[] $output
36
-    * @param SVNHelper_CommandError[] $errors
37
-    */
33
+    /**
34
+     * @param SVNHelper_Command $command
35
+     * @param string[] $output
36
+     * @param SVNHelper_CommandError[] $errors
37
+     */
38 38
     public function __construct(SVNHelper_Command $command, $commandLine, $output, $errors)
39 39
     {
40 40
         $this->command = $command;
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
         return $this->command;
87 87
     }
88 88
     
89
-   /**
90
-    * Retrieves all error messages.
91
-    * 
92
-    * @param bool $asString
93
-    * @return string|string[]
94
-    */
89
+    /**
90
+     * Retrieves all error messages.
91
+     * 
92
+     * @param bool $asString
93
+     * @return string|string[]
94
+     */
95 95
     public function getErrorMessages(bool $asString=false)
96 96
     {
97 97
         if($asString) {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
         $this->commandLine = $commandLine;
42 42
         $this->output = $output;
43 43
         
44
-        foreach($errors as $error) {
45
-            if($error->isError()) {
44
+        foreach ($errors as $error) {
45
+            if ($error->isError()) {
46 46
                 $this->errors[] = $error;
47 47
             } else {
48 48
                 $this->warnings[] = $error;
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
     
63 63
     public function hasErrorCode($code)
64 64
     {
65
-        foreach($this->errors as $error) {
66
-            if($error->getCode() == $code) {
65
+        foreach ($this->errors as $error) {
66
+            if ($error->getCode() == $code) {
67 67
                 return true;
68 68
             }
69 69
         }
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
     * @param bool $asString
93 93
     * @return string|string[]
94 94
     */
95
-    public function getErrorMessages(bool $asString=false)
95
+    public function getErrorMessages(bool $asString = false)
96 96
     {
97
-        if($asString) {
97
+        if ($asString) {
98 98
             $lines = array();
99
-            foreach($this->errors as $error) {
99
+            foreach ($this->errors as $error) {
100 100
                 $lines[] = (string)$error;
101 101
             }
102 102
             
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         }
105 105
         
106 106
         $messages = array();
107
-        foreach($this->errors as $error) {
107
+        foreach ($this->errors as $error) {
108 108
             $messages[] = (string)$error;
109 109
         }
110 110
         
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     
124 124
     public function getLastLine()
125 125
     {
126
-        return $this->output[count($this->output)-1];
126
+        return $this->output[count($this->output) - 1];
127 127
     }
128 128
     
129 129
     public function getFirstLine()
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
     
139 139
     public function isConnectionFailed()
140 140
     {
141
-        foreach($this->errors as $error) {
142
-            if($error->isConnectionFailed()) {
141
+        foreach ($this->errors as $error) {
142
+            if ($error->isConnectionFailed()) {
143 143
                 return true;
144 144
             }
145 145
         }
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
     
150 150
     public function hasConflicts()
151 151
     {
152
-        foreach($this->errors as $error) {
153
-            if($error->isConflict()) {
152
+        foreach ($this->errors as $error) {
153
+            if ($error->isConflict()) {
154 154
                 return true;
155 155
             }
156 156
         }
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
     
161 161
     public function hasLocks()
162 162
     {
163
-        foreach($this->errors as $error) {
164
-            if($error->isLock()) {
163
+        foreach ($this->errors as $error) {
164
+            if ($error->isLock()) {
165 165
                 return true;
166 166
             }
167 167
         }
Please login to merge, or discard this patch.