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