@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | */ |
| 579 | 579 | public function set_debug($debug) |
| 580 | 580 | { |
| 581 | - $this->debug = (bool)$debug; |
|
| 581 | + $this->debug = (bool) $debug; |
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | //////////////////////////////////////////////////////////////////////////// |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | { |
| 721 | 721 | $return = $this->seafapi->checkAccountInfo(); |
| 722 | 722 | $avail = $return->total - $return->usage; |
| 723 | - if (-2 === (int)$return->total) { |
|
| 723 | + if (-2 === (int) $return->total) { |
|
| 724 | 724 | return -1; |
| 725 | 725 | } |
| 726 | 726 | |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | $path = "/$path"; |
| 840 | 840 | } |
| 841 | 841 | $lib = $libraries[$libName]->id ?? null; |
| 842 | - return (object)['lib' => $lib, 'path' => $path, 'libName' => $libName]; |
|
| 842 | + return (object) ['lib' => $lib, 'path' => $path, 'libName' => $libName]; |
|
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | /** |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | $messages = $exception->tryApiErrorMessages(); |
| 937 | 937 | null === $messages || $apiErrorMessagesHtml = implode( |
| 938 | 938 | "<br/>\n", |
| 939 | - array_map(static function (string $subject) { |
|
| 939 | + array_map(static function(string $subject) { |
|
| 940 | 940 | return htmlspecialchars($subject, ENT_QUOTES | ENT_HTML5); |
| 941 | 941 | }, $messages) |
| 942 | 942 | ) . "<br/>\n"; |
@@ -80,9 +80,9 @@ |
||
| 80 | 80 | { |
| 81 | 81 | $config = $this; |
| 82 | 82 | |
| 83 | - $ssl = (bool)$config->ssl; |
|
| 83 | + $ssl = (bool) $config->ssl; |
|
| 84 | 84 | $defaultPort = $ssl ? 443 : 80; |
| 85 | - $port = max(0, min(65535, (int)$config->port)) ?: $defaultPort; |
|
| 85 | + $port = max(0, min(65535, (int) $config->port)) ?: $defaultPort; |
|
| 86 | 86 | $host = rtrim($config->server, '/'); |
| 87 | 87 | $path = ltrim($config->path, '/'); |
| 88 | 88 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | * @psalm-param-out SsoBackend $self |
| 20 | 20 | * @return SsoBackend |
| 21 | 21 | */ |
| 22 | - public static function bind(?SsoBackend &$self = null): SsoBackend |
|
| 22 | + public static function bind(?SsoBackend & $self = null): SsoBackend |
|
| 23 | 23 | { |
| 24 | 24 | if ($self === null) { |
| 25 | 25 | $self = new self(); |
@@ -70,17 +70,17 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @see jsonDecode |
| 72 | 72 | */ |
| 73 | - private const JSON_DECODE_ACCEPT_MASK = 31; # 1 1111 accept bitmask (five bits with the msb flags) |
|
| 74 | - private const JSON_DECODE_ACCEPT_JSON = 16; # 1 0000 JSON text |
|
| 75 | - private const JSON_DECODE_ACCEPT_DEFAULT = 23; # 1 0111 default: string, array or object |
|
| 76 | - private const JSON_DECODE_ACCEPT_OBJECT = 17; # 1 0001 object |
|
| 77 | - private const JSON_DECODE_ACCEPT_ARRAY = 18; # 1 0010 array |
|
| 78 | - private const JSON_DECODE_ACCEPT_STRING = 20; # 1 0100 string |
|
| 79 | - private const JSON_DECODE_ACCEPT_ARRAY_OF_OBJECTS = 24; # 1 1000 array with only objects (incl. none) |
|
| 80 | - private const JSON_DECODE_ACCEPT_ARRAY_SINGLE_OBJECT = 25; # 1 1001 array with one single object, return that item |
|
| 73 | + private const JSON_DECODE_ACCEPT_MASK = 31; # 1 1111 accept bitmask (five bits with the msb flags) |
|
| 74 | + private const JSON_DECODE_ACCEPT_JSON = 16; # 1 0000 JSON text |
|
| 75 | + private const JSON_DECODE_ACCEPT_DEFAULT = 23; # 1 0111 default: string, array or object |
|
| 76 | + private const JSON_DECODE_ACCEPT_OBJECT = 17; # 1 0001 object |
|
| 77 | + private const JSON_DECODE_ACCEPT_ARRAY = 18; # 1 0010 array |
|
| 78 | + private const JSON_DECODE_ACCEPT_STRING = 20; # 1 0100 string |
|
| 79 | + private const JSON_DECODE_ACCEPT_ARRAY_OF_OBJECTS = 24; # 1 1000 array with only objects (incl. none) |
|
| 80 | + private const JSON_DECODE_ACCEPT_ARRAY_SINGLE_OBJECT = 25; # 1 1001 array with one single object, return that item |
|
| 81 | 81 | private const JSON_DECODE_ACCEPT_ARRAY_SINGLE_OBJECT_NULLABLE = 26; # 1 1010 array with one single object, return that item, or empty array, return null |
| 82 | - private const JSON_DECODE_ACCEPT_SUCCESS_STRING = 28; # 1 1100 string "success" |
|
| 83 | - private const JSON_DECODE_ACCEPT_SUCCESS_OBJECT = 29; # 1 1101 object with single "success" property and value true |
|
| 82 | + private const JSON_DECODE_ACCEPT_SUCCESS_STRING = 28; # 1 1100 string "success" |
|
| 83 | + private const JSON_DECODE_ACCEPT_SUCCESS_OBJECT = 29; # 1 1101 object with single "success" property and value true |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * @const string ASCII upper-case characters part of a hexit |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | |
| 364 | 364 | $name = explode('/', ltrim($this->normalizePath($libNamedPath), '/'), 2)[0]; |
| 365 | 365 | |
| 366 | - return (object)[ |
|
| 366 | + return (object) [ |
|
| 367 | 367 | 'id' => $libraries[$name]->id ?? null, |
| 368 | 368 | 'name' => $libraries[$name]->name ?? null, |
| 369 | 369 | ]; |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | if (null !== $expire) { |
| 423 | 423 | $expireTime = $expire; |
| 424 | 424 | if (is_int($expire)) { |
| 425 | - $expireDays = max(1, min(365, (int)$expire)); |
|
| 425 | + $expireDays = max(1, min(365, (int) $expire)); |
|
| 426 | 426 | $expireTime = (new DateTimeImmutable())->add( |
| 427 | 427 | new \DateInterval("P{$expireDays}D") |
| 428 | 428 | ); |
@@ -1407,7 +1407,7 @@ discard block |
||
| 1407 | 1407 | ), |
| 1408 | 1408 | self::JSON_DECODE_ACCEPT_OBJECT, |
| 1409 | 1409 | ); |
| 1410 | - $this->token = (string)$data->token; |
|
| 1410 | + $this->token = (string) $data->token; |
|
| 1411 | 1411 | } |
| 1412 | 1412 | |
| 1413 | 1413 | /** |
@@ -1528,7 +1528,7 @@ discard block |
||
| 1528 | 1528 | } |
| 1529 | 1529 | |
| 1530 | 1530 | if (self::JSON_DECODE_ACCEPT_SUCCESS_OBJECT === $accept) { |
| 1531 | - if (is_object($result) && (array)$result === ['success' => true]) { |
|
| 1531 | + if (is_object($result) && (array) $result === ['success' => true]) { |
|
| 1532 | 1532 | return $result; |
| 1533 | 1533 | } |
| 1534 | 1534 | throw JsonDecodeException::create(sprintf('json decode accept %5d error [%s] of %s', decbin($accept), gettype($result), JsonDecodeException::shorten($jsonText)), $jsonText); |
@@ -1598,7 +1598,7 @@ discard block |
||
| 1598 | 1598 | throw new ConnectionException(curl_error($this->handle), -1); |
| 1599 | 1599 | } |
| 1600 | 1600 | |
| 1601 | - $code = (int)curl_getinfo($this->handle)['http_code']; |
|
| 1601 | + $code = (int) curl_getinfo($this->handle)['http_code']; |
|
| 1602 | 1602 | |
| 1603 | 1603 | $codeIsInErrorRange = $code >= 400 && $code <= 600; |
| 1604 | 1604 | $codeIsNotInNonErrorCodes = !in_array($code, [200, 201, 202, 203, 204, 205, 206, 207, 301], true); |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | \spl_autoload_register( |
| 12 | - static function ($className) { |
|
| 12 | + static function($className) { |
|
| 13 | 13 | $namespacePrefix = __NAMESPACE__ . '\\'; |
| 14 | 14 | $basePath = __DIR__ . '/'; |
| 15 | 15 | if (0 !== strpos($className, $namespacePrefix)) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @throws ConnectionException |
| 46 | 46 | * @return no-return |
| 47 | 47 | */ |
| 48 | - public static function throwCurlResult(int $code, string|bool $curlResult): never |
|
| 48 | + public static function throwCurlResult(int $code, string | bool $curlResult): never |
|
| 49 | 49 | { |
| 50 | 50 | $exception = new self(self::reasonPhrase($code), $code); |
| 51 | 51 | $exception->responseCode = $code; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @noinspection JsonEncodingApiUsageInspection |
| 110 | 110 | * @noinspection RedundantSuppression |
| 111 | 111 | */ |
| 112 | - $result = json_decode((string)$this->responseBodyRaw, false); |
|
| 112 | + $result = json_decode((string) $this->responseBodyRaw, false); |
|
| 113 | 113 | return is_object($result) ? $result : null; |
| 114 | 114 | } |
| 115 | 115 | |