Passed
Push — master ( d7e8d7...5cd27e )
by
unknown
26:58 queued 24:20
created

ConfigReader::getBasePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Da\Mailer\Helper;
4
5
use Exception;
6
7
class ConfigReader
8
{
9
    /**
10
     * @return array
11
     * @throws Exception
12
     */
13
    public static function get(): array
14
    {
15
        $configPath = require self::getBasePath() . 'config/mailer.php';
16
17
        if (! is_array($configPath)) {
18
            throw new Exception('The configuration format is invalid. It must be an array!');
19
        }
20
21
        return $configPath;
22
    }
23
24
    /**
25
     * @return string
26
     */
27
    public static function getBasePath(): string
28
    {
29
        return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
30
    }
31
}
32