These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace App\Controller\User; |
||
4 | |||
5 | use App\Controller\BaseController; |
||
6 | use App\Service\UserService; |
||
7 | use Slim\Container; |
||
8 | |||
9 | /** |
||
10 | * Base User Controller. |
||
11 | */ |
||
12 | abstract class BaseUser extends BaseController |
||
13 | { |
||
14 | /** |
||
15 | * @var UserService |
||
16 | */ |
||
17 | protected $userService; |
||
18 | |||
19 | /** |
||
20 | * @param Container $container |
||
21 | */ |
||
22 | public function __construct(Container $container) |
||
23 | { |
||
24 | $this->container = $container; |
||
0 ignored issues
–
show
|
|||
25 | $this->logger = $container->get('logger'); |
||
26 | $this->userService = $container->get('user_service'); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @return UserService |
||
31 | */ |
||
32 | protected function getUserService() |
||
33 | { |
||
34 | return $this->userService; |
||
35 | // return $this->container->get('user_service'); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
|
|||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @return array |
||
40 | */ |
||
41 | protected function getInput() |
||
42 | { |
||
43 | return $this->request->getParsedBody(); |
||
44 | } |
||
45 | } |
||
46 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: