Completed
Push — master ( a54fa8...fcdb22 )
by Antonio
04:50
created

ResetPasswordService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A run() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/yii2-usuario project.
5
 *
6
 * (c) 2amigOS! <http://2amigos.us/>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace Da\User\Service;
13
14
use Da\User\Contracts\ServiceInterface;
15
use Da\User\Helper\SecurityHelper;
16
use Da\User\Model\User;
17
18
class ResetPasswordService implements ServiceInterface
19
{
20
    protected $password;
21
    protected $model;
22
    protected $securityHelper;
23
24 1
    public function __construct($password, User $model, SecurityHelper $securityHelper)
25
    {
26 1
        $this->password = $password;
27 1
        $this->model = $model;
28 1
        $this->securityHelper = $securityHelper;
29 1
    }
30
31 1
    public function run()
32
    {
33 1
        $this->model->password = $this->password;
34 1
        return (bool)$this->model->save(false, ['password_hash']);
35
    }
36
}
37