/** * JiraConfig constructor. * * @param string $filename * @param bool $eager */ public function __construct($filename, $eager = false) { $crypt = Container::getInstance()->get('crypt'); $this->addMutators('jiraPassword', function ($val) use($crypt) { return $crypt->encrypt($val); }); $this->addAccessor('jiraPassword', function ($val) use($crypt) { return $crypt->decrypt($val); }); parent::__construct($filename, $eager); }
protected function execute(InputInterface $input, OutputInterface $output) { $this->setInputOutput($input, $output); $this->config = Config::factory($this->provider, true); $this->boot(); $this->output->writeln(PHP_EOL); $this->startProgress(null); $this->ensureConfigExists(); $this->setProgressMessage('Creating "' . $this->provider . '" provider instance.'); $this->providerInstance = $this->createProvider($this->config, $this->options); $this->advanceProgress(); $this->setProgressMessage('Sending data..'); // Call actual command handler $this->setResponse($this->handle($input, $output)); $this->advanceProgress(); $this->setProgressMessage('[' . $this->provider . '] ' . $this->getResponse()->getMessage()); $this->finishProgress(); }
protected function execute(InputInterface $input, OutputInterface $output) { $provider = $input->getArgument('provider'); $baseDir = $_SERVER['HOME'] . DIRECTORY_SEPARATOR . '.slackpipe'; if (!is_dir($_SERVER['HOME'] . DIRECTORY_SEPARATOR . '.slackpipe')) { mkdir($baseDir); } $config = Config::factory($provider); // Custom Handler if ($class = Asserts::hasCustomSetup($provider)) { $command = new $class($this, $config); $command->handle($input, $output); } else { $helper = $this->getHelper('question'); $question = new Question('Please enter your token: ', false); $token = $helper->ask($input, $output, $question); if ($config->write(['token' => $token]) !== false) { $output->writeln('Token written to file: ' . $config->filePath()); } else { $output->writeln('Nothing written..'); } } }
/** * JiraConfig constructor. * * @param string $filename */ public function __construct($filename = '') { parent::__construct(); }