Conditions | 11 |
Paths | 20 |
Total Lines | 52 |
Code Lines | 36 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 2 |
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 | $pid = $input->getOption('pid'); |
||
78 | if (is_null($pid)) { |
||
79 | $error_output = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; |
||
80 | $error_output->writeln('pid is not specified'); |
||
81 | return 1; |
||
82 | } |
||
83 | $pid = filter_var($pid, FILTER_VALIDATE_INT); |
||
84 | if ($pid === false) { |
||
85 | $error_output = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; |
||
86 | $error_output->writeln('pid is not integer'); |
||
87 | return 2; |
||
88 | } |
||
89 | |||
90 | $depth = $input->getOption('depth'); |
||
91 | if (is_null($depth)) { |
||
92 | $depth = PHP_INT_MAX; |
||
93 | } |
||
94 | $depth = filter_var($depth, FILTER_VALIDATE_INT); |
||
95 | if ($depth === false) { |
||
96 | $error_output = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; |
||
97 | $error_output->writeln('depth is not integer'); |
||
98 | return 2; |
||
99 | } |
||
100 | |||
101 | $sleep_nano_seconds = $input->getOption('sleep-ns'); |
||
102 | if (is_null($sleep_nano_seconds)) { |
||
103 | $sleep_nano_seconds = self::SLEEP_NANO_SECONDS_DEFAULT; |
||
104 | } |
||
105 | $sleep_nano_seconds = filter_var($sleep_nano_seconds, FILTER_VALIDATE_INT); |
||
106 | if ($sleep_nano_seconds === false) { |
||
107 | $error_output = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; |
||
108 | $error_output->writeln('sleep-ns is not integer'); |
||
109 | return 2; |
||
110 | } |
||
111 | |||
112 | $eg_address = $this->php_globals_finder->findExecutorGlobals($pid); |
||
113 | |||
114 | $this->runPeriodically( |
||
115 | $sleep_nano_seconds, |
||
116 | function () use ($pid, $eg_address, $depth, $output) { |
||
117 | $call_trace = $this->executor_globals_reader->readCallTrace( |
||
118 | $pid, |
||
119 | $eg_address, |
||
120 | $depth |
||
121 | ); |
||
122 | $output->writeln(join(PHP_EOL, $call_trace) . PHP_EOL); |
||
123 | } |
||
124 | ); |
||
125 | |||
126 | return 0; |
||
127 | } |
||
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