Mercurial > hg > isophonics-drupal-site
comparison vendor/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 5fb285c0d0e3 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
25 */ | 25 */ |
26 public function getMatches(array $tokens, array $info = []) | 26 public function getMatches(array $tokens, array $info = []) |
27 { | 27 { |
28 $input = $this->getInput($tokens); | 28 $input = $this->getInput($tokens); |
29 | 29 |
30 $firstToken = array_pop($tokens); | 30 $firstToken = \array_pop($tokens); |
31 if (self::tokenIs($firstToken, self::T_STRING)) { | 31 if (self::tokenIs($firstToken, self::T_STRING)) { |
32 // second token is the object operator | 32 // second token is the object operator |
33 array_pop($tokens); | 33 \array_pop($tokens); |
34 } | 34 } |
35 $objectToken = array_pop($tokens); | 35 $objectToken = \array_pop($tokens); |
36 $objectName = str_replace('$', '', $objectToken[1]); | 36 $objectName = \str_replace('$', '', $objectToken[1]); |
37 $object = $this->getVariable($objectName); | 37 $object = $this->getVariable($objectName); |
38 | 38 |
39 if (!$object instanceof \MongoDB) { | 39 if (!$object instanceof \MongoDB) { |
40 return []; | 40 return []; |
41 } | 41 } |
42 | 42 |
43 return array_filter( | 43 return \array_filter( |
44 $object->getCollectionNames(), | 44 $object->getCollectionNames(), |
45 function ($var) use ($input) { | 45 function ($var) use ($input) { |
46 return AbstractMatcher::startsWith($input, $var); | 46 return AbstractMatcher::startsWith($input, $var); |
47 } | 47 } |
48 ); | 48 ); |
51 /** | 51 /** |
52 * {@inheritdoc} | 52 * {@inheritdoc} |
53 */ | 53 */ |
54 public function hasMatched(array $tokens) | 54 public function hasMatched(array $tokens) |
55 { | 55 { |
56 $token = array_pop($tokens); | 56 $token = \array_pop($tokens); |
57 $prevToken = array_pop($tokens); | 57 $prevToken = \array_pop($tokens); |
58 | 58 |
59 switch (true) { | 59 switch (true) { |
60 case self::tokenIs($token, self::T_OBJECT_OPERATOR): | 60 case self::tokenIs($token, self::T_OBJECT_OPERATOR): |
61 case self::tokenIs($prevToken, self::T_OBJECT_OPERATOR): | 61 case self::tokenIs($prevToken, self::T_OBJECT_OPERATOR): |
62 return true; | 62 return true; |