/**
  * {@inheritdoc}
  */
 public function getMatches(array $tokens, array $info = array())
 {
     $input = $this->getInput($tokens);
     return array_filter($this->keywords, function ($keyword) use($input) {
         return AbstractMatcher::startsWith($input, $keyword);
     });
 }
 /**
  * {@inheritDoc}
  */
 public function getMatches(array $tokens, array $info = array())
 {
     $const = $this->getInput($tokens);
     return array_filter(array_keys(get_defined_constants()), function ($constant) use($const) {
         return AbstractMatcher::startsWith($const, $constant);
     });
 }
 /**
  * {@inheritdoc}
  */
 public function getMatches(array $tokens, array $info = array())
 {
     $var = str_replace('$', '', $this->getInput($tokens));
     return array_filter(array_keys($this->getVariables()), function ($variable) use($var) {
         return AbstractMatcher::startsWith($var, $variable);
     });
 }
 /**
  * {@inheritDoc}
  */
 public function getMatches(array $tokens, array $info = array())
 {
     $func = $this->getInput($tokens);
     $functions = get_defined_functions();
     $allFunctions = array_merge($functions['user'], $functions['internal']);
     return array_filter($allFunctions, function ($function) use($func) {
         return AbstractMatcher::startsWith($func, $function);
     });
 }
 /**
  * {@inheritDoc}
  */
 public function getMatches(array $tokens, array $info = array())
 {
     $input = $this->getInput($tokens);
     $firstToken = array_pop($tokens);
     if (self::tokenIs($firstToken, self::T_STRING)) {
         // second token is the object operator
         array_pop($tokens);
     }
     $objectToken = array_pop($tokens);
     $objectName = str_replace('$', '', $objectToken[1]);
     $object = $this->getVariable($objectName);
     return array_filter(get_class_methods($object), function ($var) use($input) {
         return AbstractMatcher::startsWith($input, $var);
     });
 }
 /**
  * {@inheritDoc}
  */
 public function getMatches(array $tokens, array $info = array())
 {
     $class = $this->getNamespaceAndClass($tokens);
     if (strlen($class) > 0 && $class[0] === '\\') {
         $class = substr($class, 1, strlen($class));
     }
     $quotedClass = preg_quote($class);
     return array_map(function ($className) use($class) {
         // get the number of namespace separators
         $nsPos = substr_count($class, '\\');
         $pieces = explode('\\', $className);
         // $methods = Mirror::get($class);
         return implode('\\', array_slice($pieces, $nsPos, count($pieces)));
     }, array_filter(get_declared_classes(), function ($className) use($quotedClass) {
         return AbstractMatcher::startsWith($quotedClass, $className);
     }));
 }
 /**
  *
  * {@inheritdoc}
  *
  */
 public function getMatches(array $tokens, array $info = array())
 {
     $input = $this->getInput($tokens);
     $firstToken = array_pop($tokens);
     if (self::tokenIs($firstToken, self::T_STRING)) {
         // second token is the nekudotayim operator
         array_pop($tokens);
     }
     $class = $this->getNamespaceAndClass($tokens);
     $reflection = new \ReflectionClass($class);
     $vars = array_merge(array_map(function ($var) {
         return '$' . $var;
     }, array_keys($reflection->getStaticProperties())), array_keys($reflection->getConstants()));
     return array_map(function ($name) use($class) {
         return $class . '::' . $name;
     }, array_filter($vars, function ($var) use($input) {
         return AbstractMatcher::startsWith($input, $var);
     }));
 }
Esempio n. 8
0
 /**
  *
  * {@inheritdoc}
  *
  */
 public function getMatches(array $tokens, array $info = array())
 {
     $input = $this->getInput($tokens);
     $firstToken = array_pop($tokens);
     if (self::tokenIs($firstToken, self::T_STRING)) {
         // second token is the nekudotayim operator
         array_pop($tokens);
     }
     $class = $this->getNamespaceAndClass($tokens);
     $reflection = new \ReflectionClass($class);
     $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
     $methods = array_map(function (\ReflectionMethod $method) {
         return $method->getName();
     }, $methods);
     return array_map(function ($name) use($class) {
         return $class . '::' . $name;
     }, array_filter($methods, function ($method) use($input) {
         return AbstractMatcher::startsWith($input, $method);
     }));
 }
 /**
  * {@inheritdoc}
  */
 public function getMatches(array $tokens, array $info = array())
 {
     $input = $this->getInput($tokens);
     $firstToken = array_pop($tokens);
     if (self::tokenIs($firstToken, self::T_STRING)) {
         // second token is the object operator
         array_pop($tokens);
     }
     $objectToken = array_pop($tokens);
     $objectName = str_replace('$', '', $objectToken[1]);
     $object = $this->getVariable($objectName);
     if (!$object instanceof \MongoClient) {
         return array();
     }
     $list = $object->listDBs();
     return array_filter(array_map(function ($info) {
         return $info['name'];
     }, $list['databases']), function ($var) use($input) {
         return AbstractMatcher::startsWith($input, $var);
     });
 }