4 * This file is part of Psy Shell.
6 * (c) 2012-2017 Justin Hileman
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Psy\TabCompletion\Matcher;
18 * An abstract tab completion Matcher which implements ContextAware.
20 * The AutoCompleter service will inject a Context instance into all
21 * ContextAware Matchers.
23 * @author Marc Garcia <markcial@gmail.com>
25 abstract class AbstractContextAwareMatcher extends AbstractMatcher implements ContextAware
28 * Context instance (for ContextAware interface).
35 * ContextAware interface.
37 * @param Context $context
39 public function setContext(Context $context)
41 $this->context = $context;
45 * Get a Context variable by name.
47 * @param $var Variable name
51 protected function getVariable($var)
53 return $this->context->get($var);
57 * Get all variables in the current Context.
61 protected function getVariables()
63 return $this->context->getAll();