| Conditions | 11 |
| Paths | 16 |
| Total Lines | 46 |
| Code Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 74 | public function execute(InputInterface $input, OutputInterface $output): int |
||
| 75 | { |
||
| 76 | $pid = $input->getOption('pid'); |
||
| 77 | if (is_null($pid)) { |
||
| 78 | $error_output = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; |
||
| 79 | $error_output->writeln('pid is not specified'); |
||
| 80 | return 1; |
||
| 81 | } |
||
| 82 | $pid = filter_var($pid, FILTER_VALIDATE_INT); |
||
| 83 | if ($pid === false) { |
||
| 84 | $error_output = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; |
||
| 85 | $error_output->writeln('pid is not integer'); |
||
| 86 | return 2; |
||
| 87 | } |
||
| 88 | |||
| 89 | $sleep_nano_seconds = $input->getOption('sleep-ns'); |
||
| 90 | if (is_null($sleep_nano_seconds)) { |
||
| 91 | $sleep_nano_seconds = self::SLEEP_NANO_SECONDS_DEFAULT; |
||
| 92 | } |
||
| 93 | $sleep_nano_seconds = filter_var($sleep_nano_seconds, FILTER_VALIDATE_INT); |
||
| 94 | if ($sleep_nano_seconds === false) { |
||
| 95 | $error_output = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; |
||
| 96 | $error_output->writeln('sleep-ns is not integer'); |
||
| 97 | return 2; |
||
| 98 | } |
||
| 99 | |||
| 100 | $eg_address = $this->php_globals_finder->findExecutorGlobals($pid); |
||
| 101 | |||
| 102 | exec('stty -icanon -echo'); |
||
| 103 | $keyboard_input = fopen('php://stdin', 'r'); |
||
| 104 | stream_set_blocking($keyboard_input, false); |
||
| 105 | |||
| 106 | $key = ''; |
||
| 107 | $count_retry = 0; |
||
| 108 | while ($key !== 'q' and $count_retry < 10) { |
||
| 109 | try { |
||
| 110 | echo $this->executor_globals_reader->readCurrentFunctionName($pid, $eg_address) , PHP_EOL; |
||
| 111 | $count_retry = 0; |
||
| 112 | time_nanosleep(0, $sleep_nano_seconds); |
||
| 113 | } catch (MemoryReaderException $e) { |
||
| 114 | $count_retry++; |
||
| 115 | } |
||
| 116 | $key = fread($keyboard_input, 1); |
||
| 117 | } |
||
| 118 | |||
| 119 | return 0; |
||
| 120 | } |
||
| 122 |
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