Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
19 / 19 |
|
100.00% |
8 / 8 |
CRAP | |
100.00% |
1 / 1 |
| LocalFeedStorage | |
100.00% |
19 / 19 |
|
100.00% |
8 / 8 |
8 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
1 | |||
| store | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| latest | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| get | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| exists | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| delete | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| lastModified | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| driver | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace ImovelZapAi\Publishing\Connectors\GroupOlx\Infrastructure\Storage; |
| 6 | |
| 7 | use ImovelZapAi\Publishing\Connectors\GroupOlx\Application\Ports\FeedStorageInterface; |
| 8 | use ImovelZapAi\Publishing\Connectors\GroupOlx\Domain\Enums\FeedStorageDriver; |
| 9 | |
| 10 | /** |
| 11 | * Driver Local do FeedStorage. |
| 12 | */ |
| 13 | final class LocalFeedStorage implements FeedStorageInterface |
| 14 | { |
| 15 | private FeedStorage $inner; |
| 16 | |
| 17 | public function __construct(?FeedStorage $inner = null) |
| 18 | { |
| 19 | $this->inner = $inner ?? new FeedStorage( |
| 20 | driver: FeedStorageDriver::Local, |
| 21 | disk: (string) config( |
| 22 | 'publishing.group_olx.storage.local_disk', |
| 23 | config('publishing.group_olx.feed_cache.disk', 'local'), |
| 24 | ), |
| 25 | pathPrefixTemplate: (string) config( |
| 26 | 'publishing.group_olx.storage.path_prefix', |
| 27 | 'publishing/{tenant_id}/group-olx', |
| 28 | ), |
| 29 | keepVersions: (int) config('publishing.group_olx.storage.keep_versions', 10), |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | public function store(string $tenantId, string $xml): \ImovelZapAi\Publishing\Connectors\GroupOlx\Application\Data\FeedStorageVersionData |
| 34 | { |
| 35 | return $this->inner->store($tenantId, $xml); |
| 36 | } |
| 37 | |
| 38 | public function latest(string $tenantId, bool $withXml = true): ?\ImovelZapAi\Publishing\Connectors\GroupOlx\Application\Data\FeedStorageVersionData |
| 39 | { |
| 40 | return $this->inner->latest($tenantId, $withXml); |
| 41 | } |
| 42 | |
| 43 | public function get(string $tenantId): ?string |
| 44 | { |
| 45 | return $this->inner->get($tenantId); |
| 46 | } |
| 47 | |
| 48 | public function exists(string $tenantId): bool |
| 49 | { |
| 50 | return $this->inner->exists($tenantId); |
| 51 | } |
| 52 | |
| 53 | public function delete(string $tenantId): void |
| 54 | { |
| 55 | $this->inner->delete($tenantId); |
| 56 | } |
| 57 | |
| 58 | public function lastModified(string $tenantId): ?int |
| 59 | { |
| 60 | return $this->inner->lastModified($tenantId); |
| 61 | } |
| 62 | |
| 63 | public function driver(): FeedStorageDriver |
| 64 | { |
| 65 | return FeedStorageDriver::Local; |
| 66 | } |
| 67 | } |