| Total Complexity | 4 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class PositionObserverClearCache |
||
| 10 | { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var Repository |
||
| 14 | */ |
||
| 15 | private $cache; |
||
| 16 | |||
| 17 | 4 | public function __construct(Repository $cache) |
|
| 20 | 4 | } |
|
| 21 | |||
| 22 | 2 | public function create(PositionModel $positionModel) |
|
| 23 | { |
||
| 24 | 2 | $this->cache->forget(PositionCache::class . '@count'); |
|
| 25 | 2 | $this->cache->forget(PositionCache::class . '@getByDataProviderId:' . $positionModel->dataProviderId()); |
|
| 26 | 2 | } |
|
| 27 | |||
| 28 | 1 | public function delete(PositionModel $position) |
|
| 29 | { |
||
| 30 | 1 | $this->cache->forget(PositionCache::class . '@count'); |
|
| 31 | 1 | $this->cache->forget(PositionCache::class . '@getById:' . $position->id()); |
|
| 32 | 1 | $this->cache->forget(PositionCache::class . '@getByDataProviderId:' . $position->dataProviderId()); |
|
| 33 | 1 | } |
|
| 34 | |||
| 35 | 1 | public function update(PositionModel $oldPosition, PositionModel $newPosition) |
|
| 41 | 1 | } |
|
| 42 | |||
| 43 | } |