-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from XigenChris/develop
Merge develop changes into master
- Loading branch information
Showing
16 changed files
with
549 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* @author Chris Hilsdon <[email protected]> | ||
* @package ComodoDecodeCSR | ||
* @copyright 2016 Xigen | ||
* @license GNU General Public License v3 | ||
* @link https://github.com/XigenChris/ComodoDecodeCSR | ||
*/ | ||
|
||
namespace Xigen\Console; | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Xigen\ComodoDecodeCSR; | ||
use Xigen\Exception; | ||
|
||
class CreateFile extends BaseCommand | ||
{ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName("createfile") | ||
->setDescription("Creates the file needed for DVC") | ||
->addArgument( | ||
'csr', | ||
InputArgument::REQUIRED, | ||
'Location of csr file' | ||
) | ||
; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$comodoDecodeCSR = new ComodoDecodeCSR(); | ||
|
||
try { | ||
$comodoDecodeCSR->setCSR($this->loadCSR($input, $output)); | ||
} catch (Exception $e) { | ||
$output->writeln('<error>Error!</error>'); | ||
$output->writeln('Invalid CSR'); | ||
|
||
return 3; | ||
} | ||
|
||
$hashes = $comodoDecodeCSR->fetchHashes(); | ||
|
||
if (!$hashes) { | ||
$output->writeln('<error>Fail!</error>'); | ||
$output->writeln('Unable to fetch hashes'); | ||
|
||
return 2; | ||
} | ||
|
||
$output->writeln('<info>Filename:</info> ' . $hashes['md5'] . '.txt'); | ||
$output->writeln('<info>Contents:</info>'); | ||
$output->writeln($comodoDecodeCSR->generateDVC()); | ||
$output->writeln('<info>URL:</info> http://' . $comodoDecodeCSR->getCN() . '/' . $hashes['md5'] . '.txt'); | ||
|
||
return 0; | ||
} | ||
} |
Oops, something went wrong.