Passed
Push — master ( c9c889...62dfc0 )
by Mahmoud
02:08
created

CustomRoutes::authResoruce()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Lararoutes\Lumen;
4
5
class CustomRoutes
6
{
7
    protected $app;
8
      
9
    public function __construct($router='')
10
    {
11
      $this->app = $router;
12
    }
13
      
14
    function apiResource($uri, $controller)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
15
    {
16
      $this->app->get($uri, $controller.'@index');
17
      $this->app->post($uri, $controller.'@store');
18
      $this->app->get($uri.'/{id}', $controller.'@show');
19
      $this->app->put($uri.'/{id}', $controller.'@update');
20
      $this->app->delete($uri.'/{id}', $controller.'@destroy');
21
22
      // feel free to add more
23
    }
24
25
26
    function authResource($uri, $controller)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
    {
28
      $this->app->post($uri.'/register', $controller.'@register');
29
      $this->app->post($uri.'/login', $controller.'@login');
30
      $this->app->post($uri.'/logout', $controller.'@logout');
31
      $this->app->post($uri.'/refresh', $controller.'@refresh');
32
      $this->app->post($uri.'/me', $controller.'@me');
33
34
      // feel free to add more
35
    }
36
}
37