| Conditions | 5 |
| Paths | 2 |
| Total Lines | 60 |
| Code Lines | 37 |
| 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 |
||
| 111 | public function execute(InputInterface $input, OutputInterface $output): int |
||
| 112 | { |
||
| 113 | $target_php_settings = TargetPhpSettings::fromConsoleInput($input); |
||
| 114 | $loop_settings = TraceLoopSettings::fromConsoleInput($input); |
||
| 115 | $get_trace_settings = GetTraceSettings::fromConsoleInput($input); |
||
| 116 | $daemon_settings = DaemonSettings::fromConsoleInput($input); |
||
| 117 | |||
| 118 | $context = $this->php_searcher_context_creator->create(); |
||
| 119 | /** @var int $searcher_pid */ |
||
| 120 | $searcher_pid = Promise\wait($context->start()); |
||
| 121 | Promise\wait($context->send($daemon_settings->target_regex)); |
||
| 122 | /** @var int[] $pid_list */ |
||
| 123 | $pid_list = Promise\wait($context->receive()); |
||
| 124 | $readers = []; |
||
| 125 | foreach ($pid_list as $target_pid) { |
||
| 126 | $context = $this->php_reader_context_creator->create(); |
||
| 127 | Promise\wait($context->start()); |
||
| 128 | Promise\wait($context->send([$target_pid, $target_php_settings, $loop_settings, $get_trace_settings])); |
||
| 129 | $readers[$target_pid] = $context; |
||
| 130 | } |
||
| 131 | exec('stty -icanon -echo'); |
||
| 132 | |||
| 133 | Loop::run(function () use (&$readers, $output) { |
||
| 134 | Loop::onReadable( |
||
| 135 | STDIN, |
||
| 136 | /** @param resource $stream */ |
||
| 137 | function (string $watcher_id, $stream) { |
||
| 138 | $key = fread($stream, 1); |
||
| 139 | if ($key === 'q') { |
||
| 140 | Loop::cancel($watcher_id); |
||
| 141 | Loop::stop(); |
||
| 142 | } |
||
| 143 | } |
||
| 144 | ); |
||
| 145 | Loop::repeat(10, function () use (&$readers, $output) { |
||
| 146 | /** @var array<int, Context\Context> $readers */ |
||
| 147 | |||
| 148 | $promises = []; |
||
| 149 | foreach ($readers as $pid => $reader) { |
||
| 150 | if (!$reader->isRunning()) { |
||
| 151 | /** @psalm-suppress MixedArrayAccess*/ |
||
| 152 | unset($readers[$pid]); |
||
| 153 | continue; |
||
| 154 | } |
||
| 155 | $promises[] = \Amp\call( |
||
| 156 | function () use ($reader, &$readers, $pid, $output) { |
||
| 157 | /** @psalm-suppress MixedArrayAccess*/ |
||
| 158 | unset($readers[$pid]); |
||
| 159 | /** @var string $result */ |
||
| 160 | $result = yield $reader->receive(); |
||
| 161 | $output->write($result); |
||
| 162 | $readers[$pid] = $reader; |
||
| 163 | } |
||
| 164 | ); |
||
| 165 | } |
||
| 166 | yield $promises; |
||
| 167 | }); |
||
| 168 | }); |
||
| 169 | |||
| 170 | return 0; |
||
| 171 | } |
||
| 173 |
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