| Total Complexity | 4 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | final class DataPersister implements DataPersisterInterface |
||
| 30 | { |
||
| 31 | use ClassInfoTrait; |
||
| 32 | |||
| 33 | private $resourceMetadataFactory; |
||
| 34 | private $messageBus; |
||
| 35 | |||
| 36 | public function __construct(ResourceMetadataFactoryInterface $resourceMetadataFactory, MessageBusInterface $messageBus) |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * {@inheritdoc} |
||
| 44 | */ |
||
| 45 | public function supports($data): bool |
||
| 46 | { |
||
| 47 | return true === $this->resourceMetadataFactory->create($this->getObjectClass($data))->getAttribute('messenger'); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | public function persist($data) |
||
| 54 | { |
||
| 55 | $this->messageBus->dispatch($data); |
||
| 56 | |||
| 57 | return $data; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * {@inheritdoc} |
||
| 62 | */ |
||
| 63 | public function remove($data) |
||
| 66 | } |
||
| 67 | } |
||
| 68 |