Passed
Branch main (9d0fba)
by AOEPeople
14:13 queued 03:16
created

getPathOfOnlineDocumentation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
namespace Aoe\Restler\Configuration;
3
4
/***************************************************************
5
 *  Copyright notice
6
 *
7
 *  (c) 2015 AOE GmbH <[email protected]>
8
 *
9
 *  All rights reserved
10
 *
11
 *  This script is part of the TYPO3 project. The TYPO3 project is
12
 *  free software; you can redistribute it and/or modify
13
 *  it under the terms of the GNU General Public License as published by
14
 *  the Free Software Foundation; either version 3 of the License, or
15
 *  (at your option) any later version.
16
 *
17
 *  The GNU General Public License can be found at
18
 *  http://www.gnu.org/copyleft/gpl.html.
19
 *
20
 *  This script is distributed in the hope that it will be useful,
21
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 *  GNU General Public License for more details.
24
 *
25
 *  This copyright notice MUST APPEAR in all copies of the script!
26
 ***************************************************************/
27
28
use TYPO3\CMS\Core\SingletonInterface;
29
use TYPO3\CMS\Core\Utility\GeneralUtility;
30
31
/**
32
 * @package Restler
33
 */
34
class ExtensionConfiguration implements SingletonInterface
35
{
36
    /**
37
     * @var array
38
     */
39
    private $configuration;
40
41
    /**
42
     * constructor - loading the current localconf configuration for restler extension
43
     *
44
     */
45
    public function __construct()
46
    {
47
        if(class_exists('\TYPO3\CMS\Core\Configuration\ExtensionConfiguration')) {
48
            $this->configuration = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class)->get('restler');
49
        } else {
50
            $this->configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['restler']);
51
        }
52
    }
53
54
    /**
55
     * @return boolean
56
     */
57
    public function isCacheRefreshingEnabled()
58
    {
59
        return (boolean)$this->get('refreshCache');
60
    }
61
62
    /**
63
     * @return boolean
64
     */
65
    public function isProductionContextSet()
66
    {
67
        return (boolean)$this->get('productionContext');
68
    }
69
70
    /**
71
     * @return boolean
72
     */
73
    public function isOnlineDocumentationEnabled()
74
    {
75
        return (boolean)$this->get('enableOnlineDocumentation');
76
    }
77
78
    /**
79
     * @return string
80
     */
81
    public function getPathOfOnlineDocumentation()
82
    {
83
        return $this->get('pathToOnlineDocumentation');
84
    }
85
86
    /**
87
     * returns configuration value for the given key
88
     *
89
     * @param string $key
90
     * @return string depending on configuration key
91
     */
92
    private function get($key)
93
    {
94
        return $this->configuration[$key];
95
    }
96
}
97