| Total Complexity | 5 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class UserProvider |
||
| 15 | { |
||
| 16 | private Security $security; |
||
| 17 | private UserToPlayerTransformer $userToPlayerTransformer; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param Security $security |
||
| 21 | * @param UserToPlayerTransformer $userToPlayerTransformer |
||
| 22 | */ |
||
| 23 | public function __construct(Security $security, UserToPlayerTransformer $userToPlayerTransformer) |
||
| 24 | { |
||
| 25 | $this->security = $security; |
||
| 26 | $this->userToPlayerTransformer = $userToPlayerTransformer; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @return UserInterface|null |
||
| 31 | */ |
||
| 32 | public function getUser(): ?UserInterface |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return ?Player |
||
| 39 | * @throws ORMException |
||
| 40 | */ |
||
| 41 | public function getPlayer(): ?Player |
||
| 42 | { |
||
| 43 | if (!$this->security->getUser()) { |
||
| 44 | return null; |
||
| 45 | } |
||
| 46 | return $this->userToPlayerTransformer->transform($this->security->getUser()); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @return Team|null |
||
| 51 | * @throws ORMException |
||
| 52 | */ |
||
| 53 | public function getTeam(): ?Team |
||
| 57 | } |
||
| 58 | } |
||
| 59 |