Showing 20 of 20 total issues
Method dispatch
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dispatch(string $path, array $vars, string $route_name) : void
{
global $argv;
$logger = $this->getLogger();
Method install
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function install(ApplicationInterface $app)
{
try{
$c = $app->di();
Method executeCommand
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function executeCommand(DiContainerInterface $di, string $command_id, int $skip_args) : int
{
$this->command_db->load();
$this->alias_db->load();
Method load
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function load() : bool
{
$this->command_db = [];
if (!file_exists($this->command_db_file)){
Function validateCommandDescriptor
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function validateCommandDescriptor(array $descriptor, string $descriptor_file)
{
$command_id = $descriptor['command_id'] ?? '';
$class_root = $descriptor['class_root'] ?? ''; // i.e: /root/to/my/command
$class_name = $descriptor['class_name'] ?? ''; // i.e: MyPackage.MyCommand
- 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 dispatch
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function dispatch(string $path, array $vars, string $route_name) : void
{
global $argv;
$logger = $this->getLogger();
- 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 execute
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute(array $args, ConsoleIOInterface $io): int
{
$io->output('cmd: ' . self::getCommandId())->eol();
$app_class= $args['app_class'] ?? '';
Method installCommand
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function installCommand(CommandDescriptorService $desc_s, CommandDbFileService $command_db, AliasDbFileService $alias_db, string $command_id)
{
try{
$this->io->output(self::CONSOLE_SEPARATOR)->eol();
Function executeCommand
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function executeCommand(DiContainerInterface $di, string $command_id, int $skip_args) : int
{
$this->command_db->load();
$this->alias_db->load();
- 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 showCommandHelp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function showCommandHelp(CommandDescriptor $desc, bool $show_separatpr)
{
$command_help = $desc->getCommandHelp();
if (is_array($command_help)){
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
FileSystemInterface $fs,
ApplicationInterface $app,
CommandDbFileService $command_db,
AliasDbFileService $alias_db,
ConsoleIOInterface $io)
Avoid too many return
statements within this method. Open
return new CommandAutoloadService($fs, $db_file);
Avoid too many return
statements within this method. Open
return new SystemService();
Avoid too many return
statements within this method. Open
return new CommandDbFileService($fs);
Avoid too many return
statements within this method. Open
return new CommandDescriptorService($fs);
Avoid too many return
statements within this method. Open
return new CommandExecService($fs, $app, $command_db, $alias_db, $io);
Avoid too many return
statements within this method. Open
return new AliasDbFileService($fs);
Function getArgs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getArgs(array $ordered_args, array $named_args, int $skip_args) : array
{
$request = $this->app->request();
$seq_params = array_filter($request->getServerParams(), function($value, $key){
return is_int($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
Function installCommand
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function installCommand(CommandDescriptorService $desc_s, CommandDbFileService $command_db, AliasDbFileService $alias_db, string $command_id)
{
try{
$this->io->output(self::CONSOLE_SEPARATOR)->eol();
- 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 helpCommand
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function helpCommand(CommandDescriptorService $desc_s, string $command_id)
{
try{
$this->io->output(str_pad('ID', 25) . 'COMMAND LINE')->eol();
- 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"