/var/www/vhosts/ihelp.ro/httpdocs/vendor/psy/psysh/src/Readline/Hoa
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/psy/psysh/src/Readline/Hoa/AutocompleterWord.php (3179B)
setWords($words);
}
/**
* Complete a word.
* Returns null for no word, a full-word or an array of full-words.
*
* @param string &$prefix Prefix to autocomplete
*
* @return mixed
*/
public function complete(&$prefix)
{
$out = [];
$length = \mb_strlen($prefix);
foreach ($this->getWords() as $word) {
if (\mb_substr($word, 0, $length) === $prefix) {
$out[] = $word;
}
}
if (empty($out)) {
return null;
}
if (1 === \count($out)) {
return $out[0];
}
return $out;
}
/**
* Get definition of a word.
*/
public function getWordDefinition(): string
{
return '\b\w+';
}
/**
* Set list of words.
*
* @param array $words words
*
* @return array
*/
public function setWords(array $words)
{
$old = $this->_words;
$this->_words = $words;
return $old;
}
/**
* Get list of words.
*/
public function getWords(): array
{
return $this->_words;
}
}