Completed
Push — master ( df4800...ec8b14 )
by Manuel
03:30
created

Registrar   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 32
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validator() 0 7 1
A create() 0 7 1
1
<?php
2
3
namespace PiFinder\Services;
4
5
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
6
use PiFinder\User;
7
use Validator;
8
9
class Registrar implements RegistrarContract
10
{
11
    /**
12
     * Get a validator for an incoming registration request.
13
     *
14
     * @param array $data
15
     *
16
     * @return \Illuminate\Contracts\Validation\Validator
17
     */
18
    public function validator(array $data)
19
    {
20
        return Validator::make($data, [
21
            'email'    => 'required|email|max:255|unique:users',
22
            'password' => 'required|confirmed|min:6',
23
        ]);
24
    }
25
26
    /**
27
     * Create a new user instance after a valid registration.
28
     *
29
     * @param array $data
30
     *
31
     * @return User
32
     */
33
    public function create(array $data)
34
    {
35
        return User::create([
36
            'email'    => $data['email'],
37
            'password' => bcrypt($data['password']),
38
        ]);
39
    }
40
}
41