/** * * {@inheritdoc} * * @throws InvalidArgumentException if there is no exception to throw. * @throws ThrowUpException because what else do you expect it to do? */ protected function execute(InputInterface $input, OutputInterface $output) { if ($name = $input->getArgument('exception')) { $orig = $this->context->get(preg_replace('/^\\$/', '', $name)); } else { $orig = $this->context->getLastException(); } if (!$orig instanceof \Exception) { throw new \InvalidArgumentException('throw-up can only throw Exceptions'); } throw new ThrowUpException($orig); }
/** * Get a variable from the current shell scope. * * @param string $name * * @return mixed */ protected function getScopeVariable($name) { return $this->context->get($name); }
/** * Get a Context variable by name. * * @param $var Variable * name * * @return mixed */ protected function getVariable($var) { return $this->context->get($var); }