Completed
Push — master ( aa9657...bb9832 )
by Sebastian
05:21
created

ConfigHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 32
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setConfigFile() 0 4 1
A getConfigFile() 0 7 2
1
<?php
2
/**
3
 * This file is part of CaptainHook.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianFeldmann\CaptainHook\Console\Application;
11
12
use SebastianFeldmann\CaptainHook\Console\Application;
13
14
/**
15
 * Class ConfigHandler
16
 *
17
 * @package CaptainHook
18
 * @author  Sebastian Feldmann <[email protected]>
19
 * @link    https://github.com/sebastianfeldmann/captainhook
20
 * @since   Class available since Release 0.9.0
21
 */
22
abstract class ConfigHandler extends Application
23
{
24
    /**
25
     * Path to CaptainHook config file
26
     *
27
     * @var string
28
     */
29
    protected $configFile;
30
31
    /**
32
     * Set the configuration file to use.
33
     *
34
     * @param string $config
35
     */
36 3
    public function setConfigFile(string $config)
37
    {
38 3
        $this->configFile = $config;
39 3
    }
40
41
    /**
42
     * Get the configuration file to use.
43
     *
44
     * @return string
45
     */
46 2
    public function getConfigFile() : string
47
    {
48 2
        if (empty($this->configFile)) {
49 1
            $this->configFile = getcwd() . DIRECTORY_SEPARATOR . 'captainhook.json';
50
        }
51 2
        return $this->configFile;
52
    }
53
}
54