@@ -17,7 +17,7 @@ |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | if (is_object($target[$key])) { |
20 | - $getter = "get" . Inflect::camelize(ucfirst((string)$subkey)); |
|
20 | + $getter = "get" . Inflect::camelize(ucfirst((string) $subkey)); |
|
21 | 21 | if (method_exists($target[$key], $getter)) { |
22 | 22 | $target[$key][$subkey] = $target[$key]->$getter(); |
23 | 23 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | $ret = []; |
17 | 17 | |
18 | - $elements = parent::toArray(); |
|
18 | + $elements = parent::toArray(); |
|
19 | 19 | foreach ($elements as $identity) { |
20 | 20 | $ret[] = $identity->toArray(); |
21 | 21 | } |
@@ -21,8 +21,7 @@ |
||
21 | 21 | public static function fromRequestsResponse(Requests_Response $response, bool $is_cached = false): self |
22 | 22 | { |
23 | 23 | $data = ($response->body !== '' && str_contains((string) $response->headers->getValues("Content-Type")[0], "application/json")) ? |
24 | - json_decode($response->body, true, 512, JSON_THROW_ON_ERROR) : |
|
25 | - []; |
|
24 | + json_decode($response->body, true, 512, JSON_THROW_ON_ERROR) : []; |
|
26 | 25 | |
27 | 26 | $ret = new self( |
28 | 27 | $response->status_code, |
@@ -21,8 +21,8 @@ |
||
21 | 21 | public const REDMINE_IMPERSONATE_HEADER = "X-Redmine-Switch-User"; |
22 | 22 | |
23 | 23 | protected static array $mandatory_options = [ |
24 | - self::CLIENT_OPTION_BASE_URL, |
|
25 | - self::CLIENT_OPTION_API_KEY |
|
24 | + self::CLIENT_OPTION_BASE_URL, |
|
25 | + self::CLIENT_OPTION_API_KEY |
|
26 | 26 | ]; |
27 | 27 | |
28 | 28 | protected static array $default_headers = [ |
@@ -53,7 +53,7 @@ |
||
53 | 53 | |
54 | 54 | private function getRepositoryForEndpoint(string $endpoint): ?AbstractRepository |
55 | 55 | { |
56 | - return match ($endpoint) { |
|
56 | + return match($endpoint) { |
|
57 | 57 | Issues::API_ROOT => new Issues($this), |
58 | 58 | Users::API_ROOT => new Users($this), |
59 | 59 | Projects::API_ROOT => new Projects($this), |
@@ -153,8 +153,7 @@ |
||
153 | 153 | $ret = $matches[0]; |
154 | 154 | foreach ($ret as &$match) { |
155 | 155 | $match = $match === strtoupper($match) ? |
156 | - strtolower($match) : |
|
157 | - lcfirst($match); |
|
156 | + strtolower($match) : lcfirst($match); |
|
158 | 157 | } |
159 | 158 | return implode('_', $ret); |
160 | 159 | } |
@@ -51,12 +51,12 @@ |
||
51 | 51 | |
52 | 52 | public static function fromApiResponse(ApiResponse $api_response, ?Throwable $previous = null): AbstractApiException | Error |
53 | 53 | { |
54 | - return match ($api_response->getStatus()) { |
|
55 | - 401 => new UnauthorizedApiException(previous: $previous), |
|
56 | - 403 => new InaccessibleResourceException(previous: $previous), |
|
57 | - 404 => new EntityNotFoundException(previous: $previous), |
|
58 | - 422 => new MalformedPayloadException(previous: $previous, errors: $api_response->getData()), |
|
59 | - default => new Error(message: "Undefined error", code: 1000, previous: $previous), |
|
54 | + return match($api_response->getStatus()) { |
|
55 | + 401 => new UnauthorizedApiException(previous : $previous), |
|
56 | + 403 => new InaccessibleResourceException(previous : $previous), |
|
57 | + 404 => new EntityNotFoundException(previous : $previous), |
|
58 | + 422 => new MalformedPayloadException(previous : $previous, errors : $api_response->getData()), |
|
59 | + default => new Error(message : "Undefined error", code : 1000, previous : $previous), |
|
60 | 60 | }; |
61 | 61 | } |
62 | 62 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | case RepositoryInterface::SEARCH_PARAM_TYPE_STRING: |
197 | 197 | case RepositoryInterface::SEARCH_PARAM_TYPE_BOOL: |
198 | 198 | default: |
199 | - $params[$parameter_name] = $raw_value; |
|
199 | + $params[$parameter_name] = $raw_value; |
|
200 | 200 | break; |
201 | 201 | case RepositoryInterface::SEARCH_PARAM_TYPE_INT_ARRAY: |
202 | 202 | case RepositoryInterface::SEARCH_PARAM_TYPE_STRING_ARRAY: |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $ordering = []; |
222 | 222 | foreach (static::$sort_params as $field => $direction) { |
223 | 223 | if ($direction === RepositoryInterface::SORT_DIRECTION_DESC) { |
224 | - $ordering[] = $field . ":" . $direction; |
|
224 | + $ordering[] = $field . ":" . $direction; |
|
225 | 225 | } else { |
226 | 226 | $ordering[] = $field; |
227 | 227 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public function getChildren(Issue $issue): IdentityCollection | ArrayCollection |
114 | 114 | { |
115 | 115 | return $this->client->getRepository(self::API_ROOT) |
116 | - ?->addFilter(self::ISSUE_FILTER_PARENT_ID, $issue->getId()) |
|
116 | + ? ->addFilter(self::ISSUE_FILTER_PARENT_ID, $issue->getId()) |
|
117 | 117 | ->addFilter(self::ISSUE_FILTER_STATUS_ID, "*") |
118 | 118 | ->search(); |
119 | 119 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function addAttachment(Issue $issue, Attachment $attachment): Issue |
128 | 128 | { |
129 | - $attachment = $this->client->getRepository(Uploads::API_ROOT)?->create($attachment); |
|
129 | + $attachment = $this->client->getRepository(Uploads::API_ROOT) ? ->create($attachment); |
|
130 | 130 | if ($attachment) { |
131 | 131 | $attachment->setVersion($issue->getFixedVersion()); |
132 | 132 | $issue->addAttachment($attachment); |