Code Duplication    Length = 10-10 lines in 2 locations

src/WordLists/WordList.php 2 locations

@@ 39-48 (lines=10) @@
36
     * @return string
37
     * @throws \KoenHoeijmakers\PaperKeyGenerator\WordLists\Exceptions\WordListException
38
     */
39
    public function getWord(int $index): string
40
    {
41
        $words = $this->getWords();
42
43
        if (!array_key_exists($index, $words)) {
44
            throw new WordListException('No word found on index "' . $index . '"');
45
        }
46
47
        return $words[$index];
48
    }
49
50
    /**
51
     * Get the array of words.
@@ 67-76 (lines=10) @@
64
     * @return int
65
     * @throws \KoenHoeijmakers\PaperKeyGenerator\WordLists\Exceptions\WordListException
66
     */
67
    public function getWordIndex(string $word): int
68
    {
69
        $words = $this->getFlippedWords();
70
71
        if (!array_key_exists($word, $words)) {
72
            throw new WordListException('No index found for word "' . $word . '"');
73
        }
74
75
        return $words[$word];
76
    }
77
78
    /**
79
     * Get the array of flipped words.