| Conditions | 4 |
| Paths | 1 |
| Total Lines | 58 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| 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 |
||
| 79 | */ |
||
| 80 | public function execute(InputInterface $input, OutputInterface $output): int |
||
| 81 | { |
||
| 82 | $get_trace_settings = $this->get_trace_settings_from_console_input->createSettings($input); |
||
| 83 | $target_php_settings = $this->target_php_settings_from_console_input->createSettings($input); |
||
| 84 | $target_process_settings = $this->target_process_settings_from_console_input->createSettings($input); |
||
| 85 | $loop_settings = $this->trace_loop_settings_from_console_input->createSettings($input); |
||
| 86 | $trace_output = $this->trace_output_factory->fromSettingsAndConsoleOutput( |
||
| 87 | $output, |
||
| 88 | $this->output_settings_from_console_input->createSettings($input), |
||
| 89 | ); |
||
| 90 | |||
| 91 | $process_specifier = $this->target_process_resolver->resolve($target_process_settings); |
||
| 92 | |||
| 93 | $target_php_settings = $this->php_version_detector->decidePhpVersion( |
||
| 94 | $process_specifier, |
||
| 95 | $target_php_settings |
||
| 96 | ); |
||
| 97 | |||
| 98 | // On targeting ZTS, it's possible that libpthread.so of the target process isn't yet loaded |
||
| 99 | // at this point. In that case the TLS block can't be located, then the address of EG can't |
||
| 100 | // be found also. So simply retrying the whole process of finding EG here. |
||
| 101 | $eg_address = $this->retrying_loop_provider->do( |
||
| 102 | try: fn () => $this->php_globals_finder->findExecutorGlobals( |
||
| 103 | $process_specifier, |
||
| 104 | $target_php_settings |
||
| 105 | ), |
||
| 106 | retry_on: [\Throwable::class], |
||
| 107 | max_retry: 10, |
||
| 108 | interval_on_retry_ns: 1000 * 1000 * 10, |
||
| 109 | ); |
||
| 110 | |||
| 111 | $sg_address = $this->php_globals_finder->findSAPIGlobals( |
||
| 112 | $process_specifier, |
||
| 113 | $target_php_settings |
||
| 114 | ); |
||
| 115 | |||
| 116 | $trace_cache = new TraceCache(); |
||
| 117 | $this->loop_provider->getMainLoop( |
||
| 118 | function () use ( |
||
| 119 | $get_trace_settings, |
||
| 120 | $process_specifier, |
||
| 121 | $target_php_settings, |
||
| 122 | $loop_settings, |
||
| 123 | $eg_address, |
||
| 124 | $sg_address, |
||
| 125 | $trace_output, |
||
| 126 | $trace_cache, |
||
| 127 | ): bool { |
||
|
|
|||
| 128 | assert($target_php_settings->isDecided()); |
||
| 129 | if ($loop_settings->stop_process and $this->process_stopper->stop($process_specifier->pid)) { |
||
| 130 | defer($_, fn () => $this->process_stopper->resume($process_specifier->pid)); |
||
| 131 | } |
||
| 132 | $call_trace = $this->executor_globals_reader->readCallTrace( |
||
| 133 | $process_specifier->pid, |
||
| 134 | $target_php_settings->php_version, |
||
| 135 | $eg_address, |
||
| 136 | $sg_address, |
||
| 137 | $get_trace_settings->depth, |
||
| 151 |