| Conditions | 3 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 45 | 59 | public function getLoggedUser() |
|
| 46 | { |
||
| 47 | 59 | if (null === $this->loggedUser) { |
|
| 48 | 59 | $this->loggedUser = auth()->user(); |
|
| 49 | } |
||
| 50 | |||
| 51 | 59 | if (!$this->loggedUser instanceof User) { |
|
| 52 | 1 | throw new \DomainException('Unable to find a valid instance of logged user.'); |
|
| 53 | } |
||
| 54 | |||
| 55 | 58 | return $this->loggedUser; |
|
| 56 | } |
||
| 57 | } |
||
| 58 |