Passed
Push — master ( b34030...56c38f )
by Sebastian
03:50
created

ConfigHandler::setConfigFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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 2
    public function setConfigFile($config)
37
    {
38 2
        $this->configFile = $config;
39 2
    }
40
41
    /**
42
     * Get the configuration file to use.
43
     *
44
     * @return string
45
     */
46 3
    public function getConfigFile()
47
    {
48 3
        if (null === $this->configFile) {
49 1
            $this->configFile = getcwd() . DIRECTORY_SEPARATOR . 'captainhook.json';
50
        }
51 3
        return $this->configFile;
52
    }
53
}
54