| Conditions | 12 | 
| Paths | 64 | 
| Total Lines | 42 | 
| Code Lines | 20 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| 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  | 
            ||
| 55 | public function __construct(array $config, $reserved)  | 
            ||
| 56 |     { | 
            ||
| 57 | parent::__construct($config, $reserved);  | 
            ||
| 58 | |||
| 59 | // Check for the deny option  | 
            ||
| 60 | // Must be bool specifically, if not, it might be for an attrib filter below  | 
            ||
| 61 |         if (isset($config['deny']) && is_bool($config['deny'])) { | 
            ||
| 62 | $this->deny = $config['deny'];  | 
            ||
| 63 | }  | 
            ||
| 64 | |||
| 65 | // Check for the regex option  | 
            ||
| 66 | // Must be bool specifically, if not, it might be for an attrib filter below  | 
            ||
| 67 |         if (isset($config['regex']) && is_bool($config['regex'])) { | 
            ||
| 68 | $this->regex = $config['regex'];  | 
            ||
| 69 | }  | 
            ||
| 70 | |||
| 71 | // Check for the reject_msg option; Must be array of languages  | 
            ||
| 72 |         if (isset($config['reject_msg']) && is_array($config['reject_msg'])) { | 
            ||
| 73 | $this->reject_msg = $config['reject_msg'];  | 
            ||
| 74 | }  | 
            ||
| 75 | |||
| 76 | // Remove all above options  | 
            ||
| 77 | unset($config['deny'], $config['regex'], $config['reject_msg']);  | 
            ||
| 78 | |||
| 79 |         foreach ($config as $attribute => $values) { | 
            ||
| 80 |             if (is_string($values)) { | 
            ||
| 81 | $values = Utils\Arrays::arrayize($values);  | 
            ||
| 82 |             } else if (!is_array($values)) { | 
            ||
| 83 | throw new \Exception(  | 
            ||
| 84 | 'Filter Authorize: Attribute values is neither string nor array: '.var_export($attribute, true)  | 
            ||
| 85 | );  | 
            ||
| 86 | }  | 
            ||
| 87 | |||
| 88 |             foreach ($values as $value) { | 
            ||
| 89 |                 if (!is_string($value)) { | 
            ||
| 90 | throw new \Exception(  | 
            ||
| 91 | 'Filter Authorize: Each value should be a string for attribute: '.var_export($attribute, true).  | 
            ||
| 92 | ' value: '.var_export($value, true).' Config is: '.var_export($config, true)  | 
            ||
| 93 | );  | 
            ||
| 94 | }  | 
            ||
| 95 | }  | 
            ||
| 96 | $this->valid_attribute_values[$attribute] = $values;  | 
            ||
| 97 | }  | 
            ||
| 163 |