Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ErrorResponsePart implements ResponsePartInterface
- {
- /**
- * Specification.
- *
- * @var SpecificationInterface $specification
- */
- private $specification;
- /**
- * Response part data.
- *
- * @var ResponseDtoInterface $partData
- */
- private $partData;
- /**
- * Formatter context.
- *
- * @var FormatterContext $formatterContext
- */
- private $formatterContext;
- /**
- * ErrorResponsePart constructor.
- *
- * @param SpecificationInterface $specification
- * @param FormatterContext $formatterContext
- */
- public function __construct(SpecificationInterface $specification, FormatterContext $formatterContext)
- {
- $this->specification = $specification;
- $this->formatterContext = $formatterContext;
- }
- /**
- * {@inheritdoc}
- */
- public function addData(ResponseDtoInterface $data) : void
- {
- if ($this->specification->isSatisfiedBy($data)) {
- $this->partData = $this->formatterContext->process($data);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement