| Conditions | 2 |
| Paths | 1 |
| Total Lines | 58 |
| Code Lines | 40 |
| 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 |
||
| 17 | public function initialize() |
||
| 18 | { |
||
| 19 | parent::initialize(); |
||
| 20 | |||
| 21 | //Components. |
||
| 22 | $this->loadComponent('Flash'); |
||
| 23 | $this->loadComponent('Cookie'); |
||
| 24 | $this->loadComponent('Acl.Acl'); |
||
| 25 | $this->loadComponent('Maintenance'); |
||
| 26 | $this->loadComponent('CookieLogin'); |
||
| 27 | $this->loadComponent('SessionsActivity'); |
||
| 28 | $this->loadComponent('Auth', [ |
||
| 29 | 'className' => 'AclAuth', |
||
| 30 | 'allowedActionsForBanned' => [ |
||
| 31 | 'Pages' => [ |
||
| 32 | 'home' |
||
| 33 | ] |
||
| 34 | ], |
||
| 35 | 'authenticate' => [ |
||
| 36 | 'Form', |
||
| 37 | 'Xety/Cake3CookieAuth.Cookie' |
||
| 38 | ], |
||
| 39 | 'flash' => [ |
||
| 40 | 'element' => 'error', |
||
| 41 | 'key' => 'flash', |
||
| 42 | 'params' => [ |
||
| 43 | 'class' => 'error' |
||
| 44 | ] |
||
| 45 | ], |
||
| 46 | 'authorize' => [ |
||
| 47 | 'Acl.Actions' => [ |
||
| 48 | 'actionPath' => 'app/' |
||
| 49 | ] |
||
| 50 | ], |
||
| 51 | 'loginAction' => [ |
||
| 52 | 'controller' => 'users', |
||
| 53 | 'action' => 'login', |
||
| 54 | 'prefix' => false |
||
| 55 | ], |
||
| 56 | 'unauthorizedRedirect' => [ |
||
| 57 | 'controller' => 'pages', |
||
| 58 | 'action' => 'home', |
||
| 59 | 'prefix' => false |
||
| 60 | ], |
||
| 61 | 'loginRedirect' => [ |
||
| 62 | 'controller' => 'pages', |
||
| 63 | 'action' => 'home' |
||
| 64 | ], |
||
| 65 | 'logoutRedirect' => [ |
||
| 66 | 'controller' => 'pages', |
||
| 67 | 'action' => 'home' |
||
| 68 | ] |
||
| 69 | ]); |
||
| 70 | |||
| 71 | $this->loadComponent('Csrf', [ |
||
| 72 | 'secure' => env('HTTPS') ? true : false |
||
| 73 | ]); |
||
| 74 | } |
||
| 75 | |||
| 146 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.