UserGroup   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSharedData() 0 9 2
A __construct() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Http\Controllers\Api;
6
7
use AbterPhp\Admin\Http\Controllers\ApiAbstract;
8
use AbterPhp\Admin\Service\Execute\UserGroup as RepoService;
9
use AbterPhp\Framework\Databases\Queries\FoundRows;
10
use Psr\Log\LoggerInterface;
11
12
class UserGroup extends ApiAbstract
13
{
14
    public const ENTITY_SINGULAR = 'userGroup';
15
    public const ENTITY_PLURAL   = 'userGroups';
16
17
    /**
18
     * UserGroup constructor.
19
     *
20
     * @param LoggerInterface $logger
21
     * @param RepoService     $repoService
22
     * @param FoundRows       $foundRows
23
     * @param string       $problemBaseUrl
24
     */
25
    public function __construct(
26
        LoggerInterface $logger,
27
        RepoService $repoService,
28
        FoundRows $foundRows,
29
        string $problemBaseUrl
30
    ) {
31
        parent::__construct($logger, $repoService, $foundRows, $problemBaseUrl);
32
    }
33
34
    /**
35
     * @return array
36
     */
37
    public function getSharedData(): array
38
    {
39
        $data = $this->request->getJsonBody();
40
41
        if (array_key_exists('password', $data)) {
42
            $data['password_repeated'] = $data['password'];
43
        }
44
45
        return $data;
46
    }
47
}
48