CountAllUsersTask   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A run() 0 4 1
1
<?php
2
3
namespace App\Containers\User\Tasks;
4
5
use App\Containers\User\Data\Repositories\UserRepository;
6
use App\Ship\Parents\Actions\Action;
7
8
/**
9
 * Class CountAllUsersTask.
10
 *
11
 * @author Mahmoud Zalt <[email protected]>
12
 */
13
class CountAllUsersTask extends Action
14
{
15
16
    /**
17
     * CountUsersAction constructor.
18
     *
19
     * @param \App\Containers\User\Data\Repositories\UserRepository $userRepository
20
     */
21
    public function __construct(UserRepository $userRepository)
22
    {
23
        $this->userRepository = $userRepository;
0 ignored issues
show
Bug introduced by
The property userRepository does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
24
    }
25
26
    /**
27
     * @return  mixed
28
     */
29
    public function run()
30
    {
31
        return $this->userRepository->all()->count();
32
    }
33
34
}
35