Conditions | 22 |
Paths | 134 |
Total Lines | 61 |
Code Lines | 38 |
Lines | 39 |
Ratio | 63.93 % |
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 |
||
137 | View Code Duplication | if (ini_get('max_input_vars') || ini_get('suhosin.post.max_vars')) { |
|
138 | $maxPost = $this->getMinInConfiguration(ini_get('max_input_vars'), ini_get('suhosin.post.max_vars')); |
||
139 | if ($maxPost !== null) { |
||
140 | $this->count = 0; |
||
141 | array_walk_recursive($_POST, array($this, 'countRecursive')); |
||
142 | if ($this->count === $maxPost) { |
||
143 | if ($this->log !== null) { |
||
144 | $this->log->error('Max input vars reaches for post parameters ({maxPost}). Check your variable max_input_vars in php.ini or suhosin module suhosin.post.max_vars.', ['maxPost' => $maxPost]); |
||
145 | } |
||
146 | throw new SplashException('Max input vars reaches for post parameters ('.$maxPost.'). Check your variable max_input_vars in php.ini or suhosin module suhosin.post.max_vars.'); |
||
147 | } |
||
148 | } |
||
149 | } |
||
150 | View Code Duplication | if (ini_get('max_input_vars') || ini_get('suhosin.request.max_vars')) { |
|
151 | $maxRequest = $this->getMinInConfiguration(ini_get('max_input_vars'), ini_get('suhosin.request.max_vars')); |
||
152 | if ($maxRequest !== null) { |
||
153 | $this->count = 0; |
||
154 | array_walk_recursive($_REQUEST, array($this, 'countRecursive')); |
||
155 | if ($this->count === $maxRequest) { |
||
156 | if ($this->log !== null) { |
||
157 | $this->log->error('Max input vars reaches for request parameters ({maxRequest}). Check your variable max_input_vars in php.ini or suhosin module suhosin.request.max_vars.', ['maxRequest' => $maxRequest]); |
||
158 | } |
||
159 | throw new SplashException('Max input vars reaches for request parameters ('.$maxRequest.'). Check your variable max_input_vars in php.ini or suhosin module suhosin.request.max_vars.'); |
||
160 | } |
||
161 | } |
||
162 | } |
||
163 | if (isset($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'post' && empty($_POST) && empty($_FILES)) { |
||
164 | $maxPostSize = self::iniGetBytes('post_max_size'); |
||
165 | if ($_SERVER['CONTENT_LENGTH'] > $maxPostSize) { |
||
166 | if ($this->log !== null) { |
||
167 | $this->log->error('Max post size exceeded! Got {length} bytes, but limit is {maxPostSize} bytes. Edit post_max_size setting in your php.ini.', ['length' => $_SERVER['CONTENT_LENGTH'], 'maxPostSize' => $maxPostSize]); |
||
168 | } |
||
169 | throw new SplashException( |
||
170 | sprintf('Max post size exceeded! Got %s bytes, but limit is %s bytes. Edit post_max_size setting in your php.ini.', |
||
171 | $_SERVER['CONTENT_LENGTH'], |
||
172 | $maxPostSize |
||
173 | ) |
||
174 | ); |
||
175 | } |
||
176 | } |
||
177 | |||
178 | //If no Exception has been thrown, call next router |
||
179 | return $delegate->process($request); |
||
180 | } |
||
181 | } |
||
182 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.