'', 'suggestions' => [ "Use a few words, avoid common phrases", "No need for symbols, digits, or uppercase letters", ], ]; } // no feedback if score is good or great. if ($score > 2) { return [ 'warning' => '', 'suggestions' => [], ]; } // tie feedback to the longest match for longer sequences $longestMatch = $sequence[0]; foreach (array_slice($sequence, 1) as $match) { if (mb_strlen($match->token) > mb_strlen($longestMatch->token)) { $longestMatch = $match; } } $feedback = $longestMatch->getFeedback(count($sequence) === 1); $extraFeedback = 'Add another word or two. Uncommon words are better.'; array_unshift($feedback['suggestions'], $extraFeedback); return $feedback; } }