| Total Complexity | 8 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class AuthService |
||
| 13 | { |
||
| 14 | public function __construct( |
||
| 15 | private CurrentUser $currentUser, |
||
| 16 | private UserRepository $userRepository, |
||
| 17 | private IdentityRepository $identityRepository, |
||
| 18 | ) { |
||
| 19 | } |
||
| 20 | |||
| 21 | public function login(string $login, string $password): bool |
||
| 22 | { |
||
| 23 | $user = $this->userRepository->findByLoginWithAuthIdentity($login); |
||
| 24 | |||
| 25 | if ($user === null || !$user->validatePassword($password)) { |
||
| 26 | return false; |
||
| 27 | } |
||
| 28 | |||
| 29 | return $this->currentUser->login($user->getIdentity()); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @throws Throwable |
||
| 34 | */ |
||
| 35 | public function logout(): bool |
||
| 36 | { |
||
| 37 | $identity = $this->currentUser->getIdentity(); |
||
| 38 | |||
| 39 | if ($identity instanceof Identity) { |
||
| 40 | $identity->regenerateCookieLoginKey(); |
||
| 41 | $this->identityRepository->save($identity); |
||
| 42 | } |
||
| 43 | |||
| 44 | return $this->currentUser->logout(); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function getIdentity(): IdentityInterface |
||
| 50 | } |
||
| 51 | |||
| 52 | public function isGuest(): bool |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths