ExistsAndDeleteUser   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 30
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A make() 0 10 2
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 3
    public function __construct()
19
    {
20 3
        $this->exists = new ExistsUser();
21 3
        $this->delete = new DeleteUser();
22 3
    }
23
24
    /**
25
     * @param User $user
26
     * @return bool
27
     * @throws UserDoesNotExistsException
28
     */
29 3
    public function make(User $user): bool
30
    {
31 3
        $exists = $this->exists->make($user);
32
33 3
        if (false === $exists) {
34 1
            throw new UserDoesNotExistsException();
35
        }
36
37 3
        return $this->delete->make($user);
38
    }
39
}
40