AuthInvalidator::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Files\Events\Listeners;
6
7
use AbterPhp\Files\Domain\Entities\FileCategory;
8
use AbterPhp\Framework\Authorization\CacheManager;
9
use AbterPhp\Framework\Events\EntityChange;
10
11
class AuthInvalidator
12
{
13
    /** @var CacheManager */
14
    protected $cacheManager;
15
16
    /**
17
     * AuthInvalidator constructor.
18
     *
19
     * @param CacheManager $cacheManager
20
     */
21
    public function __construct(CacheManager $cacheManager)
22
    {
23
        $this->cacheManager = $cacheManager;
24
    }
25
26
    /**
27
     * @param EntityChange $event
28
     */
29
    public function handle(EntityChange $event)
30
    {
31
        switch ($event->getEntityName()) {
32
            case FileCategory::class:
33
                $this->cacheManager->clearAll();
34
                break;
35
        }
36
    }
37
}
38