Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 10 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
53 | View Code Duplication | protected function getLoggedUser() |
|
|
|||
54 | { |
||
55 | $user = $this->auth->user(); |
||
56 | |||
57 | if (!$user instanceof User) { |
||
58 | throw new \DomainException('Unable to find a valid instance of logged user.'); |
||
59 | } |
||
60 | |||
61 | return $user; |
||
62 | } |
||
63 | } |
||
64 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.