Passed
Push — master ( 588318...10921e )
by Pierre
02:55
created

Metro::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Controllers\Api\V1;
4
5
use Nymfonya\Component\Container;
6
use Nymfonya\Component\Http\Response;
7
use App\Interfaces\Controllers\IApi;
8
use App\Reuse\Controllers\AbstractApi;
9
use App\Model\Repository\Metro\Lines;
10
use App\Model\Repository\Metro\Stations;
11
12
final class Metro extends AbstractApi implements IApi
13
{
14
15
    /**
16
     * instanciate
17
     *
18
     * @param Container $container
19
     */
20 1
    public function __construct(Container $container)
21
    {
22 1
        parent::__construct($container);
23
    }
24
25
    /**
26
     * jwtaction
27
     *
28
     * @return Test
29
     */
30
    final public function lines(): Metro
31
    {
32
        $this->response->setCode(Response::HTTP_OK)->setContent([
33
            Response::_ERROR => false,
34
            Response::_ERROR_MSG => 'Jwt auth succeeded',
35
            'datas' => [
36
                'user' => $this->request->getSession('auth', 'user')
37
            ]
38
        ]);
39
        return $this;
40
    }
41
42
    /**
43
     * upload with jwt bearer
44
     *
45
     * @return Test
46
     */
47
    final public function stations(): Metro
48
    {
49
        $appPath = dirname(dirname($this->request->getFilename()));
50
        $uploader = new Uploader();
0 ignored issues
show
Bug introduced by
The type App\Controllers\Api\V1\Uploader 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...
51
        $uploader
52
            ->setTargetPath($appPath . '/assets/upload/')
53
            ->process();
54
        $resCodeError = $uploader->isError()
55
            ? Response::HTTP_INTERNAL_SERVER_ERROR
56
            : Response::HTTP_OK;
57
        $this->response->setCode($resCodeError)->setContent(
58
            $uploader->getInfos()
59
        );
60
        unset($uploader);
61
        return $this;
62
    }
63
}
64