isOnlineDocumentationEnabled()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

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