Passed
Pull Request — master (#17)
by ARCANEDEV
05:21
created

MediaRoutes::mapApiRoutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 26
rs 9.7
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Arcanesoft\Media\Http\Routes;
4
5
use Arcanesoft\Foundation\Support\Http\AdminRouteRegistrar;
6
use Arcanesoft\Media\Http\Controllers\{MediaApiController, MediaController};
7
8
/**
9
 * Class     MediaRoutes
10
 *
11
 * @package  Arcanesoft\Media\Http\Routes
12
 * @author   ARCANEDEV <[email protected]>
13
 */
14
class MediaRoutes extends AdminRouteRegistrar
15
{
16
    /* -----------------------------------------------------------------
17
     |  Main Methods
18
     | -----------------------------------------------------------------
19
     */
20
21
    /**
22
     * Map the routes.
23
     */
24
    public function map(): void
25
    {
26
        $this->adminGroup(function () {
27
            $this->prefix('media')->name('media.')->group(function () {
0 ignored issues
show
Bug introduced by
The method prefix() does not exist on Arcanesoft\Media\Http\Routes\MediaRoutes. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
            $this->/** @scrutinizer ignore-call */ 
28
                   prefix('media')->name('media.')->group(function () {
Loading history...
28
                $this->get('/', [MediaController::class, 'index'])
0 ignored issues
show
Bug introduced by
The method get() does not exist on Arcanesoft\Media\Http\Routes\MediaRoutes. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
                $this->/** @scrutinizer ignore-call */ 
29
                       get('/', [MediaController::class, 'index'])
Loading history...
29
                     ->name('index'); // admin::media.index
30
31
                $this->mapApiRoutes();
32
            });
33
        });
34
    }
35
36
    /**
37
     * Map Media API Routes.
38
     */
39
    private function mapApiRoutes(): void
40
    {
41
        $this->prefix('api')->name('api.')->middleware(['ajax'])->group(function () {
42
            $this->get('items', [MediaApiController::class, 'all'])
43
                 ->name('items.index'); // admin::media.api.items.index
44
45
            $this->get('directories', [MediaApiController::class, 'directories'])
46
                 ->name('directories.index'); // admin::media.api.directories.index
47
48
            $this->post('upload', [MediaApiController::class, 'upload'])
0 ignored issues
show
Bug introduced by
The method post() does not exist on Arcanesoft\Media\Http\Routes\MediaRoutes. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
            $this->/** @scrutinizer ignore-call */ 
49
                   post('upload', [MediaApiController::class, 'upload'])
Loading history...
49
                 ->name('upload'); // admin::media.api.upload
50
51
            $this->post('new-folder', [MediaApiController::class, 'newFolder'])
52
                 ->name('new-folder'); // admin::media.api.new-folder
53
54
            $this->put('move', [MediaApiController::class, 'move'])
0 ignored issues
show
Bug introduced by
The method put() does not exist on Arcanesoft\Media\Http\Routes\MediaRoutes. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

54
            $this->/** @scrutinizer ignore-call */ 
55
                   put('move', [MediaApiController::class, 'move'])
Loading history...
55
                 ->name('move'); // admin::media.api.move
56
57
            $this->put('rename', [MediaApiController::class, 'rename'])
58
                 ->name('rename'); // admin::media.api.rename
59
60
            $this->delete('delete', [MediaApiController::class, 'delete'])
0 ignored issues
show
Bug introduced by
The method delete() does not exist on Arcanesoft\Media\Http\Routes\MediaRoutes. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

60
            $this->/** @scrutinizer ignore-call */ 
61
                   delete('delete', [MediaApiController::class, 'delete'])
Loading history...
61
                 ->name('delete'); // admin::media.api.delete
62
63
            $this->get('download', [MediaApiController::class, 'download'])
64
                 ->name('download'); // admin::media.api.delete
65
        });
66
    }
67
}
68