Completed
Push — master ( f66149...a7372c )
by
unknown
130:24 queued 111:56
created

AbstractGridObject   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 41
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getBackendUser() 0 3 1
A getUniqueId() 0 3 1
A getLanguageService() 0 3 1
A __construct() 0 4 1
A getBackendLayout() 0 3 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace TYPO3\CMS\Backend\View\BackendLayout\Grid;
5
6
/*
7
 * This file is part of the TYPO3 CMS project.
8
 *
9
 * It is free software; you can redistribute it and/or modify it under
10
 * the terms of the GNU General Public License, either version 2
11
 * of the License, or any later version.
12
 *
13
 * For the full copyright and license information, please read the
14
 * LICENSE.txt file that was distributed with this source code.
15
 *
16
 * The TYPO3 project - inspiring people to share!
17
 */
18
19
use TYPO3\CMS\Backend\View\BackendLayout\BackendLayout;
20
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
21
use TYPO3\CMS\Core\Imaging\IconFactory;
22
use TYPO3\CMS\Core\Localization\LanguageService;
23
use TYPO3\CMS\Core\Utility\GeneralUtility;
24
use TYPO3\CMS\Core\Utility\StringUtility;
25
26
/**
27
 * Base class for objects which constitute a page layout grid.
28
 *
29
 * Contains shared properties and functions available to all such objects.
30
 *
31
 * @see Grid
32
 * @see GridRow
33
 * @see GridColumn
34
 * @see GridColumnItem
35
 * @see LanguageColumn
36
 */
37
abstract class AbstractGridObject
38
{
39
    /**
40
     * @var BackendLayout
41
     */
42
    protected $backendLayout;
43
44
    /**
45
     * @var IconFactory
46
     */
47
    protected $iconFactory;
48
49
    /**
50
     * @var string|null
51
     */
52
    protected $uniqueId;
53
54
    public function __construct(BackendLayout $backendLayout)
55
    {
56
        $this->backendLayout = $backendLayout;
57
        $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
58
    }
59
60
    public function getUniqueId(): string
61
    {
62
        return $this->uniqueId ?? $this->uniqueId = StringUtility::getUniqueId();
63
    }
64
65
    public function getBackendLayout(): BackendLayout
66
    {
67
        return $this->backendLayout;
68
    }
69
70
    protected function getLanguageService(): LanguageService
71
    {
72
        return $GLOBALS['LANG'];
73
    }
74
75
    protected function getBackendUser(): BackendUserAuthentication
76
    {
77
        return $GLOBALS['BE_USER'];
78
    }
79
}
80