@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $result = $this->execCommand('status', $this->target->getPath(), array('depth empty')); |
| 51 | 51 | |
| 52 | - if($result->isError()) { |
|
| 52 | + if ($result->isError()) { |
|
| 53 | 53 | $this->throwExceptionUnexpected($result); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $lines = $result->getOutput(); |
| 57 | 57 | |
| 58 | - if(empty($lines)) |
|
| 58 | + if (empty($lines)) |
|
| 59 | 59 | { |
| 60 | 60 | $this->status = self::STATUS_NOT_MODIFIED; |
| 61 | 61 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->status = self::STATUS_UNKNOWN; |
| 65 | 65 | |
| 66 | 66 | $svnStatusCode = strtolower(substr($lines[0], 0, 1)); |
| 67 | - if(isset(self::$knownStati[$svnStatusCode])) { |
|
| 67 | + if (isset(self::$knownStati[$svnStatusCode])) { |
|
| 68 | 68 | $this->status = self::$knownStati[$svnStatusCode]; |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | if(empty($lines)) |
| 59 | 59 | { |
| 60 | 60 | $this->status = self::STATUS_NOT_MODIFIED; |
| 61 | - } |
|
| 62 | - else |
|
| 61 | + } else |
|
| 63 | 62 | { |
| 64 | 63 | $this->status = self::STATUS_UNKNOWN; |
| 65 | 64 | |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public const STATUS_FILETYPE_CHANGE = 'filetype-change'; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var array |
|
| 29 | - * @see http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.status.html |
|
| 30 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var array |
|
| 29 | + * @see http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.status.html |
|
| 30 | + */ |
|
| 31 | 31 | protected static $knownStati = array( |
| 32 | 32 | 'a' => self::STATUS_ADD, |
| 33 | 33 | 'd' => self::STATUS_DELETE, |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | '~' => self::STATUS_FILETYPE_CHANGE, |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @var string |
|
| 45 | - */ |
|
| 43 | + /** |
|
| 44 | + * @var string |
|
| 45 | + */ |
|
| 46 | 46 | protected $status; |
| 47 | 47 | |
| 48 | 48 | protected function _execute() |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $svnStatusCode = strtolower(substr($lines[0], 0, 1)); |
| 67 | 67 | if(isset(self::$knownStati[$svnStatusCode])) { |
| 68 | - $this->status = self::$knownStati[$svnStatusCode]; |
|
| 68 | + $this->status = self::$knownStati[$svnStatusCode]; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | if(isset($data['serialized'])) |
| 66 | 66 | { |
| 67 | 67 | $this->parseSerialized($data['serialized']); |
| 68 | - } |
|
| 69 | - else |
|
| 68 | + } else |
|
| 70 | 69 | { |
| 71 | 70 | $this->parseTrace($data['trace']); |
| 72 | 71 | $this->position = $data['position']; |
@@ -75,8 +74,7 @@ discard block |
||
| 75 | 74 | if($this->hasClass()) |
| 76 | 75 | { |
| 77 | 76 | $this->type = self::TYPE_METHOD_CALL; |
| 78 | - } |
|
| 79 | - else if($this->hasFunction()) |
|
| 77 | + } else if($this->hasFunction()) |
|
| 80 | 78 | { |
| 81 | 79 | $this->type = self::TYPE_FUNCTION_CALL; |
| 82 | 80 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $this->info = $info; |
| 61 | 61 | |
| 62 | - if(isset($data['serialized'])) |
|
| 62 | + if (isset($data['serialized'])) |
|
| 63 | 63 | { |
| 64 | 64 | $this->parseSerialized($data['serialized']); |
| 65 | 65 | } |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | $this->position = $data['position']; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if($this->hasClass()) |
|
| 72 | + if ($this->hasClass()) |
|
| 73 | 73 | { |
| 74 | 74 | $this->type = self::TYPE_METHOD_CALL; |
| 75 | 75 | } |
| 76 | - else if($this->hasFunction()) |
|
| 76 | + else if ($this->hasFunction()) |
|
| 77 | 77 | { |
| 78 | 78 | $this->type = self::TYPE_FUNCTION_CALL; |
| 79 | 79 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function getFileName() : string |
| 134 | 134 | { |
| 135 | - if($this->hasFile()) { |
|
| 135 | + if ($this->hasFile()) { |
|
| 136 | 136 | return basename($this->file); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | public function getFileRelative() : string |
| 143 | 143 | { |
| 144 | - if($this->hasFile()) { |
|
| 144 | + if ($this->hasFile()) { |
|
| 145 | 145 | return FileHelper::relativizePathByDepth($this->file, $this->info->getFolderDepth()); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $this->class = $data['class']; |
| 172 | 172 | $this->position = $data['position']; |
| 173 | 173 | |
| 174 | - foreach($data['arguments'] as $arg) |
|
| 174 | + foreach ($data['arguments'] as $arg) |
|
| 175 | 175 | { |
| 176 | 176 | $this->args[] = VariableInfo::fromSerialized($arg); |
| 177 | 177 | } |
@@ -182,29 +182,29 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | protected function parseTrace(array $trace) : void |
| 184 | 184 | { |
| 185 | - if(isset($trace['line'])) |
|
| 185 | + if (isset($trace['line'])) |
|
| 186 | 186 | { |
| 187 | 187 | $this->line = intval($trace['line']); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if(isset($trace['function'])) |
|
| 190 | + if (isset($trace['function'])) |
|
| 191 | 191 | { |
| 192 | 192 | $this->function = $trace['function']; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if(isset($trace['file'])) |
|
| 195 | + if (isset($trace['file'])) |
|
| 196 | 196 | { |
| 197 | 197 | $this->file = FileHelper::normalizePath($trace['file']); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if(isset($trace['class'])) |
|
| 200 | + if (isset($trace['class'])) |
|
| 201 | 201 | { |
| 202 | 202 | $this->class = $trace['class']; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if(isset($trace['args']) && !empty($trace['args'])) |
|
| 205 | + if (isset($trace['args']) && !empty($trace['args'])) |
|
| 206 | 206 | { |
| 207 | - foreach($trace['args'] as $arg) |
|
| 207 | + foreach ($trace['args'] as $arg) |
|
| 208 | 208 | { |
| 209 | 209 | $this->args[] = parseVariable($arg); |
| 210 | 210 | } |
@@ -219,13 +219,13 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | $tokens[] = '#'.sprintf('%0'.$padLength.'d', $this->getPosition()).' '; |
| 221 | 221 | |
| 222 | - if($this->hasFile()) { |
|
| 222 | + if ($this->hasFile()) { |
|
| 223 | 223 | $tokens[] = $this->getFileRelative().':'.$this->getLine(); |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if($this->hasClass()) { |
|
| 226 | + if ($this->hasClass()) { |
|
| 227 | 227 | $tokens[] = $this->getClass().'::'.$this->getFunction().'('.$this->argumentsToString().')'; |
| 228 | - } else if($this->hasFunction()) { |
|
| 228 | + } else if ($this->hasFunction()) { |
|
| 229 | 229 | $tokens[] = $this->getFunction().'('.$this->argumentsToString().')'; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | { |
| 237 | 237 | $tokens = array(); |
| 238 | 238 | |
| 239 | - foreach($this->args as $arg) |
|
| 239 | + foreach ($this->args as $arg) |
|
| 240 | 240 | { |
| 241 | 241 | $tokens[] = $arg->toString(); |
| 242 | 242 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | 'arguments' => array() |
| 282 | 282 | ); |
| 283 | 283 | |
| 284 | - foreach($this->args as $argument) |
|
| 284 | + foreach ($this->args as $argument) |
|
| 285 | 285 | { |
| 286 | 286 | $result['arguments'][] = $argument->serialize(); |
| 287 | 287 | } |
@@ -10,45 +10,45 @@ discard block |
||
| 10 | 10 | public const TYPE_METHOD_CALL = 'method'; |
| 11 | 11 | public const TYPE_SCRIPT_START = 'start'; |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @var ConvertHelper_ThrowableInfo |
|
| 15 | - */ |
|
| 13 | + /** |
|
| 14 | + * @var ConvertHelper_ThrowableInfo |
|
| 15 | + */ |
|
| 16 | 16 | protected $info; |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var VariableInfo[] |
|
| 20 | - */ |
|
| 18 | + /** |
|
| 19 | + * @var VariableInfo[] |
|
| 20 | + */ |
|
| 21 | 21 | protected $args = array(); |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * The source file, if any |
|
| 25 | - * @var string |
|
| 26 | - */ |
|
| 23 | + /** |
|
| 24 | + * The source file, if any |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | 27 | protected $file = ''; |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | 32 | protected $class = ''; |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @var integer |
|
| 36 | - */ |
|
| 34 | + /** |
|
| 35 | + * @var integer |
|
| 36 | + */ |
|
| 37 | 37 | protected $line = 0; |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @var int |
|
| 41 | - */ |
|
| 39 | + /** |
|
| 40 | + * @var int |
|
| 41 | + */ |
|
| 42 | 42 | protected $position = 1; |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @var string |
|
| 46 | - */ |
|
| 44 | + /** |
|
| 45 | + * @var string |
|
| 46 | + */ |
|
| 47 | 47 | protected $function = ''; |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @var string |
|
| 51 | - */ |
|
| 49 | + /** |
|
| 50 | + * @var string |
|
| 51 | + */ |
|
| 52 | 52 | protected $type = self::TYPE_SCRIPT_START; |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * 1-based position of the call in the calls list. |
|
| 84 | - * @return int |
|
| 85 | - */ |
|
| 82 | + /** |
|
| 83 | + * 1-based position of the call in the calls list. |
|
| 84 | + * @return int |
|
| 85 | + */ |
|
| 86 | 86 | public function getPosition() : int |
| 87 | 87 | { |
| 88 | 88 | return $this->position; |
@@ -93,18 +93,18 @@ discard block |
||
| 93 | 93 | return $this->line; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * Whether the call had any arguments. |
|
| 98 | - * @return bool |
|
| 99 | - */ |
|
| 96 | + /** |
|
| 97 | + * Whether the call had any arguments. |
|
| 98 | + * @return bool |
|
| 99 | + */ |
|
| 100 | 100 | public function hasArguments() : bool |
| 101 | 101 | { |
| 102 | 102 | return !empty($this->args); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * @return VariableInfo[] |
|
| 107 | - */ |
|
| 105 | + /** |
|
| 106 | + * @return VariableInfo[] |
|
| 107 | + */ |
|
| 108 | 108 | public function getArguments() |
| 109 | 109 | { |
| 110 | 110 | return $this->args; |
@@ -244,31 +244,31 @@ discard block |
||
| 244 | 244 | return implode(', ', $tokens); |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - /** |
|
| 248 | - * Retrieves the type of call: typically a function |
|
| 249 | - * call, or a method call of an object. Note that the |
|
| 250 | - * first call in a script does not have either. |
|
| 251 | - * |
|
| 252 | - * @return string |
|
| 253 | - * |
|
| 254 | - * @see ConvertHelper_ThrowableInfo_Call::TYPE_FUNCTION_CALL |
|
| 255 | - * @see ConvertHelper_ThrowableInfo_Call::TYPE_METHOD_CALL |
|
| 256 | - * @see ConvertHelper_ThrowableInfo_Call::TYPE_SCRIPT_START |
|
| 257 | - * @see ConvertHelper_ThrowableInfo_Call::hasFunction() |
|
| 258 | - * @see ConvertHelper_ThrowableInfo_Call::hasClass() |
|
| 259 | - */ |
|
| 247 | + /** |
|
| 248 | + * Retrieves the type of call: typically a function |
|
| 249 | + * call, or a method call of an object. Note that the |
|
| 250 | + * first call in a script does not have either. |
|
| 251 | + * |
|
| 252 | + * @return string |
|
| 253 | + * |
|
| 254 | + * @see ConvertHelper_ThrowableInfo_Call::TYPE_FUNCTION_CALL |
|
| 255 | + * @see ConvertHelper_ThrowableInfo_Call::TYPE_METHOD_CALL |
|
| 256 | + * @see ConvertHelper_ThrowableInfo_Call::TYPE_SCRIPT_START |
|
| 257 | + * @see ConvertHelper_ThrowableInfo_Call::hasFunction() |
|
| 258 | + * @see ConvertHelper_ThrowableInfo_Call::hasClass() |
|
| 259 | + */ |
|
| 260 | 260 | public function getType() : string |
| 261 | 261 | { |
| 262 | 262 | return $this->type; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - /** |
|
| 266 | - * Serializes the call to an array, with all |
|
| 267 | - * necessary information. Can be used to restore |
|
| 268 | - * the call later using {@link ConvertHelper_ThrowableInfo_Call::fromSerialized()}. |
|
| 269 | - * |
|
| 270 | - * @return array<string,mixed> |
|
| 271 | - */ |
|
| 265 | + /** |
|
| 266 | + * Serializes the call to an array, with all |
|
| 267 | + * necessary information. Can be used to restore |
|
| 268 | + * the call later using {@link ConvertHelper_ThrowableInfo_Call::fromSerialized()}. |
|
| 269 | + * |
|
| 270 | + * @return array<string,mixed> |
|
| 271 | + */ |
|
| 272 | 272 | public function serialize() : array |
| 273 | 273 | { |
| 274 | 274 | $result = array( |
@@ -33,19 +33,19 @@ |
||
| 33 | 33 | $this->match = $matchedString; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * The zero-based start position of the string in the haystack. |
|
| 38 | - * @return int |
|
| 39 | - */ |
|
| 36 | + /** |
|
| 37 | + * The zero-based start position of the string in the haystack. |
|
| 38 | + * @return int |
|
| 39 | + */ |
|
| 40 | 40 | public function getPosition() : int |
| 41 | 41 | { |
| 42 | 42 | return $this->position; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * The exact string that was matched, respecting the case as found in needle. |
|
| 47 | - * @return string |
|
| 48 | - */ |
|
| 45 | + /** |
|
| 46 | + * The exact string that was matched, respecting the case as found in needle. |
|
| 47 | + * @return string |
|
| 48 | + */ |
|
| 49 | 49 | public function getMatchedString() : string |
| 50 | 50 | { |
| 51 | 51 | return $this->match; |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | if(is_array($serialized)) |
| 56 | 56 | { |
| 57 | 57 | $this->parseSerialized($serialized); |
| 58 | - } |
|
| 59 | - else |
|
| 58 | + } else |
|
| 60 | 59 | { |
| 61 | 60 | $this->parseValue($value); |
| 62 | 61 | } |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public const ERROR_INVALID_SERIALIZED_DATA = 56301; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | 43 | protected $string; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var mixed |
|
| 47 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var mixed |
|
| 47 | + */ |
|
| 48 | 48 | protected $value; |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | 53 | protected $type; |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -106,15 +106,15 @@ discard block |
||
| 106 | 106 | return new VariableInfo(null, $serialized); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Parses a previously serialized data set to restore the |
|
| 111 | - * variable information from it. |
|
| 112 | - * |
|
| 113 | - * @param array<mixed> $serialized |
|
| 114 | - * @throws BaseException |
|
| 115 | - * |
|
| 116 | - * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA |
|
| 117 | - */ |
|
| 109 | + /** |
|
| 110 | + * Parses a previously serialized data set to restore the |
|
| 111 | + * variable information from it. |
|
| 112 | + * |
|
| 113 | + * @param array<mixed> $serialized |
|
| 114 | + * @throws BaseException |
|
| 115 | + * |
|
| 116 | + * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA |
|
| 117 | + */ |
|
| 118 | 118 | protected function parseSerialized(array $serialized) : void |
| 119 | 119 | { |
| 120 | 120 | if(!isset($serialized['string'], $serialized['type'], $serialized['options'])) |
@@ -163,12 +163,12 @@ discard block |
||
| 163 | 163 | return $this->value; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - /** |
|
| 167 | - * The variable type - this is the same string that |
|
| 168 | - * is returned by the PHP function `gettype`. |
|
| 169 | - * |
|
| 170 | - * @return string |
|
| 171 | - */ |
|
| 166 | + /** |
|
| 167 | + * The variable type - this is the same string that |
|
| 168 | + * is returned by the PHP function `gettype`. |
|
| 169 | + * |
|
| 170 | + * @return string |
|
| 171 | + */ |
|
| 172 | 172 | public function getType() : string |
| 173 | 173 | { |
| 174 | 174 | return $this->type; |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | ); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * Whether to prepend the variable type before the value, |
|
| 190 | - * like the var_dump function. Example: <code>string "Some text"</code>. |
|
| 191 | - * |
|
| 192 | - * @param bool $enable |
|
| 193 | - * @return VariableInfo |
|
| 194 | - */ |
|
| 188 | + /** |
|
| 189 | + * Whether to prepend the variable type before the value, |
|
| 190 | + * like the var_dump function. Example: <code>string "Some text"</code>. |
|
| 191 | + * |
|
| 192 | + * @param bool $enable |
|
| 193 | + * @return VariableInfo |
|
| 194 | + */ |
|
| 195 | 195 | public function enableType(bool $enable=true) : VariableInfo |
| 196 | 196 | { |
| 197 | 197 | return $this->setOption('prepend-type', $enable); |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * @param array<mixed>|null $serialized |
| 68 | 68 | * @throws BaseException |
| 69 | 69 | */ |
| 70 | - public function __construct($value, ?array $serialized=null) |
|
| 70 | + public function __construct($value, ?array $serialized = null) |
|
| 71 | 71 | { |
| 72 | - if(is_array($serialized)) |
|
| 72 | + if (is_array($serialized)) |
|
| 73 | 73 | { |
| 74 | 74 | $this->parseSerialized($serialized); |
| 75 | 75 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | protected function parseSerialized(array $serialized) : void |
| 119 | 119 | { |
| 120 | - if(!isset($serialized['string'], $serialized['type'], $serialized['options'])) |
|
| 120 | + if (!isset($serialized['string'], $serialized['type'], $serialized['options'])) |
|
| 121 | 121 | { |
| 122 | 122 | throw new BaseException( |
| 123 | 123 | 'Invalid variable info serialized data.', |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | // Gettype will return a string like "Resource(closed)" when |
| 145 | 145 | // working with a resource that has already been closed. |
| 146 | - if(stripos($this->type, 'resource') !== false) |
|
| 146 | + if (stripos($this->type, 'resource') !== false) |
|
| 147 | 147 | { |
| 148 | 148 | $this->type = self::TYPE_RESOURCE; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if(is_callable($value) && in_array($this->type, $this->callableTypes)) { |
|
| 151 | + if (is_callable($value) && in_array($this->type, $this->callableTypes)) { |
|
| 152 | 152 | $this->type = self::TYPE_CALLABLE; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param bool $enable |
| 193 | 193 | * @return VariableInfo |
| 194 | 194 | */ |
| 195 | - public function enableType(bool $enable=true) : VariableInfo |
|
| 195 | + public function enableType(bool $enable = true) : VariableInfo |
|
| 196 | 196 | { |
| 197 | 197 | return $this->setOption('prepend-type', $enable); |
| 198 | 198 | } |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | { |
| 202 | 202 | $converted = $this->string; |
| 203 | 203 | |
| 204 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
| 204 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
| 205 | 205 | { |
| 206 | - if($this->isString()) |
|
| 206 | + if ($this->isString()) |
|
| 207 | 207 | { |
| 208 | 208 | $converted = '"'.$converted.'"'; |
| 209 | 209 | } |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | try |
| 60 | 60 | { |
| 61 | 61 | throw new BaseException(''); |
| 62 | - } |
|
| 63 | - catch(BaseException $e) |
|
| 62 | + } catch(BaseException $e) |
|
| 64 | 63 | { |
| 65 | 64 | echo self::createInfo($e)->toString(); |
| 66 | 65 | } |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | try |
| 75 | 74 | { |
| 76 | 75 | throw new BaseException(''); |
| 77 | - } |
|
| 78 | - catch(BaseException $e) |
|
| 76 | + } catch(BaseException $e) |
|
| 79 | 77 | { |
| 80 | 78 | echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">'; |
| 81 | 79 | echo self::createInfo($e)->toString(); |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | protected ?string $details = null; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @param string $message |
|
| 30 | - * @param string|NULL $details |
|
| 31 | - * @param int|NULL $code |
|
| 32 | - * @param Throwable|NULL $previous |
|
| 33 | - */ |
|
| 28 | + /** |
|
| 29 | + * @param string $message |
|
| 30 | + * @param string|NULL $details |
|
| 31 | + * @param int|NULL $code |
|
| 32 | + * @param Throwable|NULL $previous |
|
| 33 | + */ |
|
| 34 | 34 | public function __construct(string $message, ?string $details=null, ?int $code=null, ?Throwable $previous=null) |
| 35 | 35 | { |
| 36 | 36 | if(defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true') |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | if($code === null) |
| 42 | 42 | { |
| 43 | - $code = 0; |
|
| 43 | + $code = 0; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | parent::__construct($message, (int)$code, $previous); |
@@ -48,18 +48,18 @@ discard block |
||
| 48 | 48 | $this->details = $details; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Retrieves the detailed error description, if any. |
|
| 53 | - * @return string |
|
| 54 | - */ |
|
| 51 | + /** |
|
| 52 | + * Retrieves the detailed error description, if any. |
|
| 53 | + * @return string |
|
| 54 | + */ |
|
| 55 | 55 | public function getDetails() : string |
| 56 | 56 | { |
| 57 | 57 | return $this->details ?? ''; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Displays pertinent information on the exception. |
|
| 62 | - */ |
|
| 60 | + /** |
|
| 61 | + * Displays pertinent information on the exception. |
|
| 62 | + */ |
|
| 63 | 63 | public function display() : void |
| 64 | 64 | { |
| 65 | 65 | if(!headers_sent()) { |
@@ -69,20 +69,20 @@ discard block |
||
| 69 | 69 | echo $this->getInfo(); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Retrieves information on the exception that can be |
|
| 74 | - * easily accessed. |
|
| 75 | - * |
|
| 76 | - * @return ConvertHelper_ThrowableInfo |
|
| 77 | - */ |
|
| 72 | + /** |
|
| 73 | + * Retrieves information on the exception that can be |
|
| 74 | + * easily accessed. |
|
| 75 | + * |
|
| 76 | + * @return ConvertHelper_ThrowableInfo |
|
| 77 | + */ |
|
| 78 | 78 | public function getInfo() : ConvertHelper_ThrowableInfo |
| 79 | 79 | { |
| 80 | 80 | return ConvertHelper::throwable2info($this); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Dumps a current PHP function trace, as a text only string. |
|
| 85 | - */ |
|
| 83 | + /** |
|
| 84 | + * Dumps a current PHP function trace, as a text only string. |
|
| 85 | + */ |
|
| 86 | 86 | public static function dumpTraceAsString() : void |
| 87 | 87 | { |
| 88 | 88 | try |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Dumps a current PHP function trace, with HTML styling. |
|
| 100 | - */ |
|
| 98 | + /** |
|
| 99 | + * Dumps a current PHP function trace, with HTML styling. |
|
| 100 | + */ |
|
| 101 | 101 | public static function dumpTraceAsHTML() : void |
| 102 | 102 | { |
| 103 | 103 | try |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Creates an exception info instance from a throwable instance. |
|
| 117 | - * |
|
| 118 | - * @param Throwable $e |
|
| 119 | - * @return ConvertHelper_ThrowableInfo |
|
| 120 | - * @see ConvertHelper::throwable2info() |
|
| 121 | - */ |
|
| 115 | + /** |
|
| 116 | + * Creates an exception info instance from a throwable instance. |
|
| 117 | + * |
|
| 118 | + * @param Throwable $e |
|
| 119 | + * @return ConvertHelper_ThrowableInfo |
|
| 120 | + * @see ConvertHelper::throwable2info() |
|
| 121 | + */ |
|
| 122 | 122 | public static function createInfo(Throwable $e) : ConvertHelper_ThrowableInfo |
| 123 | 123 | { |
| 124 | 124 | return ConvertHelper::throwable2info($e); |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | * @param int|NULL $code |
| 32 | 32 | * @param Throwable|NULL $previous |
| 33 | 33 | */ |
| 34 | - public function __construct(string $message, ?string $details=null, ?int $code=null, ?Throwable $previous=null) |
|
| 34 | + public function __construct(string $message, ?string $details = null, ?int $code = null, ?Throwable $previous = null) |
|
| 35 | 35 | { |
| 36 | - if(defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true') |
|
| 36 | + if (defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true') |
|
| 37 | 37 | { |
| 38 | 38 | $message .= PHP_EOL.$details; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($code === null) |
|
| 41 | + if ($code === null) |
|
| 42 | 42 | { |
| 43 | 43 | $code = 0; |
| 44 | 44 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function display() : void |
| 64 | 64 | { |
| 65 | - if(!headers_sent()) { |
|
| 65 | + if (!headers_sent()) { |
|
| 66 | 66 | header('Content-type:text/plain; charset=utf-8'); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | throw new BaseException(''); |
| 91 | 91 | } |
| 92 | - catch(BaseException $e) |
|
| 92 | + catch (BaseException $e) |
|
| 93 | 93 | { |
| 94 | 94 | echo self::createInfo($e)->toString(); |
| 95 | 95 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | throw new BaseException(''); |
| 106 | 106 | } |
| 107 | - catch(BaseException $e) |
|
| 107 | + catch (BaseException $e) |
|
| 108 | 108 | { |
| 109 | 109 | echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">'; |
| 110 | 110 | echo self::createInfo($e)->toString(); |
@@ -198,8 +198,7 @@ discard block |
||
| 198 | 198 | } else { |
| 199 | 199 | $this->addValueLine($name, $values[$i]); |
| 200 | 200 | } |
| 201 | - } |
|
| 202 | - else |
|
| 201 | + } else |
|
| 203 | 202 | { |
| 204 | 203 | $this->deleteLine($lines[$i]); |
| 205 | 204 | } |
@@ -219,8 +218,7 @@ discard block |
||
| 219 | 218 | foreach($lines as $delete) { |
| 220 | 219 | $this->deleteLine($delete); |
| 221 | 220 | } |
| 222 | - } |
|
| 223 | - else |
|
| 221 | + } else |
|
| 224 | 222 | { |
| 225 | 223 | $this->addValueLine($name, $value); |
| 226 | 224 | } |
@@ -258,8 +256,7 @@ discard block |
||
| 258 | 256 | if(empty($lines)) |
| 259 | 257 | { |
| 260 | 258 | $this->addValueLine($name, $value); |
| 261 | - } |
|
| 262 | - else |
|
| 259 | + } else |
|
| 263 | 260 | { |
| 264 | 261 | $found = false; |
| 265 | 262 | |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | protected IniHelper $ini; |
| 27 | 27 | protected string $name; |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var INILine[] |
|
| 31 | - */ |
|
| 29 | + /** |
|
| 30 | + * @var INILine[] |
|
| 31 | + */ |
|
| 32 | 32 | protected array $lines = array(); |
| 33 | 33 | |
| 34 | 34 | public function __construct(IniHelper $ini, string $name) |
@@ -37,33 +37,33 @@ discard block |
||
| 37 | 37 | $this->name = $name; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * The section's name. |
|
| 42 | - * @return string |
|
| 43 | - */ |
|
| 40 | + /** |
|
| 41 | + * The section's name. |
|
| 42 | + * @return string |
|
| 43 | + */ |
|
| 44 | 44 | public function getName() : string |
| 45 | 45 | { |
| 46 | 46 | return $this->name; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Whether this is the default section: this |
|
| 51 | - * is used internally to store all variables that |
|
| 52 | - * are not in any specific section. |
|
| 53 | - * |
|
| 54 | - * @return bool |
|
| 55 | - */ |
|
| 49 | + /** |
|
| 50 | + * Whether this is the default section: this |
|
| 51 | + * is used internally to store all variables that |
|
| 52 | + * are not in any specific section. |
|
| 53 | + * |
|
| 54 | + * @return bool |
|
| 55 | + */ |
|
| 56 | 56 | public function isDefault() : bool |
| 57 | 57 | { |
| 58 | 58 | return $this->name === IniHelper::SECTION_DEFAULT; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Adds a line instance to the section. |
|
| 63 | - * |
|
| 64 | - * @param INILine $line |
|
| 65 | - * @return IniHelper_Section |
|
| 66 | - */ |
|
| 61 | + /** |
|
| 62 | + * Adds a line instance to the section. |
|
| 63 | + * |
|
| 64 | + * @param INILine $line |
|
| 65 | + * @return IniHelper_Section |
|
| 66 | + */ |
|
| 67 | 67 | public function addLine(INILine $line) : IniHelper_Section |
| 68 | 68 | { |
| 69 | 69 | $this->lines[] = $line; |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Converts the values contained in the section into |
|
| 76 | - * an associative array. |
|
| 77 | - * |
|
| 78 | - * @return array<string,array<int,string>> |
|
| 79 | - */ |
|
| 74 | + /** |
|
| 75 | + * Converts the values contained in the section into |
|
| 76 | + * an associative array. |
|
| 77 | + * |
|
| 78 | + * @return array<string,array<int,string>> |
|
| 79 | + */ |
|
| 80 | 80 | public function toArray() : array |
| 81 | 81 | { |
| 82 | 82 | $result = array(); |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | return implode($this->ini->getEOLChar(), $lines); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * Deletes a line from the section. |
|
| 141 | - * |
|
| 142 | - * @param INILine $toDelete |
|
| 143 | - * @return IniHelper_Section |
|
| 144 | - */ |
|
| 139 | + /** |
|
| 140 | + * Deletes a line from the section. |
|
| 141 | + * |
|
| 142 | + * @param INILine $toDelete |
|
| 143 | + * @return IniHelper_Section |
|
| 144 | + */ |
|
| 145 | 145 | public function deleteLine(INILine $toDelete) : IniHelper_Section |
| 146 | 146 | { |
| 147 | 147 | $keep = array(); |
@@ -226,15 +226,15 @@ discard block |
||
| 226 | 226 | return $this; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - /** |
|
| 230 | - * Adds a variable value to the section. Unlike setValue(), this |
|
| 231 | - * will not overwrite any existing value. If the name is an existing |
|
| 232 | - * variable name, it will be converted to duplicate keys. |
|
| 233 | - * |
|
| 234 | - * @param string $name |
|
| 235 | - * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
| 236 | - * @return IniHelper_Section |
|
| 237 | - */ |
|
| 229 | + /** |
|
| 230 | + * Adds a variable value to the section. Unlike setValue(), this |
|
| 231 | + * will not overwrite any existing value. If the name is an existing |
|
| 232 | + * variable name, it will be converted to duplicate keys. |
|
| 233 | + * |
|
| 234 | + * @param string $name |
|
| 235 | + * @param mixed $value If this is an array, it will be treated as duplicate keys, and all values that are not present yet will be added. |
|
| 236 | + * @return IniHelper_Section |
|
| 237 | + */ |
|
| 238 | 238 | public function addValue(string $name, $value) : IniHelper_Section |
| 239 | 239 | { |
| 240 | 240 | // array value? Treat it as duplicate keys. |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | |
| 300 | - /** |
|
| 301 | - * Retrieves all lines for the specified variable name. |
|
| 302 | - * |
|
| 303 | - * @param string $name |
|
| 304 | - * @return INILine[] |
|
| 305 | - */ |
|
| 300 | + /** |
|
| 301 | + * Retrieves all lines for the specified variable name. |
|
| 302 | + * |
|
| 303 | + * @param string $name |
|
| 304 | + * @return INILine[] |
|
| 305 | + */ |
|
| 306 | 306 | public function getLinesByVariable(string $name) : array |
| 307 | 307 | { |
| 308 | 308 | $result = array(); |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $result = array(); |
| 83 | 83 | |
| 84 | - foreach($this->lines as $line) |
|
| 84 | + foreach ($this->lines as $line) |
|
| 85 | 85 | { |
| 86 | - if(!$line->isValue()) { |
|
| 86 | + if (!$line->isValue()) { |
|
| 87 | 87 | continue; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $name = $line->getVarName(); |
| 91 | 91 | |
| 92 | - if(!isset($result[$name])) |
|
| 92 | + if (!isset($result[$name])) |
|
| 93 | 93 | { |
| 94 | 94 | $result[$name] = $line->getVarValue(); |
| 95 | 95 | continue; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | // name exists in collection? Then this is a |
| 99 | 99 | // duplicate key, and we need to convert it to |
| 100 | 100 | // an indexed array of values. |
| 101 | - if(!is_array($result[$name])) |
|
| 101 | + if (!is_array($result[$name])) |
|
| 102 | 102 | { |
| 103 | 103 | $result[$name] = array($result[$name]); |
| 104 | 104 | } |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | public function toString() : string |
| 119 | 119 | { |
| 120 | 120 | $lines = array(); |
| 121 | - if(!$this->isDefault()) |
|
| 121 | + if (!$this->isDefault()) |
|
| 122 | 122 | { |
| 123 | 123 | $lines[] = '['.$this->getName().']'; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - foreach($this->lines as $line) |
|
| 126 | + foreach ($this->lines as $line) |
|
| 127 | 127 | { |
| 128 | 128 | // we already did this |
| 129 | - if($line->isSection()) { |
|
| 129 | + if ($line->isSection()) { |
|
| 130 | 130 | continue; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | $keep = array(); |
| 148 | 148 | |
| 149 | - foreach($this->lines as $line) |
|
| 149 | + foreach ($this->lines as $line) |
|
| 150 | 150 | { |
| 151 | - if($line !== $toDelete) { |
|
| 151 | + if ($line !== $toDelete) { |
|
| 152 | 152 | $keep[] = $line; |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -174,23 +174,23 @@ discard block |
||
| 174 | 174 | // Removes any superfluous values that may |
| 175 | 175 | // already exist, if there are more than the |
| 176 | 176 | // new set of values. |
| 177 | - if(is_array($value)) |
|
| 177 | + if (is_array($value)) |
|
| 178 | 178 | { |
| 179 | 179 | $values = array_values($value); |
| 180 | 180 | $amountNew = count($values); |
| 181 | 181 | $amountExisting = count($lines); |
| 182 | 182 | |
| 183 | 183 | $max = $amountNew; |
| 184 | - if($amountExisting > $max) { |
|
| 184 | + if ($amountExisting > $max) { |
|
| 185 | 185 | $max = $amountExisting; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - for($i=0; $i < $max; $i++) |
|
| 188 | + for ($i = 0; $i < $max; $i++) |
|
| 189 | 189 | { |
| 190 | 190 | // new value exists |
| 191 | - if(isset($values[$i])) |
|
| 191 | + if (isset($values[$i])) |
|
| 192 | 192 | { |
| 193 | - if(isset($lines[$i])) { |
|
| 193 | + if (isset($lines[$i])) { |
|
| 194 | 194 | $lines[$i]->setValue($values[$i]); |
| 195 | 195 | } else { |
| 196 | 196 | $this->addValueLine($name, $values[$i]); |
@@ -208,12 +208,12 @@ discard block |
||
| 208 | 208 | else |
| 209 | 209 | { |
| 210 | 210 | // remove all superfluous lines |
| 211 | - if(!empty($lines)) |
|
| 211 | + if (!empty($lines)) |
|
| 212 | 212 | { |
| 213 | 213 | $line = array_shift($lines); // keep only the first line |
| 214 | 214 | $line->setValue($value); |
| 215 | 215 | |
| 216 | - foreach($lines as $delete) { |
|
| 216 | + foreach ($lines as $delete) { |
|
| 217 | 217 | $this->deleteLine($delete); |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -238,11 +238,11 @@ discard block |
||
| 238 | 238 | public function addValue(string $name, $value) : IniHelper_Section |
| 239 | 239 | { |
| 240 | 240 | // array value? Treat it as duplicate keys. |
| 241 | - if(is_array($value)) |
|
| 241 | + if (is_array($value)) |
|
| 242 | 242 | { |
| 243 | 243 | $values = array_values($value); |
| 244 | 244 | |
| 245 | - foreach($values as $setValue) |
|
| 245 | + foreach ($values as $setValue) |
|
| 246 | 246 | { |
| 247 | 247 | $this->addValue($name, $setValue); |
| 248 | 248 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $lines = $this->getLinesByVariable($name); |
| 254 | 254 | |
| 255 | - if(empty($lines)) |
|
| 255 | + if (empty($lines)) |
|
| 256 | 256 | { |
| 257 | 257 | $this->addValueLine($name, $value); |
| 258 | 258 | } |
@@ -260,15 +260,15 @@ discard block |
||
| 260 | 260 | { |
| 261 | 261 | $found = false; |
| 262 | 262 | |
| 263 | - foreach($lines as $line) |
|
| 263 | + foreach ($lines as $line) |
|
| 264 | 264 | { |
| 265 | - if($line->getVarValue() === $value) { |
|
| 265 | + if ($line->getVarValue() === $value) { |
|
| 266 | 266 | $found = $line; |
| 267 | 267 | break; |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - if(!$found) |
|
| 271 | + if (!$found) |
|
| 272 | 272 | { |
| 273 | 273 | $this->addValueLine($name, $value); |
| 274 | 274 | } |
@@ -307,9 +307,9 @@ discard block |
||
| 307 | 307 | { |
| 308 | 308 | $result = array(); |
| 309 | 309 | |
| 310 | - foreach($this->lines as $line) |
|
| 310 | + foreach ($this->lines as $line) |
|
| 311 | 311 | { |
| 312 | - if($line->isValue() && $line->getVarName() === $name) { |
|
| 312 | + if ($line->isValue() && $line->getVarName() === $name) { |
|
| 313 | 313 | $result[] = $line; |
| 314 | 314 | } |
| 315 | 315 | } |
@@ -63,7 +63,7 @@ |
||
| 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; |
@@ -92,8 +92,7 @@ |
||
| 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; |
@@ -4,37 +4,37 @@ discard block |
||
| 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 |
||
| 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) { |
@@ -41,8 +41,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class ConvertHelper_ByteConverter |
| 25 | 25 | { |
| 26 | - /** |
|
| 27 | - * @var int |
|
| 28 | - */ |
|
| 26 | + /** |
|
| 27 | + * @var int |
|
| 28 | + */ |
|
| 29 | 29 | protected $bytes; |
| 30 | 30 | |
| 31 | 31 | public function __construct(int $bytes) |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Detects the size matching the byte value for the specified base. |
|
| 44 | - * |
|
| 45 | - * @param int $base |
|
| 46 | - * @return ConvertHelper_StorageSizeEnum_Size |
|
| 47 | - */ |
|
| 42 | + /** |
|
| 43 | + * Detects the size matching the byte value for the specified base. |
|
| 44 | + * |
|
| 45 | + * @param int $base |
|
| 46 | + * @return ConvertHelper_StorageSizeEnum_Size |
|
| 47 | + */ |
|
| 48 | 48 | protected function detectSize(int $base) : ConvertHelper_StorageSizeEnum_Size |
| 49 | 49 | { |
| 50 | 50 | $sizes = $this->getSizesSorted($base); |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | return ConvertHelper_StorageSizeEnum::getSizeByName('b'); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Retrieves all storage sizes for the specified base, |
|
| 75 | - * sorted from smallest byte size to highest. |
|
| 76 | - * |
|
| 77 | - * @param int $base |
|
| 78 | - * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[] |
|
| 79 | - */ |
|
| 73 | + /** |
|
| 74 | + * Retrieves all storage sizes for the specified base, |
|
| 75 | + * sorted from smallest byte size to highest. |
|
| 76 | + * |
|
| 77 | + * @param int $base |
|
| 78 | + * @return \AppUtils\ConvertHelper_StorageSizeEnum_Size[] |
|
| 79 | + */ |
|
| 80 | 80 | protected function getSizesSorted(int $base) |
| 81 | 81 | { |
| 82 | 82 | $sizes = ConvertHelper_StorageSizeEnum::getSizesByBase($base); |
@@ -89,16 +89,16 @@ discard block |
||
| 89 | 89 | return $sizes; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Converts the byte value to a human readable string, e.g. "5 KB", "140 MB". |
|
| 94 | - * |
|
| 95 | - * @param int $precision The amount of decimals (rounded up) |
|
| 96 | - * @param int $base The base to calculate bytes with. |
|
| 97 | - * @return string |
|
| 98 | - * |
|
| 99 | - * @see ConvertHelper_StorageSizeEnum::BASE_10 |
|
| 100 | - * @see ConvertHelper_StorageSizeEnum::BASE_2 |
|
| 101 | - */ |
|
| 92 | + /** |
|
| 93 | + * Converts the byte value to a human readable string, e.g. "5 KB", "140 MB". |
|
| 94 | + * |
|
| 95 | + * @param int $precision The amount of decimals (rounded up) |
|
| 96 | + * @param int $base The base to calculate bytes with. |
|
| 97 | + * @return string |
|
| 98 | + * |
|
| 99 | + * @see ConvertHelper_StorageSizeEnum::BASE_10 |
|
| 100 | + * @see ConvertHelper_StorageSizeEnum::BASE_2 |
|
| 101 | + */ |
|
| 102 | 102 | public function toString(int $precision, int $base=ConvertHelper_StorageSizeEnum::BASE_10) : string |
| 103 | 103 | { |
| 104 | 104 | $size = $this->detectSize($base); |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | return round($this->bytes / $size->getBytes(), $precision) . ' ' . $size->getSuffix(); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Converts the byte value to the amount of the corresponding units (KB, MB...). |
|
| 111 | - * |
|
| 112 | - * @param int $precision The amount of decimals (rounded up) |
|
| 113 | - * @param string $sizeName The lowercase storage size name (e.g. "kb", "kib") |
|
| 114 | - * @return float |
|
| 115 | - */ |
|
| 109 | + /** |
|
| 110 | + * Converts the byte value to the amount of the corresponding units (KB, MB...). |
|
| 111 | + * |
|
| 112 | + * @param int $precision The amount of decimals (rounded up) |
|
| 113 | + * @param string $sizeName The lowercase storage size name (e.g. "kb", "kib") |
|
| 114 | + * @return float |
|
| 115 | + */ |
|
| 116 | 116 | public function toNumber(int $precision, string $sizeName) : float |
| 117 | 117 | { |
| 118 | 118 | $size = ConvertHelper_StorageSizeEnum::getSizeByName($sizeName); |
@@ -120,56 +120,56 @@ discard block |
||
| 120 | 120 | return round($this->bytes / $size->getBytes(), $precision); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - /** |
|
| 124 | - * Converts the bytes to Kilobytes. |
|
| 125 | - * |
|
| 126 | - * @param int $precision Amount of decimals (rounded up) |
|
| 127 | - * @return float |
|
| 128 | - */ |
|
| 123 | + /** |
|
| 124 | + * Converts the bytes to Kilobytes. |
|
| 125 | + * |
|
| 126 | + * @param int $precision Amount of decimals (rounded up) |
|
| 127 | + * @return float |
|
| 128 | + */ |
|
| 129 | 129 | public function toKilobytes(int $precision=1) : float |
| 130 | 130 | { |
| 131 | 131 | return $this->toNumber($precision, 'kb'); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * Converts the bytes to Megabytes. |
|
| 136 | - * |
|
| 137 | - * @param int $precision Amount of decimals (rounded up) |
|
| 138 | - * @return float |
|
| 139 | - */ |
|
| 134 | + /** |
|
| 135 | + * Converts the bytes to Megabytes. |
|
| 136 | + * |
|
| 137 | + * @param int $precision Amount of decimals (rounded up) |
|
| 138 | + * @return float |
|
| 139 | + */ |
|
| 140 | 140 | public function toMegabytes(int $precision=1) : float |
| 141 | 141 | { |
| 142 | 142 | return $this->toNumber($precision, 'mb'); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * Converts the bytes to Gigabytes. |
|
| 147 | - * |
|
| 148 | - * @param int $precision Amount of decimals (rounded up) |
|
| 149 | - * @return float |
|
| 150 | - */ |
|
| 145 | + /** |
|
| 146 | + * Converts the bytes to Gigabytes. |
|
| 147 | + * |
|
| 148 | + * @param int $precision Amount of decimals (rounded up) |
|
| 149 | + * @return float |
|
| 150 | + */ |
|
| 151 | 151 | public function toGigabytes(int $precision=1) : float |
| 152 | 152 | { |
| 153 | 153 | return $this->toNumber($precision, 'gb'); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * Converts the bytes to Terabytes. |
|
| 158 | - * |
|
| 159 | - * @param int $precision Amount of decimals (rounded up) |
|
| 160 | - * @return float |
|
| 161 | - */ |
|
| 156 | + /** |
|
| 157 | + * Converts the bytes to Terabytes. |
|
| 158 | + * |
|
| 159 | + * @param int $precision Amount of decimals (rounded up) |
|
| 160 | + * @return float |
|
| 161 | + */ |
|
| 162 | 162 | public function toTerabytes(int $precision=1) : float |
| 163 | 163 | { |
| 164 | 164 | return $this->toNumber($precision, 'tb'); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - /** |
|
| 168 | - * Converts the bytes to Petabytes. |
|
| 169 | - * |
|
| 170 | - * @param int $precision Amount of decimals (rounded up) |
|
| 171 | - * @return float |
|
| 172 | - */ |
|
| 167 | + /** |
|
| 168 | + * Converts the bytes to Petabytes. |
|
| 169 | + * |
|
| 170 | + * @param int $precision Amount of decimals (rounded up) |
|
| 171 | + * @return float |
|
| 172 | + */ |
|
| 173 | 173 | public function toPetabytes(int $precision=1) : float |
| 174 | 174 | { |
| 175 | 175 | return $this->toNumber($precision, 'pb'); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $this->bytes = $bytes; |
| 34 | 34 | |
| 35 | 35 | // correct negative values |
| 36 | - if($this->bytes < 0) |
|
| 36 | + if ($this->bytes < 0) |
|
| 37 | 37 | { |
| 38 | 38 | $this->bytes = 0; |
| 39 | 39 | } |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | $sizes = $this->getSizesSorted($base); |
| 51 | 51 | |
| 52 | - if($this->bytes >= $sizes[0]->getBytes()) |
|
| 52 | + if ($this->bytes >= $sizes[0]->getBytes()) |
|
| 53 | 53 | { |
| 54 | 54 | $total = count($sizes); |
| 55 | 55 | |
| 56 | - for($i=0; $i < $total; $i++) |
|
| 56 | + for ($i = 0; $i < $total; $i++) |
|
| 57 | 57 | { |
| 58 | 58 | $size = $sizes[$i]; |
| 59 | 59 | |
| 60 | - if(!isset($sizes[($i+1)])) { |
|
| 60 | + if (!isset($sizes[($i + 1)])) { |
|
| 61 | 61 | return $size; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if($this->bytes >= $size->getBytes() && $this->bytes < $sizes[($i+1)]->getBytes()) { |
|
| 64 | + if ($this->bytes >= $size->getBytes() && $this->bytes < $sizes[($i + 1)]->getBytes()) { |
|
| 65 | 65 | return $size; |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | * @see ConvertHelper_StorageSizeEnum::BASE_10 |
| 100 | 100 | * @see ConvertHelper_StorageSizeEnum::BASE_2 |
| 101 | 101 | */ |
| 102 | - public function toString(int $precision, int $base=ConvertHelper_StorageSizeEnum::BASE_10) : string |
|
| 102 | + public function toString(int $precision, int $base = ConvertHelper_StorageSizeEnum::BASE_10) : string |
|
| 103 | 103 | { |
| 104 | 104 | $size = $this->detectSize($base); |
| 105 | 105 | |
| 106 | - return round($this->bytes / $size->getBytes(), $precision) . ' ' . $size->getSuffix(); |
|
| 106 | + return round($this->bytes / $size->getBytes(), $precision).' '.$size->getSuffix(); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param int $precision Amount of decimals (rounded up) |
| 127 | 127 | * @return float |
| 128 | 128 | */ |
| 129 | - public function toKilobytes(int $precision=1) : float |
|
| 129 | + public function toKilobytes(int $precision = 1) : float |
|
| 130 | 130 | { |
| 131 | 131 | return $this->toNumber($precision, 'kb'); |
| 132 | 132 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param int $precision Amount of decimals (rounded up) |
| 138 | 138 | * @return float |
| 139 | 139 | */ |
| 140 | - public function toMegabytes(int $precision=1) : float |
|
| 140 | + public function toMegabytes(int $precision = 1) : float |
|
| 141 | 141 | { |
| 142 | 142 | return $this->toNumber($precision, 'mb'); |
| 143 | 143 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @param int $precision Amount of decimals (rounded up) |
| 149 | 149 | * @return float |
| 150 | 150 | */ |
| 151 | - public function toGigabytes(int $precision=1) : float |
|
| 151 | + public function toGigabytes(int $precision = 1) : float |
|
| 152 | 152 | { |
| 153 | 153 | return $this->toNumber($precision, 'gb'); |
| 154 | 154 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param int $precision Amount of decimals (rounded up) |
| 160 | 160 | * @return float |
| 161 | 161 | */ |
| 162 | - public function toTerabytes(int $precision=1) : float |
|
| 162 | + public function toTerabytes(int $precision = 1) : float |
|
| 163 | 163 | { |
| 164 | 164 | return $this->toNumber($precision, 'tb'); |
| 165 | 165 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param int $precision Amount of decimals (rounded up) |
| 171 | 171 | * @return float |
| 172 | 172 | */ |
| 173 | - public function toPetabytes(int $precision=1) : float |
|
| 173 | + public function toPetabytes(int $precision = 1) : float |
|
| 174 | 174 | { |
| 175 | 175 | return $this->toNumber($precision, 'pb'); |
| 176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param int $precision Amount of decimals (rounded up) |
| 182 | 182 | * @return float |
| 183 | 183 | */ |
| 184 | - public function toKibibytes(int $precision=1) : float |
|
| 184 | + public function toKibibytes(int $precision = 1) : float |
|
| 185 | 185 | { |
| 186 | 186 | return $this->toNumber($precision, 'kib'); |
| 187 | 187 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @param int $precision Amount of decimals (rounded up) |
| 193 | 193 | * @return float |
| 194 | 194 | */ |
| 195 | - public function toMebibytes(int $precision=1) : float |
|
| 195 | + public function toMebibytes(int $precision = 1) : float |
|
| 196 | 196 | { |
| 197 | 197 | return $this->toNumber($precision, 'mib'); |
| 198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * @param int $precision Amount of decimals (rounded up) |
| 204 | 204 | * @return float |
| 205 | 205 | */ |
| 206 | - public function toGibibytes(int $precision=1) : float |
|
| 206 | + public function toGibibytes(int $precision = 1) : float |
|
| 207 | 207 | { |
| 208 | 208 | return $this->toNumber($precision, 'gib'); |
| 209 | 209 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param int $precision Amount of decimals (rounded up) |
| 215 | 215 | * @return float |
| 216 | 216 | */ |
| 217 | - public function toTebibytes(int $precision=1) : float |
|
| 217 | + public function toTebibytes(int $precision = 1) : float |
|
| 218 | 218 | { |
| 219 | 219 | return $this->toNumber($precision, 'tib'); |
| 220 | 220 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @param int $precision Amount of decimals (rounded up) |
| 226 | 226 | * @return float |
| 227 | 227 | */ |
| 228 | - public function toPebibytes(int $precision=1) : float |
|
| 228 | + public function toPebibytes(int $precision = 1) : float |
|
| 229 | 229 | { |
| 230 | 230 | return $this->toNumber($precision, 'pib'); |
| 231 | 231 | } |