CardGraphic::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 7
rs 10
ccs 5
cts 5
cp 1
crap 3
1
<?php
2
3
namespace App\Card;
4
5
/**
6
 * Methods for CardGraphic class.
7
 */
8
class CardGraphic extends Card
9
{
10
    /**
11
     * @var array<string, string>
12
     */
13
    private $graphics = [
14
        'C' => '♣',
15
        'S' => '♠',
16
        'H' => '♥',
17
        'D' => '♦'
18
    ];
19
20 10
    public function __construct(array $card)
21
    {
22 10
        parent::__construct($card);
23
24 10
        foreach ($this->graphics as $suit => $unicode) {
25 10
            if ($suit == $this->value[0]) {
26 10
                array_push($this->value, $unicode);
27
            }
28
        }
29
    }
30
}
31