Skip to content

Commit

Permalink
Fix coding style
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Ondr谩膷ek <ondracek.roman@centrum.cz>
  • Loading branch information
Roman3349 authored and f3l1x committed Sep 15, 2020
1 parent cbf904a commit 77bd0fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/Schema/Response.php
Expand Up @@ -31,11 +31,10 @@ public static function fromArray(array $data): Response
if (isset($data['headers'])) {
foreach ($data['headers'] as $key => $headerData) {
if (isset($headerData['$ref'])) {
$header = new Reference($headerData['$ref']);
$response->setHeader($key, new Reference($headerData['$ref']));
} else {
$header = Header::fromArray($headerData);
$response->setHeader($key, Header::fromArray($headerData));
}
$response->setHeader($key, $header);
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/Schema/Responses.php
Expand Up @@ -24,11 +24,10 @@ public static function fromArray(array $data): Responses
$responses = new Responses();
foreach ($data as $key => $responseData) {
if (isset($responseData['$ref'])) {
$response = new Reference($responseData['$ref']);
$responses->setResponse((string) $key, new Reference($responseData['$ref']));
} else {
$response = Response::fromArray($responseData);
$responses->setResponse((string) $key, Response::fromArray($responseData));
}
$responses->setResponse((string) $key, $response);
}

return $responses;
Expand Down
4 changes: 2 additions & 2 deletions tests/cases/Schema/ResponseTest.php
Expand Up @@ -33,7 +33,6 @@ public function testOptional(): void
$response->setHeader('WWW-Authenticate', $header);
Assert::same($array, $response->toArray());
Assert::equal($response, Response::fromArray($array));

}

public function testRequired(): void
Expand All @@ -44,7 +43,8 @@ public function testRequired(): void
Assert::equal($response, Response::fromArray($array));
}

public function testHeaderReference(): void {
public function testHeaderReference(): void
{
$array = [
'description' => 'API key or user token is missing or invalid',
'headers' => [
Expand Down

0 comments on commit 77bd0fb

Please sign in to comment.