Test Failed
Pull Request — master (#476)
by
unknown
03:13
created

SignupService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A signup() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\User;
6
7
final class SignupService
8
{
9
    public function __construct(private UserRepository $userRepository)
10
    {
11
    }
12
13
    public function signup(string $login, string $password): User
14
    {
15
        $user = new User(
16
            UserLogin::createNew($login, $this->userRepository),
17
            UserPassword::createNew($password)
18
        );
19
        $this->userRepository->save($user);
20
        return $user;
21
    }
22
}
23