| Conditions | 1 |
| Paths | 1 |
| Total Lines | 66 |
| Code Lines | 44 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
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:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 43 | public function validLdapUserAttributesProvider() |
||
| 44 | { |
||
| 45 | return [ |
||
| 46 | // Description => [ldap entry, [UserInterfaceMethod => return value]] |
||
| 47 | 'hydrate single attributes' => [ |
||
| 48 | 'ldap entry' => [ |
||
| 49 | 'dn' => 'ou=group, dc=host, dc=foo', |
||
| 50 | 'count' => 1, |
||
| 51 | 'uid' => [ |
||
| 52 | 'count' => 1, |
||
| 53 | 0 => 'test_username', |
||
| 54 | ], |
||
| 55 | ], |
||
| 56 | 'expected methods return' => [ |
||
| 57 | 'getUserName' => 'test_username', |
||
| 58 | ], |
||
| 59 | ], |
||
| 60 | 'hydrate attributes collections' => [ |
||
| 61 | 'ldap entry' => [ |
||
| 62 | 'dn' => 'ou=group, dc=host, dc=foo', |
||
| 63 | 'roles' => [ |
||
| 64 | 'count' => 2, |
||
| 65 | 0 => 'ROLE1', |
||
| 66 | 1 => 'ROLE2', |
||
| 67 | ], |
||
| 68 | ], |
||
| 69 | 'expected methods return' => [ |
||
| 70 | 'getRoles' => [ |
||
| 71 | 0 => 'ROLE1', |
||
| 72 | 1 => 'ROLE2', |
||
| 73 | ], |
||
| 74 | ], |
||
| 75 | ], |
||
| 76 | 'hydrate single attributes without count index' => [ |
||
| 77 | 'ldap entry' => [ |
||
| 78 | 'dn' => 'ou=group, dc=host, dc=foo', |
||
| 79 | 'uid' => [ |
||
| 80 | 0 => 'test_username', |
||
| 81 | ], |
||
| 82 | ], |
||
| 83 | 'expected methods return' => [ |
||
| 84 | 'getUserName' => 'test_username', |
||
| 85 | ], |
||
| 86 | ], |
||
| 87 | 'hydrate attributes collections without count index' => [ |
||
| 88 | 'ldap entry' => [ |
||
| 89 | 'dn' => 'ou=group, dc=host, dc=foo', |
||
| 90 | 'roles' => [ |
||
| 91 | 0 => 'ROLE1', |
||
| 92 | 1 => 'ROLE2', |
||
| 93 | ], |
||
| 94 | ], |
||
| 95 | 'expected methods return' => [ |
||
| 96 | 'getRoles' => [ |
||
| 97 | 0 => 'ROLE1', |
||
| 98 | 1 => 'ROLE2', |
||
| 99 | ], |
||
| 100 | ], |
||
| 101 | ], |
||
| 102 | 'empty ldap entry return an empty user' => [ |
||
| 103 | 'ldap entry' => [ |
||
| 104 | 'dn' => 'ou=group, dc=host, dc=foo', |
||
| 105 | 'count' => 1, |
||
| 106 | ], |
||
| 107 | 'expected methods return' => [ |
||
| 108 | 'getUserName' => null, |
||
| 109 | ], |
||
| 114 |