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; } } }