Passed
Push — master ( 32373f...f18c17 )
by Benjamin
05:50 queued 01:43
created

NoVersionException::getVersionMessage()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.3332

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 8
ccs 4
cts 6
cp 0.6667
rs 10
cc 3
nc 3
nop 1
crap 3.3332
1
<?php
2
3
namespace Obblm\Core\Exception;
4
5
use Obblm\Core\Entity\Player;
6
use Obblm\Core\Entity\Team;
7
8
class NoVersionException extends \Exception implements ExceptionInterface
9
{
10 1
    public function __construct(object $on = null)
11
    {
12 1
        parent::__construct($this->getVersionMessage($on));
13 1
    }
14
15 1
    private function getVersionMessage(object $on = null):string
16
    {
17 1
        if ($on instanceof Team) {
18
            return "No version available for team : " . $on->getName();
19 1
        } elseif ($on instanceof Player) {
20 1
            return "No version available for player : " . $on->getName();
21
        }
22
        return "No version available";
23
    }
24
}
25