Failed Conditions
Pull Request — master (#321)
by Anton
23:35 queued 08:33
created

application/modules/api/controllers/users.php (2 issues)

Labels
Severity
1
<?php
2
/**
3
 * View User Profile
4
 *
5
 * @author   Anton Shevchuk
6
 * @created  01.09.11 13:15
7
 */
8
9
namespace Application;
10
11
use Application\Users;
12
use Bluz\Controller\Controller;
0 ignored issues
show
The type Bluz\Controller\Controller 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...
13
use Bluz\Http\Exception\NotFoundException;
0 ignored issues
show
The type Bluz\Http\Exception\NotFoundException 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...
14
15
/**
16
 * @OA\Get(
17
 *   path="/api/users/{id}",
18
 *   tags={"users"},
19
 *   operationId="profileById",
20
 *   summary="Get profile by user id",
21
 *   security={
22
 *     {"api_key": {}}
23
 *   },
24
 *   @OA\Parameter(
25
 *     name="id",
26
 *     in="path",
27
 *     required=true,
28
 *     description="User UID",
29
 *     @OA\Schema(type="integer")
30
 *   ),
31
 *   @OA\Response(@OA\JsonContent(ref="#/components/schemas/user"), response=200, description="Given user found"),
32
 *   @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=403, description="Forbidden"),
33
 *   @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=404, description="User not found")
34
 * )
35
 *
36
 * @accept JSON
37
 * @method GET
38
 * @privilege Users/Id
39
 * @route  /api/users/{$id}
40
 * @param integer $id
41
 */
42
return function ($id) {
43
    /**
44
     * @var Controller $this
45
     */
46
    $user = Users\Table::findRow($id);
47
    if (!$user) {
48
        throw new NotFoundException('User not found' . $id);
49
    }
50
    $this->getData()->setFromArray($user->toArray());
51
};
52