Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ListDataFormatter implements FormatterInterface
- {
- /**
- * Checks object for needed requirements.
- *
- * @var FormatterSpecificationInterface $specification
- */
- private $specification;
- /**
- * ListDataFormatter constructor.
- *
- * @param FormatterSpecificationInterface $specification
- */
- public function __construct(FormatterSpecificationInterface $specification)
- {
- $this->specification = $specification;
- }
- /**
- * {@inheritdoc}
- */
- public function format(ResponseDtoInterface $data)
- {
- if ($this->specification->isSatisfiedBy($data)) {
- $data = $data->getData();
- }
- return $data;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement