Showing 16 of 23 total issues
Function isPoint
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$high = null;
$kicker = null;
// check if there's a three: in this case, we remove one card
- 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 isPoint
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$high = null;
$kicker = null;
// check if there's a three: in this case, we remove one card
Function isPoint
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$counts = \array_count_values(self::getCardsSuits($cards));
if (!\in_array(5, $counts, true)) {
return new RankResult(false);
- 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 isPoint
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$counts = \array_count_values(self::getCardsSuits($cards));
if (!\in_array(5, $counts, true)) {
return new RankResult(false);
- 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 straight
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected static function straight(array $cards): array
{
// check if there's a three: in this case, we remove one card
$three = ThreeOfAKindRank::isPoint($cards);
if ($three->isPoint()) {
- 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 isPoint
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$high = null;
$kicker = null;
$counts = \array_count_values(self::getCardsValues($cards));
- 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 deal
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function deal(int $startingHandCount = 2, int $commonCount = 5): void
{
$cards = Card::getDeck(true);
for ($i = 0; $i < $this->players->count(); ++$i) {
$handCards = [];
- 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 isPoint
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$counts = \array_count_values(self::getCardsSuits($cards));
if (!\in_array(5, $counts, true)) {
return new RankResult(false);
Method straight
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function straight(array $cards): array
{
// check if there's a three: in this case, we remove one card
$three = ThreeOfAKindRank::isPoint($cards);
if ($three->isPoint()) {
Method isPoint
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$counts = \array_count_values(self::getCardsSuits($cards));
if (!\in_array(5, $counts, true)) {
return new RankResult(false);
Function isPoint
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$high = null;
$kicker = null;
$counts = \array_count_values(self::getCardsValues($cards));
- 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 isPoint
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$high = null;
$kicker = null;
$counts = \array_count_values(self::getCardsSuits($cards));
- 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 isPoint
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$high = null;
$kicker = null;
$counts = \array_count_values(self::getCardsValues($cards));
- 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 isPoint
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$high = null;
$kicker = null;
$counts = \array_count_values(self::getCardsValues($cards));
- 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 isPoint
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function isPoint(array $cards): RankResult
{
$count = \array_count_values(self::getCardsValues($cards));
$high = null;
$kicker = 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
Consider simplifying this complex logical expression. Open
if (14 === $value && 2 === $first && 3 === \max($sequence, $maxSequence) && \in_array(5, $values, true) && \in_array(4, $values, true) && \in_array(3, $values, true)) {
foreach ($cards as $card) {
if (5 === $card->getRank()->getInt()) { // A, 2, 3, 4, 5
$high = $card;
break;