Passed
Push — master ( 1d30f9...202808 )
by Peter
04:48
created

User   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getSharedData() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Http\Controllers\Api;
6
7
use AbterPhp\Admin\Service\Execute\User as RepoService;
8
use AbterPhp\Framework\Http\Controllers\Admin\ApiAbstract;
0 ignored issues
show
Bug introduced by
The type AbterPhp\Framework\Http\...llers\Admin\ApiAbstract was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Opulence\Http\Responses\Response;
10
use Opulence\Routing\Controller;
11
use Psr\Log\LoggerInterface;
12
13
class User extends ApiAbstract
14
{
15
    const ENTITY_SINGULAR = 'user';
16
    const ENTITY_PLURAL   = 'users';
17
18
    /**
19
     * User constructor.
20
     *
21
     * @param LoggerInterface $logger
22
     * @param RepoService     $repoService
23
     */
24
    public function __construct(LoggerInterface $logger, RepoService $repoService)
25
    {
26
        parent::__construct($logger, $repoService);
27
    }
28
29
    /**
30
     * @return array
31
     */
32
    public function getSharedData(): array
33
    {
34
        $data = $this->request->getJsonBody();
35
36
        if (array_key_exists('password', $data)) {
37
            $data['password_repeated'] = $data['password'];
38
        }
39
40
        return $data;
41
    }
42
}
43