ForgePublishRCParser::parse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Acacha\ForgePublish\Parser;
4
5
/**
6
 * Class LlumRCParser.
7
 *
8
 * @package Acacha\Llum\Parser
9
 */
10
use Acacha\ForgePublish\ForgePublishRCFile;
11
12
/**
13
 * Class LlumRCParser
14
 * @package Acacha\Llum\Parser
15
 */
16
class ForgePublishRCParser
17
{
18
    /**
19
     * File to parse.
20
     *
21
     * @var
22
     */
23
    protected $file;
24
25
    /**
26
     * LlumRCParser constructor.
27
     * @param $file
28
     */
29
    public function __construct(ForgePublishRCFile $file)
30
    {
31
        $this->file = $file;
32
    }
33
34
    /**
35
     * Parse llumrc file.
36
     *
37
     * @return array
38
     */
39
    public function parse()
40
    {
41
        return parse_ini_file($this->file::path());
42
    }
43
44
    /**
45
     * Get domain suffix from config file.
46
     *
47
     * @return String
48
     */
49
    public function getDomainSuffix()
50
    {
51
        $rc_file = $this->parse();
52
        if (array_key_exists('domain_suffix', $rc_file)) {
53
            return $rc_file['domain_suffix'];
54
        }
55
    }
56
57
    /**
58
     * Get default shell from config file.
59
     *
60
     * @return String
61
     */
62
    public function getDefaultShell()
63
    {
64
        $rc_file = $this->parse();
65
        if (array_key_exists('ssh_shell', $rc_file)) {
66
            return $rc_file['ssh_shell'];
67
        }
68
    }
69
}
70