Test Failed
Push — master ( da5def...342071 )
by Christian
04:54
created

ExistsAndDeleteUser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 32
ccs 0
cts 12
cp 0
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\Exceptions\UserDoesNotExistsException;
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\User;
9
10
class ExistsAndDeleteUser
11
{
12
    private $exists;
13
    private $delete;
14
15
    /**
16
     * ExistsAndDeleteUser constructor.
17
     *
18
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
19
     */
20
    public function __construct()
21
    {
22
        $this->exists = app()->make(ExistsUser::class);
23
        $this->delete = app()->make(DeleteUser::class);
24
    }
25
26
    /**
27
     * @param User $user
28
     *
29
     * @throws UserDoesNotExistsException
30
     *
31
     * @return bool
32
     */
33
    public function make(User $user): bool
34
    {
35
        $exists = $this->exists->make($user);
36
37
        if (false === $exists) {
38
            throw new UserDoesNotExistsException();
39
        }
40
41
        return $this->delete->make($user);
42
    }
43
}
44