*/
class Phrase
{
- CONST MAX_DEPTH = 7;
+ const MAX_DEPTH = 7;
// Complete phrase as a string.
private $sPhrase;
$aResult = array(array(join(' ', $aWords)));
$sFirstToken = '';
if ($iDepth < Phrase::MAX_DEPTH) {
- while (sizeof($aWords) > 1) {
+ while (count($aWords) > 1) {
$sWord = array_shift($aWords);
$sFirstToken .= ($sFirstToken?' ':'').$sWord;
$aRest = $this->createWordSets($aWords, $iDepth + 1);
$aResult = array(array(join(' ', $aWords)));
$sFirstToken = '';
if ($iDepth < Phrase::MAX_DEPTH) {
- while (sizeof($aWords) > 1) {
+ while (count($aWords) > 1) {
$sWord = array_pop($aWords);
$sFirstToken = $sWord.($sFirstToken?' ':'').$sFirstToken;
$aRest = $this->createInverseWordSets($aWords, $iDepth + 1);
return $aResult;
}
-};
+
+ public function debugInfo()
+ {
+ return array(
+ 'Type' => $this->sPhraseType,
+ 'Phrase' => $this->sPhrase,
+ 'Words' => $this->aWords,
+ 'WordSets' => $this->aWordSets
+ );
+ }
+}