Conditions | 13 |
Paths | 11 |
Total Lines | 32 |
Code Lines | 23 |
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 |
||
56 | public function __construct(array $config, $reserved) |
||
57 | { |
||
58 | parent::__construct($config, $reserved); |
||
59 | |||
60 | if (isset($config['attribute']) && is_string($config['attribute'])) { |
||
61 | $this->attribute = $config['attribute']; |
||
62 | } else { |
||
63 | $reason = 'There is no attribute config in authorizeByDest authproc filter'; |
||
64 | throw new CriticalConfigurationError($reason); |
||
65 | } |
||
66 | if (isset($config['attribute_value']) && is_string($config['attribute_value'])) { |
||
67 | $this->attribute_value = $config['attribute_value']; |
||
68 | } else { |
||
69 | $reason = 'There is no attribute_value config in authorizeByDest authproc filter'; |
||
70 | throw new CriticalConfigurationError($reason); |
||
71 | } |
||
72 | if (isset($config['destination_whitelist']) && is_array($config['destination_whitelist'])) { |
||
73 | $this->destination_whitelist = $config['destination_whitelist']; |
||
74 | } else { |
||
75 | $reason = 'There is no destination_whitelist config in authorizeByDest authproc filter'; |
||
76 | throw new CriticalConfigurationError($reason); |
||
77 | } |
||
78 | |||
79 | if (isset($config['distinguish_attribute']) && is_string($config['distinguish_attribute'])) { |
||
80 | $this->distinguish_attribute = $config['distinguish_attribute']; |
||
81 | } |
||
82 | if (isset($config['distinguish_users']) && is_array($config['distinguish_users'])) { |
||
83 | $this->distinguish_users = $config['distinguish_users']; |
||
84 | } |
||
85 | if (isset($this->distinguish_users) and !isset($this->distinguish_attribute)) { |
||
86 | $reason = 'You have to define distinguish attribute in authorizeByDest authproc filter'; |
||
87 | throw new CriticalConfigurationError($reason); |
||
88 | } |
||
147 |