deployphp/deployer

View on GitHub
src/Command/BlackjackCommand.php

Summary

Maintainability
F
3 days
Test Coverage

Function execute has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(Input $input, Output $output): int
    {
        $this->input = $input;
        $this->output = $output;
        $this->telemetry();
Severity: Minor
Found in src/Command/BlackjackCommand.php - About 7 hrs to fix

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 166 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function execute(Input $input, Output $output): int
    {
        $this->input = $input;
        $this->output = $output;
        $this->telemetry();
Severity: Major
Found in src/Command/BlackjackCommand.php - About 6 hrs to fix

    File BlackjackCommand.php has 338 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    declare(strict_types=1);
    
    /* (c) Anton Medvedev <anton@medv.io>
    Severity: Minor
    Found in src/Command/BlackjackCommand.php - About 4 hrs to fix

      Function handValue has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function handValue(array $hand): int
          {
              $aces = 0;
              $value = 0;
              foreach ($hand as [$rank]) {
      Severity: Minor
      Found in src/Command/BlackjackCommand.php - About 2 hrs to fix

      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 handValue has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function handValue(array $hand): int
          {
              $aces = 0;
              $value = 0;
              foreach ($hand as [$rank]) {
      Severity: Major
      Found in src/Command/BlackjackCommand.php - About 2 hrs to fix

        Method printWhiskey has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function printWhiskey(int $whiskeyLevel)
            {
                if ($whiskeyLevel == 4) {
                    echo <<<ASCII
        
        
        Severity: Minor
        Found in src/Command/BlackjackCommand.php - About 1 hr to fix

          Method printHand has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function printHand(array $hand, int $offset = 1)
              {
                  $cards = [];
                  for ($i = 0; $i < count($hand) - $offset; $i++) {
                      [$rank] = $hand[$i];
          Severity: Minor
          Found in src/Command/BlackjackCommand.php - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status