FileCategory::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Files\Http\Controllers\Api;
6
7
use AbterPhp\Admin\Http\Controllers\ApiAbstract;
8
use AbterPhp\Files\Service\Execute\FileCategory as RepoService;
9
use AbterPhp\Framework\Config\EnvReader;
10
use AbterPhp\Framework\Databases\Queries\FoundRows;
11
use Psr\Log\LoggerInterface;
12
13
class FileCategory extends ApiAbstract
14
{
15
    const ENTITY_SINGULAR = 'fileCategory';
16
    const ENTITY_PLURAL   = 'fileCategories';
17
18
    /** @var RepoService */
19
    protected $repoService;
20
21
    /**
22
     * FileCategory constructor.
23
     *
24
     * @param LoggerInterface $logger
25
     * @param RepoService     $repoService
26
     * @param FoundRows       $foundRows
27
     * @param EnvReader       $envReader
28
     */
29
    public function __construct(
30
        LoggerInterface $logger,
31
        RepoService $repoService,
32
        FoundRows $foundRows,
33
        EnvReader $envReader
34
    ) {
35
        parent::__construct($logger, $repoService, $foundRows, $envReader);
36
    }
37
38
    /**
39
     * @return array
40
     */
41
    public function getSharedData(): array
42
    {
43
        $data = $this->request->getJsonBody();
44
45
        if (array_key_exists('password', $data)) {
46
            $data['password_repeated'] = $data['password'];
47
        }
48
49
        return $data;
50
    }
51
}
52