Conditions | 1 |
Paths | 1 |
Total Lines | 70 |
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 |
||
234 | public function checkProvider() |
||
235 | { |
||
236 | return [ |
||
237 | ['php_extensions', ['foo', ['name' => 'bar', 'label' => 'baz']], PhpExtension::class, 'php_extension_foo', 2], |
||
238 | ['php_extensions', ['foo', ['name' => 'bar', 'label' => 'baz']], PhpExtension::class, 'php_extension_bar', 2], |
||
239 | ['php_extensions', [['name' => 'foo']], PhpExtension::class, 'php_extension_foo'], |
||
240 | ['php_flags', ['foo' => 'true', 'bar' => ['value' => 'false', 'label' => 'baz']], PhpFlag::class, 'php_flag_foo', 2], |
||
241 | ['php_flags', ['foo' => 'true', 'bar' => ['value' => 'false', 'label' => 'baz']], PhpFlag::class, 'php_flag_bar', 2], |
||
242 | ['php_flags', ['foo' => ['value' => 'false']], PhpFlag::class, 'php_flag_foo'], |
||
243 | ['php_version', ['5.3.3' => '=', '7.1.0' => ['operator' => '>=', 'label' => 'foo']], PhpVersion::class, 'php_version_5.3.3', 2], |
||
244 | ['php_version', ['5.3.3' => '=', '7.1.0' => ['operator' => '>=', 'label' => 'foo']], PhpVersion::class, 'php_version_7.1.0', 2], |
||
245 | ['php_version', ['7.1.0' => ['operator' => '>=']], PhpVersion::class, 'php_version_7.1.0'], |
||
246 | ['process_running', 'foo', ProcessRunning::class, 'process_foo_running'], |
||
247 | ['process_running', ['foo'], ProcessRunning::class, 'process_foo_running'], |
||
248 | ['process_running', ['foo', ['name' => 'bar']], ProcessRunning::class, 'process_foo_running', 2], |
||
249 | ['process_running', ['foo', ['name' => 'bar', 'label' => 'baz']], ProcessRunning::class, 'process_bar_running', 2], |
||
250 | ['readable_directory', ['foo', ['path' => 'bar']], ReadableDirectory::class, 'readable_directory_foo', 2], |
||
251 | ['readable_directory', ['foo', ['path' => 'bar', 'label' => 'baz']], ReadableDirectory::class, 'readable_directory_bar', 2], |
||
252 | ['writable_directory', ['foo', ['path' => 'bar']], WritableDirectory::class, 'writable_directory_foo', 2], |
||
253 | ['writable_directory', ['foo', ['path' => 'bar', 'label' => 'baz']], WritableDirectory::class, 'writable_directory_bar', 2], |
||
254 | ['class_exists', ['Foo', ['name' => 'Bar']], ClassExists::class, 'class_exists_Foo', 2], |
||
255 | ['class_exists', ['Foo', ['name' => 'Bar', 'label' => 'baz']], ClassExists::class, 'class_exists_Bar', 2], |
||
256 | ['cpu_performance', 0.5, CpuPerformance::class], |
||
257 | ['cpu_performance', ['performance' => 0.5, 'label' => 'foo'], CpuPerformance::class], |
||
258 | ['disk_usage', ['path' => __DIR__], DiskUsage::class], |
||
259 | ['disk_usage', ['path' => __DIR__, 'label' => 'foo'], DiskUsage::class], |
||
260 | ['symfony_requirements', ['file' => __DIR__.'/../../LiipMonitorBundle.php', 'label' => 'foo'], 'Liip\MonitorBundle\Check\SymfonyRequirements'], |
||
261 | ['opcache_memory', null, OpCacheMemory::class], |
||
262 | ['opcache_memory', ['label' => 'foo'], OpCacheMemory::class], |
||
263 | ['apc_memory', null, ApcMemory::class], |
||
264 | ['apc_memory', ['label' => 'foo'], ApcMemory::class], |
||
265 | ['apc_fragmentation', null, ApcFragmentation::class], |
||
266 | ['apc_fragmentation', ['label' => 'foo'], ApcFragmentation::class], |
||
267 | ['doctrine_dbal', 'foo', DoctrineDbal::class, 'doctrine_dbal_foo_connection'], |
||
268 | ['doctrine_dbal', ['foo'], DoctrineDbal::class, 'doctrine_dbal_foo_connection'], |
||
269 | ['doctrine_dbal', ['foo', 'bar'], DoctrineDbal::class, 'doctrine_dbal_foo_connection', 2], |
||
270 | ['doctrine_dbal', ['foo', 'bar'], DoctrineDbal::class, 'doctrine_dbal_bar_connection', 2], |
||
271 | ['doctrine_dbal', ['foo', ['name' => 'bar', 'label' => 'baz']], DoctrineDbal::class, 'doctrine_dbal_bar_connection', 2], |
||
272 | ['memcache', ['foo' => null], Memcache::class, 'memcache_foo'], |
||
273 | ['memcache', ['foo' => ['label' => 'bar']], Memcache::class, 'memcache_foo'], |
||
274 | ['memcached', ['foo' => null], Memcached::class, 'memcached_foo'], |
||
275 | ['memcached', ['foo' => ['label' => 'bar']], Memcached::class, 'memcached_foo'], |
||
276 | ['redis', ['foo' => null], Redis::class, 'redis_foo'], |
||
277 | ['redis', ['foo' => ['label' => 'bar']], Redis::class, 'redis_foo'], |
||
278 | ['http_service', ['foo' => null], HttpService::class, 'http_service_foo'], |
||
279 | ['http_service', ['foo' => ['label' => 'bar']], HttpService::class, 'http_service_foo'], |
||
280 | ['guzzle_http_service', ['foo' => null], GuzzleHttpService::class, 'guzzle_http_service_foo'], |
||
281 | ['guzzle_http_service', ['foo' => ['label' => 'bar']], GuzzleHttpService::class, 'guzzle_http_service_foo'], |
||
282 | ['rabbit_mq', ['foo' => null], RabbitMQ::class, 'rabbit_mq_foo'], |
||
283 | ['rabbit_mq', ['foo' => ['label' => 'bar']], RabbitMQ::class, 'rabbit_mq_foo'], |
||
284 | ['symfony_version', null, SymfonyVersion::class], |
||
285 | ['symfony_version', ['label' => 'foo'], SymfonyVersion::class], |
||
286 | ['custom_error_pages', ['error_codes' => [500]], CustomErrorPages::class], |
||
287 | ['custom_error_pages', ['error_codes' => [500], 'label' => 'foo'], CustomErrorPages::class], |
||
288 | ['security_advisory', ['lock_file' => __DIR__.'/../../composer.lock'], SecurityAdvisory::class], |
||
289 | ['security_advisory', ['lock_file' => __DIR__.'/../../composer.lock', 'label' => 'foo'], SecurityAdvisory::class], |
||
290 | ['stream_wrapper_exists', ['foo'], StreamWrapperExists::class, 'stream_wrapper_exists_foo'], |
||
291 | ['stream_wrapper_exists', ['foo', ['name' => 'bar', 'label' => 'baz']], StreamWrapperExists::class, 'stream_wrapper_exists_bar', 2], |
||
292 | ['file_ini', ['foo.ini'], IniFile::class, 'file_ini_foo.ini'], |
||
293 | ['file_ini', ['foo.ini', ['path' => 'bar.ini', 'label' => 'baz']], IniFile::class, 'file_ini_foo.ini', 2], |
||
294 | ['file_json', ['foo.json'], JsonFile::class, 'file_json_foo.json'], |
||
295 | ['file_json', ['foo.json', ['path' => 'bar.json', 'label' => 'baz']], JsonFile::class, 'file_json_foo.json', 2], |
||
296 | ['file_xml', ['foo.xml'], XmlFile::class, 'file_xml_foo.xml'], |
||
297 | ['file_xml', ['foo.xml', ['path' => 'bar.xml', 'label' => 'baz']], XmlFile::class, 'file_xml_foo.xml', 2], |
||
298 | ['file_yaml', ['foo.yaml'], YamlFile::class, 'file_yaml_foo.yaml'], |
||
299 | ['file_yaml', ['foo.yaml', ['path' => 'bar.yaml', 'label' => 'baz']], YamlFile::class, 'file_yaml_foo.yaml', 2], |
||
300 | ['expressions', ['foo' => ['label' => 'foo', 'critical_expression' => 'true']], Expression::class, 'expression_foo'], |
||
301 | ['pdo_connections', ['foo' => ['dsn' => 'my-dsn']], PDOCheck::class, 'pdo_foo'], |
||
302 | ]; |
||
303 | } |
||
304 | |||
310 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.