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

FindOrFailUser::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
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\FindUser;
7
use Omatech\Mage\Core\Domains\Users\User;
8
9
class FindOrFailUser
10
{
11
    private $find;
12
13
    /**
14
     * FindOrFailUser constructor.
15
     *
16
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
17
     */
18 1
    public function __construct()
19
    {
20 1
        $this->find = app()->make(FindUser::class);
21 1
    }
22
23
    /**
24
     * @param int $id
25
     *
26
     * @throws UserDoesNotExistsException
27
     *
28
     * @return User
29
     */
30 1
    public function make(int $id): User
31
    {
32 1
        $user = $this->find->make($id);
33
34 1
        if (null === $user) {
35 1
            throw new UserDoesNotExistsException();
36
        }
37
38
        return $user;
39
    }
40
}
41