| Conditions | 16 | 
| Paths | 256 | 
| Total Lines | 58 | 
| Code Lines | 32 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 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  | 
            ||
| 82 | public function __construct(array $config, $reserved)  | 
            ||
| 83 |     { | 
            ||
| 84 | parent::__construct($config, $reserved);  | 
            ||
| 85 | |||
| 86 | // Check for the deny option  | 
            ||
| 87 | // Must be bool specifically, if not, it might be for an attrib filter below  | 
            ||
| 88 |         if (isset($config['deny']) && is_bool($config['deny'])) { | 
            ||
| 89 | $this->deny = $config['deny'];  | 
            ||
| 90 | unset($config['deny']);  | 
            ||
| 91 | }  | 
            ||
| 92 | |||
| 93 | // Check for the regex option  | 
            ||
| 94 | // Must be bool specifically, if not, it might be for an attrib filter below  | 
            ||
| 95 |         if (isset($config['regex']) && is_bool($config['regex'])) { | 
            ||
| 96 | $this->regex = $config['regex'];  | 
            ||
| 97 | unset($config['regex']);  | 
            ||
| 98 | }  | 
            ||
| 99 | |||
| 100 | // Check for the reject_msg option; Must be array of languages  | 
            ||
| 101 |         if (isset($config['reject_msg']) && is_array($config['reject_msg'])) { | 
            ||
| 102 | $this->reject_msg = $config['reject_msg'];  | 
            ||
| 103 | unset($config['reject_msg']);  | 
            ||
| 104 | }  | 
            ||
| 105 | |||
| 106 | // Check for the errorURL option  | 
            ||
| 107 | // Must be bool specifically, if not, it might be for an attrib filter below  | 
            ||
| 108 |         if (isset($config['errorURL']) && is_bool($config['errorURL'])) { | 
            ||
| 109 | $this->errorURL = $config['errorURL'];  | 
            ||
| 110 | unset($config['errorURL']);  | 
            ||
| 111 | }  | 
            ||
| 112 | |||
| 113 |         if (isset($config['allow_reauthentication']) && is_bool($config['allow_reauthentication'])) { | 
            ||
| 114 | $this->allow_reauthentication = $config['allow_reauthentication'];  | 
            ||
| 115 | unset($config['allow_reauthentication']);  | 
            ||
| 116 | }  | 
            ||
| 117 | |||
| 118 |         foreach ($config as $attribute => $values) { | 
            ||
| 119 |             if (is_string($values)) { | 
            ||
| 120 | $arrayUtils = new Utils\Arrays();  | 
            ||
| 121 | $values = $arrayUtils->arrayize($values);  | 
            ||
| 122 |             } elseif (!is_array($values)) { | 
            ||
| 123 | throw new Exception(sprintf(  | 
            ||
| 124 | 'Filter Authorize: Attribute values is neither string nor array: %s',  | 
            ||
| 125 | var_export($attribute, true),  | 
            ||
| 126 | ));  | 
            ||
| 127 | }  | 
            ||
| 128 | |||
| 129 |             foreach ($values as $value) { | 
            ||
| 130 |                 if (!is_string($value)) { | 
            ||
| 131 | throw new Exception(sprintf(  | 
            ||
| 132 | 'Filter Authorize: Each value should be a string for attribute: %s value: %s config: %s',  | 
            ||
| 133 | var_export($attribute, true),  | 
            ||
| 134 | var_export($value, true),  | 
            ||
| 135 | var_export($config, true),  | 
            ||
| 136 | ));  | 
            ||
| 137 | }  | 
            ||
| 138 | }  | 
            ||
| 139 | $this->valid_attribute_values[$attribute] = $values;  | 
            ||
| 140 | }  | 
            ||
| 221 |