| Conditions | 12 |
| Paths | 42 |
| Total Lines | 42 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| 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 |
||
| 39 | protected function processEnvironment($values) |
||
| 40 | { |
||
| 41 | if (!is_array($values)) { |
||
| 42 | return null; |
||
| 43 | } |
||
| 44 | |||
| 45 | foreach ($values as $envkey => $envvalue) { |
||
| 46 | // HTTP_ .... |
||
| 47 | |||
| 48 | if (!$this->override) { |
||
| 49 | |||
| 50 | if (function_exists('getenv')) { |
||
| 51 | if (!getenv($envkey, false)) { |
||
| 52 | putenv("$envkey=$envvalue"); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | if (!isset($_ENV[$envkey])) { |
||
| 57 | $_ENV[$envkey] = $envvalue; |
||
| 58 | } |
||
| 59 | |||
| 60 | if (function_exists('apache_getenv')) { |
||
| 61 | if (!apache_getenv($envkey, false)) { |
||
| 62 | /** @scrutinizer ignore-unhandled */ @apache_setenv($envkey, $envvalue, false); |
||
| 63 | } |
||
| 64 | } |
||
| 65 | |||
| 66 | if (!isset($_SERVER[$envkey])) { |
||
| 67 | $_SERVER[$envkey] = $envvalue; |
||
| 68 | } |
||
| 69 | |||
| 70 | } else { |
||
| 71 | |||
| 72 | if (function_exists('putenv')) { |
||
| 73 | putenv("$envkey=$envvalue"); |
||
| 74 | } |
||
| 75 | |||
| 76 | $_ENV[$envkey] = $envvalue; |
||
| 77 | |||
| 78 | $_SERVER[$envkey] = $envvalue; |
||
| 79 | if (function_exists('apache_setenv')) { |
||
| 80 | /** @scrutinizer ignore-unhandled */ @apache_setenv($envkey, $envvalue, false); |
||
| 81 | } |
||
| 138 | } |