1 | <?php |
||
9 | class Alliteration extends AbstractGenerator implements Generator |
||
10 | { |
||
11 | /** @type array The definition of the potential adjectives. */ |
||
12 | protected $_adjectives; |
||
13 | |||
14 | /** @type array The definition of the potential nouns. */ |
||
15 | protected $_nouns; |
||
16 | |||
17 | /** @type Cinam\Randomizer\Randomizer The random number generator. */ |
||
18 | protected $_randomizer; |
||
19 | |||
20 | /** |
||
21 | * Initializes the Alliteration Generator with the default word lists. |
||
22 | * |
||
23 | * @api |
||
24 | * @param \Cinam\Randomizer\Randomizer $randomizer The random number generator. |
||
25 | */ |
||
26 | public function __construct(Randomizer $randomizer = null) |
||
32 | |||
33 | /** |
||
34 | * Gets a randomly generated alliterative name. |
||
35 | * |
||
36 | * @api |
||
37 | * @return string A random alliterative name. |
||
38 | */ |
||
39 | public function getName() |
||
46 | |||
47 | /** |
||
48 | * Get a random word from the list of words, optionally filtering by starting letter. |
||
49 | * |
||
50 | * @param array $words An array of words to choose from. |
||
51 | * @param string $startingLetter The desired starting letter of the word. |
||
52 | * @return string The random word. |
||
53 | */ |
||
54 | protected function _getRandomWord(array $words, $startingLetter = null) |
||
59 | } |
||
60 |