Function getopt
has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring. Open
protected function getopt($short_options, $long_options) {
$opts_no_value = array();
$opts_required_value = array();
$opts_optional_value = array();
- 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 getopt
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getopt($short_options, $long_options) {
$opts_no_value = array();
$opts_required_value = array();
$opts_optional_value = array();
File CommandLineHelper.php
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
Copyright 2009-2020 Guillaume Boudreau
This file is part of Greyhole.
Function getRunner
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function getRunner() {
if (empty($this->actionCmd) && basename(first($GLOBALS['argv'], '')) == 'cpgh') {
return new CopyCliRunner($this->options, $this->actionCmd);
}
- 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 __construct
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function __construct() {
$this->cliCommandsDefinitions = array(
new CliCommandDefinition('help', '?', null, null, "Display this help and exit."),
new CliCommandDefinition('daemon', 'D', null, DaemonRunner::class, "Start the daemon."),
new CliCommandDefinition('pause', 'P', null, PauseCliRunner::class, "Pause the daemon."),
Method getRunner
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getRunner() {
if (empty($this->actionCmd) && basename(first($GLOBALS['argv'], '')) == 'cpgh') {
return new CopyCliRunner($this->options, $this->actionCmd);
}
Function getActionCommand
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getActionCommand($command_line_options) {
foreach ($this->cliCommandsDefinitions as $def) {
$param = $def->paramSpecified($command_line_options);
if ($param !== FALSE) {
if ($param !== TRUE) {
- 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"