| Total Complexity | 6 |
| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class PublishableConfigurator |
||
| 13 | { |
||
| 14 | private $tokenStorage; |
||
| 15 | private $authorizationChecker; |
||
| 16 | private $em; |
||
| 17 | |||
| 18 | public function __construct(EntityManagerInterface $entityManager, TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $checker) |
||
| 19 | { |
||
| 20 | $this->em = $entityManager; |
||
| 21 | $this->tokenStorage = $tokenStorage; |
||
| 22 | $this->authorizationChecker = $checker; |
||
| 23 | } |
||
| 24 | |||
| 25 | public function onKernelRequest(): void |
||
| 26 | { |
||
| 27 | if ($this->isAuthorized()) { |
||
| 28 | return; |
||
| 29 | } |
||
| 30 | /** @var PublishableFilter $filter */ |
||
| 31 | $filter = $this->em->getFilters()->enable('publishable_filter'); |
||
| 32 | $filter->setExpressionBuilder(new Expr()); |
||
| 33 | } |
||
| 34 | |||
| 35 | private function isAuthorized(): bool |
||
| 46 | } |
||
| 47 | } |
||
| 48 |