Passed
Push — master ( e28a27...ade361 )
by Gabor
22:04 queued 18:53
created

ListAction::getUserGroupList()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 0
dl 0
loc 21
rs 9.9666
c 0
b 0
f 0
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 7.1
6
 *
7
 * @copyright 2012 - 2018 Gixx-web (http://www.gixx-web.com)
8
 * @license   https://opensource.org/licenses/MIT The MIT License (MIT)
9
 *
10
 * @link http://www.gixx-web.com
11
 */
12
declare(strict_types = 1);
13
14
namespace WebHemi\Middleware\Action\Admin\ControlPanel\Groups;
15
16
use WebHemi\Configuration\ServiceInterface as ConfigurationInterface;
17
use WebHemi\Data\Entity\UserGroupEntity;
18
use WebHemi\Data\Storage\UserStorage;
19
use WebHemi\Environment\ServiceInterface as EnvironmentInterface;
20
use WebHemi\Middleware\Action\AbstractMiddlewareAction;
21
22
/**
23
 * Class ListAction
24
 */
25
class ListAction extends AbstractMiddlewareAction
26
{
27
    /**
28
     * @var ConfigurationInterface
29
     */
30
    protected $configuration;
31
    /**
32
     * @var EnvironmentInterface
33
     */
34
    protected $environmentManager;
35
    /**
36
     * @var UserStorage
37
     */
38
    protected $userStorage;
39
40
    /**
41
     * GroupManagementAction constructor.
42
     *
43
     * @param ConfigurationInterface $configuration
44
     * @param EnvironmentInterface   $environmentManager
45
     * @param UserStorage            $userStorage
46
     */
47
    public function __construct(
48
        ConfigurationInterface $configuration,
49
        EnvironmentInterface $environmentManager,
50
        UserStorage $userStorage
51
    ) {
52
        $this->configuration = $configuration;
53
        $this->environmentManager = $environmentManager;
54
        $this->userStorage = $userStorage;
55
    }
56
57
    /**
58
     * Gets template map name or template file path.
59
     *
60
     * @return string
61
     */
62
    public function getTemplateName() : string
63
    {
64
        return 'admin-control-panel-groups-list';
65
    }
66
67
    /**
68
     * Gets template data.
69
     *
70
     * @return array
71
     */
72
    public function getTemplateData() : array
73
    {
74
        return [
75
            'data' => $this->userStorage->getUserGroupList()
76
        ];
77
    }
78
}
79