GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

StoredWordSelector   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 40
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getRandomWord() 0 10 2
1
<?php
2
3
namespace WordSelector;
4
5
use WordSelector\Entity\Word;
6
use WordSelector\Repository\WordRepository;
7
8
class StoredWordSelector implements WordSelector
9
{
10
    /**
11
     * @var WordRepository
12
     */
13
    private $wordRepository;
14
15
    /**
16
     * Constructor
17
     *
18
     * @param WordRepository $wordRepository
19
     */
20 6
    public function __construct(WordRepository $wordRepository)
21
    {
22 6
        $this->wordRepository = $wordRepository;
23 6
    }
24
25
    /**
26
     * Gets a random word of <length> characters for the <lang> language
27
     * <lang> must be an iso2 code in lower case
28
     *
29
     * @param  int    $length
30
     * @param  string $lang
31
     * @param  float  $complexity
32
     *
33
     * @throws \InvalidArgumentException
34
     *
35
     * @return Word
36
     */
37 6
    public function getRandomWord($length, $lang = 'en', $complexity = null)
38
    {
39 6
        $word = $this->wordRepository->getRandomWord($length, $lang, $complexity);
40
41 6
        if (!$word) {
42 3
            throw new \InvalidArgumentException('Could not find a word');
43
        }
44
45 3
        return $word;
46
    }
47
}
48