X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FCommand%2FShowCommand.php;fp=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FCommand%2FShowCommand.php;h=024b72c23b6045b1e28ab495b97fc836da824f83;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/psy/psysh/src/Psy/Command/ShowCommand.php b/vendor/psy/psysh/src/Psy/Command/ShowCommand.php new file mode 100644 index 000000000..024b72c23 --- /dev/null +++ b/vendor/psy/psysh/src/Psy/Command/ShowCommand.php @@ -0,0 +1,79 @@ +colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO; + + return parent::__construct(); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('show') + ->setDefinition(array( + new InputArgument('value', InputArgument::REQUIRED, 'Function, class, instance, constant, method or property to show.'), + )) + ->setDescription('Show the code for an object, class, constant, method or property.') + ->setHelp( + <<>>> show \$myObject +>>> show Psy\Shell::debug +HELP + ); + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + list($value, $reflector) = $this->getTargetAndReflector($input->getArgument('value')); + + // Set some magic local variables + $this->setCommandScopeVariables($reflector); + + try { + $output->page(CodeFormatter::format($reflector, $this->colorMode), ShellOutput::OUTPUT_RAW); + } catch (RuntimeException $e) { + $output->writeln(SignatureFormatter::format($reflector)); + throw $e; + } + } +}