Test Failed
Push — master ( d7824a...a03b1d )
by Christian
06:13 queued 18s
created

ExistsAndDeleteUser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 9 2
A __construct() 0 4 1
1
<?php
2
3
namespace Omatech\Mage\Core\Domains\Users\Features;
4
5
use Omatech\Mage\Core\Domains\Users\User;
6
use Omatech\Mage\Core\Domains\Users\Jobs\DeleteUser;
7
use Omatech\Mage\Core\Domains\Users\Jobs\ExistsUser;
8
use Omatech\Mage\Core\Domains\Users\Exceptions\UserDoesNotExistsException;
9
10
class ExistsAndDeleteUser
11
{
12
    private $exists;
13
    private $delete;
14
15
    /**
16
     * ExistsAndDeleteUser constructor.
17
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
18
     */
19 3
    public function __construct()
20
    {
21 3
        $this->exists = app()->make(ExistsUser::class);
22 3
        $this->delete = app()->make(DeleteUser::class);
23 3
    }
24
25
    /**
26
     * @param User $user
27
     * @return bool
28
     * @throws UserDoesNotExistsException
29
     */
30 3
    public function make(User $user): bool
31
    {
32 3
        $exists = $this->exists->make($user);
33
34 3
        if ($exists === false) {
35 1
            throw new UserDoesNotExistsException;
36
        }
37
38 3
        return $this->delete->make($user);
39
    }
40
}
41