| Conditions | 6 |
| Paths | 1 |
| Total Lines | 65 |
| Code Lines | 43 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 75 | public function execute(InputInterface $input, OutputInterface $output): int |
||
| 76 | { |
||
| 77 | $get_trace_settings = $this->get_trace_settings_from_console_input->createSettings($input); |
||
| 78 | $daemon_settings = $this->daemon_settings_from_console_input->createSettings($input); |
||
| 79 | $target_php_settings = $this->target_php_settings_from_console_input->createSettings($input); |
||
| 80 | $loop_settings = $this->trace_loop_settings_from_console_input->createSettings($input); |
||
| 81 | |||
| 82 | $searcher_context = $this->php_searcher_context_creator->create(); |
||
| 83 | Promise\wait($searcher_context->start()); |
||
| 84 | Promise\wait($searcher_context->sendTargetRegex($daemon_settings->target_regex)); |
||
| 85 | |||
| 86 | $worker_pool = WorkerPool::create( |
||
| 87 | $this->php_reader_context_creator, |
||
| 88 | $daemon_settings->threads, |
||
| 89 | $target_php_settings, |
||
| 90 | $loop_settings, |
||
| 91 | $get_trace_settings |
||
| 92 | ); |
||
| 93 | |||
| 94 | $dispatch_table = new DispatchTable( |
||
| 95 | $worker_pool, |
||
| 96 | $target_php_settings, |
||
| 97 | $loop_settings, |
||
| 98 | $get_trace_settings |
||
| 99 | ); |
||
| 100 | |||
| 101 | exec('stty -icanon -echo'); |
||
| 102 | |||
| 103 | Loop::onReadable( |
||
| 104 | STDIN, |
||
| 105 | /** @param resource $stream */ |
||
| 106 | function (string $watcher_id, $stream) { |
||
| 107 | $key = fread($stream, 1); |
||
| 108 | if ($key === 'q') { |
||
| 109 | Loop::cancel($watcher_id); |
||
| 110 | Loop::stop(); |
||
| 111 | } |
||
| 112 | } |
||
| 113 | ); |
||
| 114 | Loop::run(function () use ($dispatch_table, $searcher_context, $worker_pool, $output) { |
||
| 115 | $promises = []; |
||
| 116 | $promises[] = call(function () use ($searcher_context, $dispatch_table) { |
||
| 117 | while (1) { |
||
| 118 | $update_target_message = yield $searcher_context->receivePidList(); |
||
| 119 | $dispatch_table->updateTargets($update_target_message->target_process_list); |
||
| 120 | } |
||
| 121 | }); |
||
| 122 | foreach ($worker_pool->getWorkers() as $reader) { |
||
| 123 | $promises[] = call( |
||
| 124 | function () use ($reader, $dispatch_table, $output) { |
||
| 125 | while (1) { |
||
| 126 | $result = yield $reader->receiveTraceOrDetachWorker(); |
||
| 127 | if ($result instanceof TraceMessage) { |
||
| 128 | $this->outputTrace($output, $result); |
||
| 129 | } else { |
||
| 130 | $dispatch_table->releaseOne($result->pid); |
||
| 131 | } |
||
| 132 | } |
||
| 133 | } |
||
| 134 | ); |
||
| 135 | } |
||
| 136 | yield $promises; |
||
| 137 | }); |
||
| 138 | |||
| 139 | return 0; |
||
| 140 | } |
||
| 149 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths