Hoa central
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Hoa\Console\Readline\Autocompleter\Aggregate Class Reference
Inheritance diagram for Hoa\Console\Readline\Autocompleter\Aggregate:

Public Member Functions

 __construct (Array $autocompleters)
 
 complete (&$prefix)
 
 getAutocompleters ()
 
 getWordDefinition ()
 

Protected Member Functions

 setAutocompleters (Array $autocompleters)
 

Protected Attributes

 $_autocompleters = null
 

Detailed Description

Class .

Aggregate several autocompleters.

Definition at line 47 of file Aggregate.php.

Constructor & Destructor Documentation

Hoa\Console\Readline\Autocompleter\Aggregate::__construct ( Array  $autocompleters)

Constructor.

Parameters
array$autocompletersAuto-completers.
Returns
void

Definition at line 64 of file Aggregate.php.

65  {
66  $this->setAutocompleters($autocompleters);
67 
68  return;
69  }

Here is the call graph for this function:

Member Function Documentation

Hoa\Console\Readline\Autocompleter\Aggregate::complete ( $prefix)

Complete a word. Returns null for no word, a full-word or an array of full-words.

Parameters
string&$prefixPrefix to autocomplete.
Returns
mixed

Implements Hoa\Console\Readline\Autocompleter\Autocompleter.

Definition at line 78 of file Aggregate.php.

79  {
80  foreach ($this->getAutocompleters() as $autocompleter) {
81  $preg = preg_match(
82  '#(' . $autocompleter->getWordDefinition() . ')$#u',
83  $prefix,
84  $match
85  );
86 
87  if (0 === $preg) {
88  continue;
89  }
90 
91  $_prefix = $match[0];
92 
93  if (null === $out = $autocompleter->complete($_prefix)) {
94  continue;
95  }
96 
97  $prefix = $_prefix;
98 
99  return $out;
100  }
101 
102  return null;
103  }

Here is the call graph for this function:

Hoa\Console\Readline\Autocompleter\Aggregate::getAutocompleters ( )

Get list of autocompleters.

Returns

Definition at line 124 of file Aggregate.php.

Here is the caller graph for this function:

Hoa\Console\Readline\Autocompleter\Aggregate::getWordDefinition ( )

Get definition of a word.

Returns
string

Implements Hoa\Console\Readline\Autocompleter\Autocompleter.

Definition at line 134 of file Aggregate.php.

135  {
136  return '.*';
137  }
Hoa\Console\Readline\Autocompleter\Aggregate::setAutocompleters ( Array  $autocompleters)
protected

Set/initialize list of autocompleters.

Parameters
array$autocompletersAuto-completers.
Returns

Definition at line 111 of file Aggregate.php.

112  {
113  $old = $this->_autocompleters;
114  $this->_autocompleters = new \ArrayObject($autocompleters);
115 
116  return $old;
117  }

Here is the caller graph for this function:

Member Data Documentation

Hoa\Console\Readline\Autocompleter\Aggregate::$_autocompleters = null
protected

Definition at line 54 of file Aggregate.php.


The documentation for this class was generated from the following file: