Application::getConfig()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 3
nc 4
nop 2
crap 12
1
<?php
2
3
namespace App;
4
5
class Application extends \Philae\Application
6
{
7
    const SERVICE_CONFIG      = 'config';
8
    const SERVICE_ENVIRONMENT = 'environment';
9
10
    public function getEnvironment()
11
    {
12
        return $this->get(self::SERVICE_ENVIRONMENT);
13
    }
14
15
    /**
16
     * @param string|null $key
17
     * @param mixed|null $default
18
     *
19
     * @return mixed
20
     */
21
    public function getConfig($key = null, $default = null)
22
    {
23
        $config = $this->get(self::SERVICE_CONFIG);
24
25
        return (func_num_args() == 0) ? $config : (isset($config[$key]) ? $config[$key] : $default);
26
    }
27
}
28