| Conditions | 12 | 
| Paths | 17 | 
| Total Lines | 69 | 
| Code Lines | 47 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
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  | 
            ||
| 107 | public function findGlobals(  | 
            ||
| 108 | ProcessSpecifier $process_specifier,  | 
            ||
| 109 | TargetPhpSettings $target_php_settings,  | 
            ||
| 110 | string $symbol_name,  | 
            ||
| 111 |     ): int { | 
            ||
| 112 | $tsrm_ls_cache = $this->findTsrmLsCache($process_specifier, $target_php_settings);  | 
            ||
| 113 |         if (isset($tsrm_ls_cache)) { | 
            ||
| 114 |             switch ($target_php_settings->php_version) { | 
            ||
| 115 | case ZendTypeReader::V70:  | 
            ||
| 116 | case ZendTypeReader::V71:  | 
            ||
| 117 | case ZendTypeReader::V72:  | 
            ||
| 118 | case ZendTypeReader::V73:  | 
            ||
| 119 | $id_symbol = $symbol_name . '_id';  | 
            ||
| 120 | $globals_id_cdata = $this->getSymbolReader($process_specifier, $target_php_settings)  | 
            ||
| 121 | ->read($id_symbol);  | 
            ||
| 122 |                     if (is_null($globals_id_cdata)) { | 
            ||
| 123 |                         throw new RuntimeException('global symbol id not found'); | 
            ||
| 124 | }  | 
            ||
| 125 | $tsrm_ls_cache_dereferenced = $this->integer_reader->read64(  | 
            ||
| 126 | new CDataByteReader(  | 
            ||
| 127 | $this->memory_reader->read(  | 
            ||
| 128 | $process_specifier->pid,  | 
            ||
| 129 | $tsrm_ls_cache,  | 
            ||
| 130 | 8  | 
            ||
| 131 | )  | 
            ||
| 132 | ),  | 
            ||
| 133 | 0  | 
            ||
| 134 | )->toInt();  | 
            ||
| 135 | $globals_id = $this->integer_reader->read32(  | 
            ||
| 136 | new CDataByteReader($globals_id_cdata),  | 
            ||
| 137 | 0  | 
            ||
| 138 | );  | 
            ||
| 139 | return $this->integer_reader->read64(  | 
            ||
| 140 | new CDataByteReader(  | 
            ||
| 141 | $this->memory_reader->read(  | 
            ||
| 142 | $process_specifier->pid,  | 
            ||
| 143 | $tsrm_ls_cache_dereferenced + ($globals_id - 1) * 8,  | 
            ||
| 144 | 8  | 
            ||
| 145 | )  | 
            ||
| 146 | ),  | 
            ||
| 147 | 0  | 
            ||
| 148 | )->toInt();  | 
            ||
| 149 | |||
| 150 | case ZendTypeReader::V74:  | 
            ||
| 151 | case ZendTypeReader::V80:  | 
            ||
| 152 | case ZendTypeReader::V81:  | 
            ||
| 153 | $offset = $symbol_name . '_offset';  | 
            ||
| 154 | $globals_offset_cdata = $this->getSymbolReader(  | 
            ||
| 155 | $process_specifier,  | 
            ||
| 156 | $target_php_settings  | 
            ||
| 157 | )->read($offset);  | 
            ||
| 158 |                     if (is_null($globals_offset_cdata)) { | 
            ||
| 159 |                         throw new RuntimeException('globals offset not found'); | 
            ||
| 160 | }  | 
            ||
| 161 | $globals_offset = $this->integer_reader->read64(  | 
            ||
| 162 | new CDataByteReader($globals_offset_cdata),  | 
            ||
| 163 | 0  | 
            ||
| 164 | )->toInt();  | 
            ||
| 165 | return $tsrm_ls_cache + $globals_offset;  | 
            ||
| 166 | default:  | 
            ||
| 167 |                     throw new \LogicException('this should never happen'); | 
            ||
| 168 | }  | 
            ||
| 169 | }  | 
            ||
| 170 | $globals_address = $this->getSymbolReader($process_specifier, $target_php_settings)  | 
            ||
| 171 | ->resolveAddress($symbol_name);  | 
            ||
| 172 |         if (is_null($globals_address)) { | 
            ||
| 173 |             throw new RuntimeException('global symbol not found ' . $symbol_name); | 
            ||
| 174 | }  | 
            ||
| 175 | return $globals_address;  | 
            ||
| 176 | }  | 
            ||
| 189 |