/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { list($value, $reflector) = $this->getTargetAndReflector($input->getArgument('value')); $doc = $this->getManualDoc($reflector) ?: DocblockFormatter::format($reflector); $output->page(function ($output) use($reflector, $doc) { $output->writeln(SignatureFormatter::format($reflector)); if (empty($doc) && !$this->getApplication()->getManualDb()) { $output->writeln(''); $output->writeln('<warning>PHP manual not found</warning>'); $output->writeln(' To document core PHP functionality, download the PHP reference manual:'); $output->writeln(' https://github.com/bobthecow/psysh#downloading-the-manual'); } else { $output->writeln(''); $output->writeln($doc); } }); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { list($value, $reflector) = $this->getTargetAndReflector($input->getArgument('value')); $output->page(function (ShellOutput $output) use($reflector) { $output->writeln(SignatureFormatter::format($reflector)); $output->writeln(CodeFormatter::format($reflector), ShellOutput::OUTPUT_RAW); }); }
/** * * {@inheritdoc} * */ protected function execute(InputInterface $input, OutputInterface $output) { list($value, $reflector) = $this->getTargetAndReflector($input->getArgument('value')); try { $output->page(CodeFormatter::format($reflector), ShellOutput::OUTPUT_RAW); } catch (RuntimeException $e) { $output->writeln(SignatureFormatter::format($reflector)); throw $e; } }
/** * @expectedException InvalidArgumentException */ public function testSignatureFormatterThrowsUnknownReflectorExpeption() { $refl = $this->getMock('Reflector'); SignatureFormatter::format($refl); }
protected function presentSignature($target) { // This might get weird if the signature is actually for a reflector. Hrm. if (!$target instanceof \Reflector) { $target = Mirror::get($target); } return SignatureFormatter::format($target); }