Completed
Branch v1.x-dev (5c2708)
by Benjamin
04:14
created

NoVersionException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 15
ccs 0
cts 9
cp 0
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getVersionMessage() 0 8 3
A __construct() 0 3 1
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
    public function __construct(object $on = null)
11
    {
12
        parent::__construct($this->getVersionMessage($on));
13
    }
14
15
    private function getVersionMessage(object $on = null):string
16
    {
17
        if ($on instanceof Team) {
18
            return "No version available for team : " . $on->getName();
19
        } elseif ($on instanceof Player) {
20
            return "No version available for player : " . $on->getName();
21
        }
22
        return "No version available";
23
    }
24
}
25