芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/bit-alphas-ltd.com/user/project/vendor/psy/psysh/src/ParserFactory.php
= 2.0 — does. * * @return bool */ public function hasKindsSupport() { return \class_exists(OriginalParserFactory::class); } /** * Default kind (if supported, based on current interpreter's version). * * @return string|null */ public function getDefaultKind() { if ($this->hasKindsSupport()) { return \version_compare(\PHP_VERSION, '7.0', '>=') ? static::ONLY_PHP7 : static::ONLY_PHP5; } } /** * New parser instance with given kind. * * @param string|null $kind One of class constants (only for PHP parser 2.0 and above) * * @return Parser */ public function createParser($kind = null) { if ($this->hasKindsSupport()) { $originalFactory = new OriginalParserFactory(); $kind = $kind ?: $this->getDefaultKind(); if (!\in_array($kind, static::getPossibleKinds())) { throw new \InvalidArgumentException('Unknown parser kind'); } $parser = $originalFactory->create(\constant(OriginalParserFactory::class.'::'.$kind)); } else { if ($kind !== null) { throw new \InvalidArgumentException('Install PHP Parser v2.x to specify parser kind'); } $parser = new Parser(new Lexer()); } return $parser; } }