Completed
Push — master ( ee26f0...f8a5b0 )
by Mahmoud
04:21
created

CountAllUsersTask::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace App\Containers\User\Tasks;
4
5
use App\Containers\User\Data\Repositories\UserRepository;
6
use App\Port\Action\Abstracts\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