Completed
Push — master ( d86698...3d0fab )
by
unknown
03:08
created

CountRegisteredUsersTask::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
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\Ship\Criterias\Eloquent\NotNullCriteria;
7
use App\Ship\Parents\Tasks\Task;
8
9
/**
10
 * Class CountRegisteredUsersTask.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class CountRegisteredUsersTask extends Task
15
{
16
17
    protected $repository;
18
19
    public function __construct(UserRepository $repository)
20
    {
21
        $this->repository = $repository;
22
    }
23
24
    /**
25
     * @return  int
26
     */
27
    public function run(): int
28
    {
29
        $this->repository->pushCriteria(new NotNullCriteria('email'));
30
        return $this->repository->all()->count();
31
    }
32
33
}
34