EmailAuthenticator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 43
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get_login_form() 0 4 1
A authenticate() 0 4 1
A get_default_authenticator() 0 4 1
1
<?php
2
/**
3
 * Authenticator for the default "member" method
4
 *
5
 * @author Markus Lanthaler <[email protected]>
6
 * @package sapphire
7
 * @subpackage security
8
 */
9
class EmailAuthenticator extends MemberAuthenticator
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
10
{
11
    private static $authenticators = array('EmailAuthenticator');
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $authenticators 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...
12
13
    private static $default_authenticator = 'EmailAuthenticator';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $default_authenticator 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...
14
15
    /**
16
     * Method that creates the login form for this authentication method
17
     *
18
     * @param Controller The parent controller, necessary to create the
0 ignored issues
show
Documentation introduced by
Should the type for parameter $controller not be Controller?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
19
     *                   appropriate form action tag
20
     * @return Form Returns the login form to use with this authentication
21
     *              method
22
     */
23
    public static function get_login_form(Controller $controller)
24
    {
25
        return Object::create("EmailLoginForm", $controller, "LoginForm");
26
    }
27
28
29
  /**
30
   * Method to authenticate an user
31
   *
32
   * @param array $RAW_data Raw data to authenticate the user
33
   * @param Form $form Optional: If passed, better error messages can be
0 ignored issues
show
Documentation introduced by
Should the type for parameter $form not be null|Form?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
34
   *                             produced by using
35
   *                             {@link Form::sessionMessage()}
36
   * @return bool|Member Returns FALSE if authentication fails, otherwise
0 ignored issues
show
Documentation introduced by
Should the return type not be false|DataObject?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
37
   *                     the member object
38
   */
39
    public static function authenticate($RAW_data, Form $form = null)
40
    {
41
        return parent::authenticate($RAW_data, $form);
42
    }
43
44
  /**
45
   * @return string
46
   */
47
  public static function get_default_authenticator()
48
  {
49
      return "EmailAuthenticator";
50
  }
51
}
52