Completed
Push — master ( 5ee4c9...308b6a )
by Antonio
05:05
created

ResetPasswordService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

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
    public function __construct($password, User $model, SecurityHelper $securityHelper)
25
    {
26
        $this->password = $password;
27
        $this->model = $model;
28
        $this->securityHelper = $securityHelper;
29
    }
30
31
    public function run()
32
    {
33
        $this->model->password = $this->password;
34
        return (bool)$this->model->save(false, ['password_hash']);
35
    }
36
}
37