TableException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidButtonPosition() 0 7 2
A notRegistered() 0 7 2
1
<?php
2
3
namespace Cysha\Casino\Holdem\Exceptions;
4
5
use Cysha\Casino\Game\Client;
6
use Cysha\Casino\Holdem\Game\Table;
7
use Exception;
8
9
class TableException extends Exception
10
{
11
    /**
12
     * @param null $message
13
     *
14 1
     * @return static
15
     */
16 1
    public static function invalidButtonPosition($message = null)
17 1
    {
18
        $defaultMessage = sprintf('Tried giving the button to a player that is not sat down.');
19 1
        $message = null === $message ? $defaultMessage : $message;
20
21
        return new static($message);
22
    }
23
24
    /**
25
     * @param Client $player
26
     * @param Table $table
27
     * @param string $message
28
     *
29
     * @return static
30
     */
31
    public static function notRegistered(Client $player, Table $table, $message = null)
32
    {
33
        $defaultMessage = sprintf('%s is not registered to table: "%s"', $player, $table->id()->toString());
34
        $message = is_null($message) ? $defaultMessage : $message;
35
36
        return new static($message);
37
    }
38
39
}
40