X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FCommand%2FListCommand%2FClassConstantEnumerator.php;fp=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FCommand%2FListCommand%2FClassConstantEnumerator.php;h=0000000000000000000000000000000000000000;hp=fc974b2d944d4ec2061d49c964ffefea5c2bf5b0;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php b/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php deleted file mode 100644 index fc974b2d9..000000000 --- a/vendor/psy/psysh/src/Psy/Command/ListCommand/ClassConstantEnumerator.php +++ /dev/null @@ -1,129 +0,0 @@ -getOption('constants')) { - return; - } - - $noInherit = $input->getOption('no-inherit'); - $constants = $this->prepareConstants($this->getConstants($reflector, $noInherit)); - - if (empty($constants)) { - return; - } - - $ret = array(); - $ret[$this->getKindLabel($reflector)] = $constants; - - return $ret; - } - - /** - * Get defined constants for the given class or object Reflector. - * - * @param \Reflector $reflector - * @param bool $noInherit Exclude inherited constants - * - * @return array - */ - protected function getConstants(\Reflector $reflector, $noInherit = false) - { - $className = $reflector->getName(); - - $constants = array(); - foreach ($reflector->getConstants() as $name => $constant) { - $constReflector = new ReflectionConstant($reflector, $name); - - if ($noInherit && $constReflector->getDeclaringClass()->getName() !== $className) { - continue; - } - - $constants[$name] = $constReflector; - } - - // @todo switch to ksort after we drop support for 5.3: - // ksort($constants, SORT_NATURAL | SORT_FLAG_CASE); - uksort($constants, 'strnatcasecmp'); - - return $constants; - } - - /** - * Prepare formatted constant array. - * - * @param array $constants - * - * @return array - */ - protected function prepareConstants(array $constants) - { - // My kingdom for a generator. - $ret = array(); - - foreach ($constants as $name => $constant) { - if ($this->showItem($name)) { - $ret[$name] = array( - 'name' => $name, - 'style' => self::IS_CONSTANT, - 'value' => $this->presentRef($constant->getValue()), - ); - } - } - - return $ret; - } - - /** - * Get a label for the particular kind of "class" represented. - * - * @param \ReflectionClass $reflector - * - * @return string - */ - protected function getKindLabel(\ReflectionClass $reflector) - { - if ($reflector->isInterface()) { - return 'Interface Constants'; - } elseif (method_exists($reflector, 'isTrait') && $reflector->isTrait()) { - return 'Trait Constants'; - } else { - return 'Class Constants'; - } - } -}