Last active
June 27, 2019 18:05
-
-
Save piotrbrzezina/4151f8ef8105b2066adc4fbf71f91198 to your computer and use it in GitHub Desktop.
Flashcard step 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SwaggerDecorator implements NormalizerInterface | |
{ | |
private $decorated; | |
public function __construct(NormalizerInterface $decorated) | |
{ | |
$this->decorated = $decorated; | |
} | |
public function normalize($object, $format = null, array $context = []) | |
{ | |
$docs = $this->decorated->normalize($object, $format, $context); | |
$docs['paths']['/login'] = [ | |
'post' => [ | |
'tags' => ['login'], | |
'summary' => 'Login to app', | |
'parameters' => [ | |
... | |
], | |
'responses' => [ | |
... | |
] | |
] | |
]; | |
return $docs; | |
} | |
public function supportsNormalization($data, $format = null) | |
{ | |
return $this->decorated->supportsNormalization($data, $format); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment