Completed
Pull Request — master (#2)
by Mathieu
05:06 queued 01:16
created

App::isPrelive()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
namespace Suricate;
3
4
/**
5
 * App extension for Suricate
6
 *
7
 * @package Suricate
8
 * @author  Mathieu LESNIAK <[email protected]>
9
 *
10
 * @property string $root
11
 * @property string $mode
12
 * @property string $url
13
 * @property string $locale
14
 */
15
16
17
class App extends Service
18
{
19
    const DEBUG_MODE        = 'debug';
20
    const DEVELOPMENT_MODE  = 'development';
21
    const PRELIVE_MODE      = 'prelive';
22
    const PRODUCTION_MODE   = 'production';
23
24
    protected $parametersList   = [
25
        'root',
26
        'mode',
27
        'url',
28
        'locale',
29
        'path.app',
30
        'path.public',
31
        'path.base',
32
        'base_uri',
33
    ];
34
35 1
    public function isDebug()
36
    {
37 1
        return self::DEBUG_MODE == $this->mode;
38
    }
39
40 1
    public function isDevelopment()
41
    {
42 1
        return self::DEVELOPMENT_MODE == $this->mode;
43
    }
44
45 1
    public function isPrelive()
46
    {
47 1
        return self::PRELIVE_MODE == $this->mode;
48
    }
49
50 1
    public function isProduction()
51
    {
52 1
        return self::PRODUCTION_MODE == $this->mode;
53
    }
54
55
    public function inMaintenance()
56
    {
57
        return is_file($this->getParameter('path.app') . '/config/maintenance');
58
    }
59
60
    public function abort($httpCode, $message = '', $headers = [])
61
    {
62
        throw new Exception\HttpException($httpCode, $message, null, $headers);
63
    }
64
}
65