for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace app\basic\forms;
use app\basic\models\UserModels;
use yii\base\Application;
use yii\base\Model;
/**
* ResetPasswordForm is the model behind the reset password form Web Application Basic.
**/
class ResetPasswordForm extends Model
{
public $password;
private $_user;
protected $app;
* __construct
*
* @param Application $app, string $token
public function __construct(Application $app, string $token)
$app
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function __construct(/** @scrutinizer ignore-unused */ Application $app, string $token)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$this->_user = UserModels::findByPasswordResetToken($token);
}
* rules
* @return array the validation rules.
public function rules()
return [
['password', 'required'],
['password', 'string', 'min' => 6],
];
* atributeLabels
* Translate Atribute Labels.
* @return array customized attribute labels.
public function attributeLabels()
'password' => $this->app->t('basic', 'Password'),
* resetPassword
* Resets password.
* @return bool if password was reset.
public function resetPassword()
$this->_user->setPassword($this->password);
$this->_user->removePasswordResetToken();
return $this->_user->save(false);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.