Passed
Push — typo3v9 ( 2404ee...b9b5fa )
by Tomas Norre
05:51
created

getExtensionConfiguration()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.3332

Importance

Changes 0
Metric Value
cc 3
eloc 6
c 0
b 0
f 0
nc 3
nop 0
dl 0
loc 8
ccs 4
cts 6
cp 0.6667
crap 3.3332
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AOE\Crawler\Configuration;
6
7
 /*
8
 * (c) 2020 AOE GmbH <[email protected]>
9
 *
10
 * This file is part of the TYPO3 Crawler Extension.
11
 *
12
 * It is free software; you can redistribute it and/or modify it under
13
 * the terms of the GNU General Public License, either version 2
14
 * of the License, or any later version.
15
 *
16
 * For the full copyright and license information, please read the
17
 * LICENSE.txt file that was distributed with this source code.
18
 *
19
 * The TYPO3 project - inspiring people to share!
20
 */
21
22
use Psr\Log\LoggerAwareInterface;
23
use Psr\Log\LoggerAwareTrait;
24
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
25
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
26
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
27
use TYPO3\CMS\Core\Utility\GeneralUtility;
28
29
class ExtensionConfigurationProvider implements LoggerAwareInterface
30
{
31
    use LoggerAwareTrait;
32
33
    /**
34
     * Return full extension configuration array.
35
     *
36
     * @return array $extensionConfiguration
37
     */
38 58
    public function getExtensionConfiguration()
39
    {
40
        try {
41 58
            return GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('crawler');
42 1
        } catch (ExtensionConfigurationExtensionNotConfiguredException $e) {
43 1
            $this->logger->error($e->getMessage());
44
        } catch (ExtensionConfigurationPathDoesNotExistException $e) {
45
            $this->logger->error($e->getMessage());
46
        }
47 1
    }
48
}
49