ForgePublishRCParser   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 54
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A parse() 0 4 1
A getDomainSuffix() 0 7 2
A getDefaultShell() 0 7 2
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