| Conditions | 12 |
| Paths | 10 |
| Total Lines | 20 |
| Code Lines | 16 |
| 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 |
||
| 61 | public function boot(AbstractContainer $container): void |
||
| 62 | { |
||
| 63 | if ($container instanceof Container) { |
||
| 64 | foreach ($this->config as $name => $value) { |
||
| 65 | if (null === $value) { |
||
| 66 | continue; |
||
| 67 | } |
||
| 68 | |||
| 69 | if ('include_path' === $name) { |
||
| 70 | \set_include_path(\str_replace(';', \PATH_SEPARATOR, $value)); |
||
| 71 | } elseif ('ignore_user_abort' === $name) { |
||
| 72 | \ignore_user_abort(null === $value ? $value : (bool) $value); |
||
| 73 | } elseif ('max_execution_time' === $name) { |
||
| 74 | \set_time_limit((int) $value); |
||
| 75 | } elseif ('date.timezone' === $name) { |
||
| 76 | \date_default_timezone_set($value); |
||
| 77 | } elseif (\function_exists('ini_set')) { |
||
| 78 | \ini_set($name, false === $value ? '0' : (string) $value); |
||
| 79 | } elseif (\ini_get($name) !== (string) $value) { |
||
| 80 | throw new \InvalidArgumentException('Required function ini_set() is disabled.'); |
||
| 81 | } |
||
| 86 |