Passed
Push — master ( 7dc6f0...d3e7eb )
by Mahmoud
01:45
created

CustomRoutes   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A apiResource() 0 7 1
A authResoruce() 0 7 1
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 authResoruce($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