File functions.php
has 540 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/* (c) Anton Medvedev <anton@medv.io>
Method run
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?bool $real_time_output = false, ?bool $no_throw = false): string
{
$namedArguments = [];
foreach (['timeout', 'idle_timeout', 'secret', 'env', 'real_time_output', 'no_throw'] as $arg) {
if ($$arg !== null) {
Function run
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function run(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?bool $real_time_output = false, ?bool $no_throw = false): string
{
$namedArguments = [];
foreach (['timeout', 'idle_timeout', 'secret', 'env', 'real_time_output', 'no_throw'] as $arg) {
if ($$arg !== null) {
- 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
Function task
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function task(string $name, $body = null): Task
{
$deployer = Deployer::get();
if (empty($body)) {
- 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 task
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function task(string $name, $body = null): Task
{
$deployer = Deployer::get();
if (empty($body)) {
Function on
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function on($hosts, callable $callback): void
{
if (!is_array($hosts) && !($hosts instanceof \Traversable)) {
$hosts = [$hosts];
}
- 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 askChoice
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function askChoice(string $message, array $availableChoices, $default = null, bool $multiselect = false)
{
if (defined('DEPLOYER_NO_ASK')) {
throw new WillAskUser($message);
}
Method run
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function run(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?bool $real_time_output = false, ?bool $no_throw = false): string
Method runLocally
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function runLocally(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?string $shell = null): string
Method fetch
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function fetch(string $url, string $method = 'get', array $headers = [], ?string $body = null, ?array &$info = null, bool $nothrow = false): string
Function askChoice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function askChoice(string $message, array $availableChoices, $default = null, bool $multiselect = false)
{
if (defined('DEPLOYER_NO_ASK')) {
throw new WillAskUser($message);
}
- 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 option
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function option(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null): void
Function host
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function host(string ...$hostname)
{
$deployer = Deployer::get();
if (count($hostname) === 1 && $deployer->hosts->has($hostname[0])) {
return $deployer->hosts->get($hostname[0]);
- 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"