BaseCommand::loadCSR()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 2
eloc 7
nc 2
nop 2
1
<?php
2
/**
3
 * @author     Chris Hilsdon <[email protected]>
4
 * @package    ComodoDecodeCSR
5
 * @copyright  2016 Xigen
6
 * @license    GNU General Public License v3
7
 * @link       https://github.com/XigenChris/ComodoDecodeCSR
8
 */
9
10
namespace Xigen\Console;
11
12
use Xigen\Application;
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\Console\Output\OutputInterface;
15
use Symfony\Component\Console\Command\Command;
16
17
abstract class BaseCommand extends Command
18
{
19
    /**
20
     * Load a .csr file via an CLI argument
21
     * @param  Symfony\Component\Console\Input\InputInterface $input
22
     * @param  Symfony\Component\Console\Output\OutputInterface $output
23
     * @return bool|void
24
     */
25
    public function loadCSR(InputInterface $input, OutputInterface $output)
26
    {
27
        $csrFile = $input->getArgument('csr');
28
        if (!file_exists($csrFile)) {
29
            $output->writeln('<error>Unable to load '. $csrFile .'</error>');
30
            $output->writeln('<error>Please check the path and try again</error>');
31
32
            exit();
33
        }
34
35
        return file_get_contents($csrFile);
36
    }
37
}
38