src/Deployer.php
Method __construct
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct(Application $console)
{
parent::__construct();
/******************************
File Deployer.php
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare(strict_types=1);
/* (c) Anton Medvedev <anton@medv.io>
Function run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function run(string $version, ?string $deployFile): void
{
if (str_contains($version, 'master')) {
// Get version from composer.lock
$lockFile = __DIR__ . '/../../../../composer.lock';
- 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 run
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function run(string $version, ?string $deployFile): void
{
if (str_contains($version, 'master')) {
// Get version from composer.lock
$lockFile = __DIR__ . '/../../../../composer.lock';
Avoid too many return
statements within this method. Open
Open
return new Messenger($c['input'], $c['output'], $c['logger']);
Avoid too many return
statements within this method. Open
Open
return 'bash -s'; // Non-login shell for localhost.
Avoid too many return
statements within this method. Open
Open
return new Importer();
Avoid too many return
statements within this method. Open
Open
return new Collection();
Avoid too many return
statements within this method. Open
Open
return new ProcessRunner($c['pop'], $c['logger']);
Avoid too many return
statements within this method. Open
Open
return 'bash -ls';
Avoid too many return
statements within this method. Open
Open
return new Master(
$c['hosts'],
$c['input'],
$c['output'],
$c['messenger'],
Avoid too many return
statements within this method. Open
Open
return !empty($this['log'])
? new FileHandler($this['log'])
: new NullHandler();
Avoid too many return
statements within this method. Open
Open
return new Printer($c['output']);
Avoid too many return
statements within this method. Open
Open
return new Rsync($c['pop'], $c['output']);
Avoid too many return
statements within this method. Open
Open
return new HostCollection();
Avoid too many return
statements within this method. Open
Open
return new ScriptManager($c['tasks']);
Avoid too many return
statements within this method. Open
Open
return new Selector($c['hosts']);
Avoid too many return
statements within this method. Open
Open
return new Logger($this['log_handler']);
Avoid too many return
statements within this method. Open
Open
return new SshClient($c['output'], $c['pop'], $c['logger']);
Avoid too many return
statements within this method. Open
Open
return new TaskCollection();