/** * {@inheritdoc} * * @throws \RuntimeException When url was given instead of path. */ protected function initialize(InputInterface $input, OutputInterface $output) { $this->_rawPath = null; $output->getFormatter()->setStyle('debug', new OutputFormatterStyle('white', 'magenta')); parent::initialize($input, $output); // Only apply check for commands, that accept working copy path. if ($input->hasArgument('path')) { if (!$this->pathAcceptsUrl && $this->repositoryConnector->isUrl($this->getRawPath())) { throw new \RuntimeException('The "path" argument must be a working copy path and not URL.'); } } }
/** * Return working copy path. * * @return string * @throws \RuntimeException When url was given instead of path. */ protected function getPath() { $path = $this->io->getArgument('path'); if (!$this->repositoryConnector->isUrl($path)) { $path = realpath($path); } elseif (!$this->pathAcceptsUrl) { throw new \RuntimeException('The "path" argument must be a working copy path and not URL.'); } return $path; }