X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FTabCompletion%2FMatcher%2FObjectMethodsMatcher.php;fp=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FTabCompletion%2FMatcher%2FObjectMethodsMatcher.php;h=0000000000000000000000000000000000000000;hp=dfb1d305f4b566757f47008c09c451a4a0eb1676;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php b/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php deleted file mode 100644 index dfb1d305f..000000000 --- a/vendor/psy/psysh/src/Psy/TabCompletion/Matcher/ObjectMethodsMatcher.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ -class ObjectMethodsMatcher extends AbstractContextAwareMatcher -{ - /** - * {@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); - if (!is_array($objectToken)) { - return array(); - } - $objectName = str_replace('$', '', $objectToken[1]); - - try { - $object = $this->getVariable($objectName); - } catch (InvalidArgumentException $e) { - return array(); - } - - if (!is_object($object)) { - return array(); - } - - return array_filter( - get_class_methods($object), - function ($var) use ($input) { - return AbstractMatcher::startsWith($input, $var) && - // also check that we do not suggest invoking a super method(__construct, __wakeup, …) - !AbstractMatcher::startsWith('__', $var); - } - ); - } - - /** - * {@inheritdoc} - */ - public function hasMatched(array $tokens) - { - $token = array_pop($tokens); - $prevToken = array_pop($tokens); - - switch (true) { - case self::tokenIs($token, self::T_OBJECT_OPERATOR): - case self::tokenIs($prevToken, self::T_OBJECT_OPERATOR): - return true; - } - - return false; - } -}