Completed
Push — master ( 00502f...bef3d5 )
by Steve
03:34
created

TotallyLegit   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 20
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A roll() 0 4 1
A __construct() 0 5 1
A name() 0 4 1
1
<?php
2
3
namespace MeadSteve\DiceApi\DiceDecorators;
4
5
use MeadSteve\DiceApi\Dice;
6
7
class TotallyLegit implements Dice
8
{
9
    private $dice;
10
    private $alwaysRoll;
11
12
    public function __construct(Dice $dice, $alwaysRoll = 6)
13
    {
14
        $this->dice = $dice;
15
        $this->alwaysRoll = (int) $alwaysRoll;
16
    }
17
    public function name()
18
    {
19
        return $this->dice->name();
20
    }
21
22
    public function roll()
23
    {
24
        return $this->alwaysRoll;
25
    }
26
}
27