Showing 29 of 103 total issues
Function handle
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
if (!$this->checkInstalledPackages()) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method handle
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
if (!$this->checkInstalledPackages()) {
return;
}
File CloneCommand.php
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App\Commands;
use App\Traits\SharedTrait;
Method updateRemoteProfile
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateRemoteProfile($profile, $name)
{
$data = array_get($this->profiles, $profile.'.remote.'.$name, []);
$public_key = array_get($data, 'public_key', $this->getUserHome('.ssh/id_rsa.pub'));
ConfigureCommand
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ConfigureCommand extends Command
{
use CommandInternalsTrait, FileSystemTrait, SharedTrait;
/**
Function updateRemoteProfileKey
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function updateRemoteProfileKey($profile, $name, $key)
{
$default_value = '';
switch ($key) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method cloneLocalDatabases
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function cloneLocalDatabases($profile, $connection, $source_database, $destination_database)
{
// Check we want to proceed.
if (intval($this->option('no-interaction')) < 1
&& !$this->confirm('Did you want to proceed?')) {
Method execRemoteConnection
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function execRemoteConnection($profile, $name, $command)
{
if (!array_get($this->profiles, $profile.'.remote.'.$name.'.working', false)) {
$this->error('Remote profile has not been tested. Use configure command to fix.');
Method updateRemoteProfileKey
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateRemoteProfileKey($profile, $name, $key)
{
$default_value = '';
switch ($key) {
Function testRemoteProfile
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function testRemoteProfile($profile, $name)
{
$connection_works = false;
$data = array_get($this->profiles, $profile.'.remote.'.$name, []);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method cloneRemoteDatabases
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function cloneRemoteDatabases($profile, $remote, $remote_profile, $remote_connection, $local_connection, $source_database, $destination_database)
{
// Check we want to proceed.
if (intval($this->option('no-interaction')) < 1
&& !$this->confirm('Did you want to proceed?')) {
Function sshConnect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function sshConnect($host, $port, $method, $settings)
{
try {
$session = ssh2_connect($host, $port);
} catch (\Exception $e) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method cloneRemoteDatabases
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
private function cloneRemoteDatabases($profile, $remote, $remote_profile, $remote_connection, $local_connection, $source_database, $destination_database)
Avoid too many return
statements within this method. Open
return $this->updateRemoteProfileKey($profile, $name, $option);
Avoid too many return
statements within this method. Open
return 1;
Avoid too many return
statements within this method. Open
return 1;
Avoid too many return
statements within this method. Open
return $this->cloneRemoteDatabases(
$profile,
$remote,
$remote_profile,
$remote_connection,
Avoid too many return
statements within this method. Open
return 1;
Avoid too many return
statements within this method. Open
return 1;
Avoid too many return
statements within this method. Open
return $this->updateRemoteProfileName($profile, $name, $option);