Passed
Push — master ( 342071...ce1cac )
by Christian
04:33
created

ExistsAndDeleteUser::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
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 3
    public function __construct()
21
    {
22 3
        $this->exists = app()->make(ExistsUser::class);
23 3
        $this->delete = app()->make(DeleteUser::class);
24 3
    }
25
26
    /**
27
     * @param User $user
28
     *
29
     * @throws UserDoesNotExistsException
30
     *
31
     * @return bool
32
     */
33 3
    public function make(User $user): bool
34
    {
35 3
        $exists = $this->exists->make($user);
36
37 3
        if (false === $exists) {
38 1
            throw new UserDoesNotExistsException();
39
        }
40
41 3
        return $this->delete->make($user);
42
    }
43
}
44