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

ResetPasswordService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 2
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