src/Command/BlackjackCommand.php
Function execute
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function execute(Input $input, Output $output): int
{
$this->input = $input;
$this->output = $output;
$this->telemetry();
- 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 166 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function execute(Input $input, Output $output): int
{
$this->input = $input;
$this->output = $output;
$this->telemetry();
File BlackjackCommand.php
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare(strict_types=1);
/* (c) Anton Medvedev <anton@medv.io>
Function handValue
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function handValue(array $hand): int
{
$aces = 0;
$value = 0;
foreach ($hand as [$rank]) {
- 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 handValue
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function handValue(array $hand): int
{
$aces = 0;
$value = 0;
foreach ($hand as [$rank]) {
Method printWhiskey
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function printWhiskey(int $whiskeyLevel)
{
if ($whiskeyLevel == 4) {
echo <<<ASCII
Method printHand
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function printHand(array $hand, int $offset = 1)
{
$cards = [];
for ($i = 0; $i < count($hand) - $offset; $i++) {
[$rank] = $hand[$i];