ChipPotCollection   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A total() 0 6 1
A remove() 0 6 1
1
<?php
2
3
namespace Cysha\Casino\Holdem\Game;
4
5
use Cysha\Casino\Game\Chips;
6
use Illuminate\Support\Collection;
7
8
class ChipPotCollection extends Collection
9
{
10
    /**
11
     * @return Chips
12
     */
13 1
    public function total(): Chips
14
    {
15
        return Chips::fromAmount($this->sum(function (ChipPot $chipPot) {
16 1
            return $chipPot->total()->amount();
17 1
        }));
18
    }
19
20
    /**
21
     * @var ChipPot
22
     *
23
     * @return ChipPotCollection
24
     */
25
    public function remove(ChipPot $removeChipPot)
26
    {
27 11
        return $this->reject(function (ChipPot $chipPot) use ($removeChipPot) {
28 11
            return $chipPot->equals($removeChipPot);
29 11
        })->values();
30
    }
31
}
32