FindOrFailUser::make()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 5
cts 5
cp 1
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Omatech\Mage\Core\Domains\Users\Features;
4
5
use Omatech\Mage\Core\Domains\Users\Contracts\FindUserInterface;
6
use Omatech\Mage\Core\Domains\Users\Exceptions\UserDoesNotExistsException;
7
use Omatech\Mage\Core\Domains\Users\User;
8
9
class FindOrFailUser
10
{
11
    /**
12
     * @param FindUserInterface $find
13
     * @param $params
14
     * @return User|null
15
     * @throws UserDoesNotExistsException
16
     */
17 3
    public function make(FindUserInterface $find, $params)
18
    {
19 3
        $user = $find->find($params);
20
21 3
        if (null === $user) {
22 1
            throw new UserDoesNotExistsException();
23
        }
24
25 2
        return $user;
26
    }
27
}
28