Passed
Push — main ( a387cb...339f6d )
by Cornelia
07:55
created

CardHand::getCards()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Card;
4
5
/**
6
 * Class CardHand.
7
 *
8
 * Represents a hand of playing cards.
9
 */
10
class CardHand
11
{
12
    /**
13
     * @var Card[] array of Card objects representing the hand
14
     */
15
    private array $cards = [];
16
17
    /**
18
     * Adds a card to the hand.
19
     *
20
     * @param Card $card the card to add
21
     */
22 16
    public function addCard(Card $card): void
23
    {
24 16
        $this->cards[] = $card;
25
    }
26
27
    /**
28
     * Returns all cards in the hand.
29
     *
30
     * @return Card[] an array of Card objects
31
     */
32 18
    public function getCards(): array
33
    {
34 18
        return $this->cards;
35
    }
36
}
37