| Conditions | 10 |
| Paths | 50 |
| Total Lines | 34 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 7 | ||
| Bugs | 3 | 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 |
||
| 52 | protected function __construct() |
||
| 53 | { |
||
| 54 | parent::__construct(); |
||
| 55 | |||
| 56 | $this->services = new Kernel\Containers\Services(); |
||
| 57 | |||
| 58 | if (isset($_ENV[ 'DEBUG_STAGE' ]) and $_ENV[ 'DEBUG_STAGE' ] === 'DEVELOPER') { |
||
| 59 | if(class_exists('\O2System\Gear\Profiler')) { |
||
| 60 | $this->services->load(Gear\Profiler::class); |
||
| 61 | } |
||
| 62 | |||
| 63 | if (profiler() !== false) { |
||
| 64 | profiler()->watch('Starting Kernel Services'); |
||
| 65 | } |
||
| 66 | } |
||
| 67 | |||
| 68 | $services = [ |
||
| 69 | 'Services\Language' => 'language' |
||
| 70 | ]; |
||
| 71 | |||
| 72 | foreach ($services as $className => $classOffset) { |
||
| 73 | $this->services->load($className, $classOffset); |
||
| 74 | } |
||
| 75 | |||
| 76 | if (class_exists('O2System\Framework', false) or class_exists( |
||
| 77 | 'O2System\Reactor', false)) { |
||
| 78 | if (profiler() !== false) { |
||
| 79 | profiler()->watch('Starting Kernel I/O Service'); |
||
| 80 | } |
||
| 81 | |||
| 82 | if (is_cli()) { |
||
| 83 | $this->cliIO(); |
||
| 84 | } else { |
||
| 85 | $this->httpIO(); |
||
| 86 | } |
||
| 164 | } |