ObjectUtility::getObjectManager()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Gilbertsoft\Lib\Utility;
3
4
/*
5
 * This file is part of the "GS Library" Extension for TYPO3 CMS.
6
 *
7
 * Copyright (C) 2017 by Gilbertsoft (gilbertsoft.org)
8
 *
9
 * This program is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU General Public License as published by
11
 * the Free Software Foundation, either version 3 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * For the full license information, please read the LICENSE file that
20
 * was distributed with this source code.
21
 *
22
 * The TYPO3 project - inspiring people to share!
23
 */
24
25
/**
26
 * Use declarations
27
 */
28
use TYPO3\CMS\Core\Utility\GeneralUtility;
29
30
/**
31
 * Utility class to get objects.
32
 *
33
 * As certain objects (e.g. objectManager) are only injected
34
 * and present in certain places (e.g. controllers), this class
35
 * makes it simpler to get them in various places.
36
 */
37
class ObjectUtility
38
{
39
    /**
40
     * Get Object Manager instance.
41
     *
42
     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
43
     */
44
    public static function getObjectManager()
45
    {
46
        return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
47
    }
48
49
    /**
50
     * Get Configuration Manager instance.
51
     *
52
     * @return \TYPO3\CMS\Extbase\Configuration\ConfigurationManager
53
     */
54
    public static function getConfigurationManager()
55
    {
56
        return self::getObjectManager()->get(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
57
    }
58
59
    /**
60
     * Get Typoscript Service instance.
61
     *
62
     * @return \TYPO3\CMS\Extbase\Service\TyposcriptService
63
     */
64
    public static function getTyposcriptService()
65
    {
66
        return self::getObjectManager()->get(\TYPO3\CMS\Extbase\Service\TyposcriptService::class);
67
    }
68
69
    /**
70
     * Get Flex Form Service instance.
71
     *
72
     * @return \TYPO3\CMS\Core\Service\FlexFormService
73
     */
74
    public static function getFlexFormService()
75
    {
76
        return self::getObjectManager()->get(\TYPO3\CMS\Core\Service\FlexFormService::class);
77
    }
78
79
    /**
80
     * Get Configuration Utility instance.
81
     *
82
     * @return \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility
83
     */
84
    public static function getConfigurationUtility()
85
    {
86
        return self::getObjectManager()->get(\TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility::class);
87
    }
88
}
89