Completed
Push — master ( ae2bec...c19c38 )
by Steve
01:59
created

Plain   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A renderDice() 0 5 1
A contentType() 0 4 1
A urlPrefix() 0 4 1
A textForSingleDice() 0 4 1
1
<?php
2
3
namespace MeadSteve\DiceApi\Renderer;
4
5
use MeadSteve\DiceApi\Dice;
6
7
class Plain implements DiceRenderer
8
{
9
    public function renderDice(array $diceCollection)
10
    {
11
        $diceHtmlParts = array_map([$this, 'textForSingleDice'], $diceCollection);
12
        return implode(', ', $diceHtmlParts);
13
    }
14
15
    /**
16
     * @return string
17
     */
18
    public function contentType() : string
19
    {
20
        return "text/string";
21
    }
22
23
    public function urlPrefix(): string
24
    {
25
        return "string";
26
    }
27
28
    public function textForSingleDice(Dice $dice)
29
    {
30
        return "{$dice->name()} : {$dice->roll()}";
31
    }
32
}
33