Passed
Pull Request — master (#5)
by Robbie
02:50 queued 32s
created

LDAPChangePasswordHandler::doChangePassword()   D

Complexity

Conditions 13
Paths 54

Size

Total Lines 117
Code Lines 69

Duplication

Lines 24
Ratio 20.51 %

Importance

Changes 0
Metric Value
cc 13
eloc 69
nc 54
nop 2
dl 24
loc 117
rs 4.9922
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace SilverStripe\LDAP\Authenticators;
4
5
use SilverStripe\LDAP\Forms\LDAPChangePasswordForm;
6
use SilverStripe\Security\MemberAuthenticator\ChangePasswordHandler;
7
8
class LDAPChangePasswordHandler extends ChangePasswordHandler
9
{
10
    private static $allowed_actions = [
0 ignored issues
show
Unused Code introduced by
The property $allowed_actions is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
11
        'changepassword',
12
        'changePasswordForm',
13
    ];
14
15
    /**
16
     * Factory method for the lost password form
17
     *
18
     * @return LDAPChangePasswordForm
19
     */
20
    public function changePasswordForm()
21
    {
22
        return LDAPChangePasswordForm::create($this, 'ChangePasswordForm');
0 ignored issues
show
Bug introduced by
'ChangePasswordForm' of type string is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        return LDAPChangePasswordForm::create($this, /** @scrutinizer ignore-type */ 'ChangePasswordForm');
Loading history...
Bug introduced by
$this of type SilverStripe\LDAP\Authen...APChangePasswordHandler is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
        return LDAPChangePasswordForm::create(/** @scrutinizer ignore-type */ $this, 'ChangePasswordForm');
Loading history...
23
    }
24
}
25