PageLayout::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
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\Website\Http\Controllers\Api;
6
7
use AbterPhp\Admin\Http\Controllers\ApiAbstract;
8
use AbterPhp\Framework\Config\EnvReader;
9
use AbterPhp\Framework\Databases\Queries\FoundRows;
10
use AbterPhp\Website\Service\Execute\PageLayout as RepoService;
11
use Psr\Log\LoggerInterface;
12
13
class PageLayout extends ApiAbstract
14
{
15
    const ENTITY_SINGULAR = 'pageLayout';
16
    const ENTITY_PLURAL   = 'pageLayouts';
17
18
    /**
19
     * PageLayout constructor.
20
     *
21
     * @param LoggerInterface $logger
22
     * @param RepoService     $repoService
23
     * @param FoundRows       $foundRows
24
     * @param EnvReader       $envReader
25
     */
26
    public function __construct(
27
        LoggerInterface $logger,
28
        RepoService $repoService,
29
        FoundRows $foundRows,
30
        EnvReader $envReader
31
    ) {
32
        parent::__construct($logger, $repoService, $foundRows, $envReader);
33
    }
34
35
    /**
36
     * @return array
37
     */
38
    public function getSharedData(): array
39
    {
40
        $data = $this->request->getJsonBody();
41
42
        $data['assets'] = !empty($data['assets']) ? $data['assets'] : [];
43
44
        $data = array_merge($data, $data['assets']);
45
46
        unset($data['assets']);
47
48
        return $data;
49
    }
50
}
51