| Conditions | 5 | 
| Paths | 3 | 
| Total Lines | 28 | 
| Code Lines | 17 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 18 | public function generatePassword() | ||
| 19 |     { | ||
| 20 | $vowels = $this->getParameter(self::PARAMETER_VOWELS, ''); | ||
| 21 | |||
| 22 |         if (!strlen($vowels)) { | ||
| 23 | return parent::generatePassword(); | ||
| 24 | } | ||
| 25 | |||
| 26 | $characterList = $this->getCharacterList()->getCharacters(); | ||
| 27 | $charactersCount = strlen($characterList); | ||
| 28 | $password = ''; | ||
| 29 | |||
| 30 | $length = $this->getLength(); | ||
| 31 | $isLastCharVowel = null; | ||
| 32 | |||
| 33 |         for ($i = 0; $i < $length; ++$i) { | ||
| 34 |             do { | ||
| 35 | $char = $characterList[$this->randomInteger(0, $charactersCount - 1)]; | ||
| 36 | $isVowel = false !== stripos($vowels, $char); | ||
| 37 | |||
| 38 | } while (null !== $isLastCharVowel && $isVowel === $isLastCharVowel); | ||
| 39 | |||
| 40 | $password .= $char; | ||
| 41 | $isLastCharVowel = $isVowel; | ||
| 42 | } | ||
| 43 | |||
| 44 | return $password; | ||
| 45 | } | ||
| 46 | } | ||
| 47 |