PerfectPlayer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 2
Metric Value
wmc 2
cbo 2
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A play() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace GameDomain\Player\Players;
4
5
use GameDomain\Player\PlayerInterface;
6
use GameDomain\Round\Step\Step;
7
use GameDomain\Rule\AbstractRulesSet;
8
9
/**
10
 * Perfect Player : always gives a correct answer.
11
 */
12
class PerfectPlayer implements PlayerInterface
13
{
14
    /**
15
     * {@inheritDoc}
16
     */
17
    final public function play(AbstractRulesSet $gameRules, Step $step)
18
    {
19
        return $gameRules->generateValidAnswer($step->getRawValue());
20
    }
21
22
    /**
23
     * {@inheritDoc}
24
     */
25
    public function __toString()
26
    {
27
        return 'Perfect';
28
    }
29
}
30