LocalizedResourceRegistrar   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 47
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addResourceCreate() 0 8 1
A addResourceEdit() 0 8 1
1
<?php namespace App\Services\Routing;
2
3
use Illuminate\Routing\ResourceRegistrar;
4
5
class LocalizedResourceRegistrar extends ResourceRegistrar
6
{
7
    /**
8
     * The default actions for a resourceful controller.
9
     *
10
     * @var array
11
     */
12
    protected $resourceDefaults = ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy'];
13
14
    /**
15
     * Add the create method for a resourceful route.
16
     *
17
     * @param  string $name
18
     * @param  string $base
19
     * @param  string $controller
20
     * @param  array  $options
21
     *
22
     * @return \Illuminate\Routing\Route
23
     */
24 19
    protected function addResourceCreate($name, $base, $controller, $options)
25
    {
26 19
        $uri = $this->getResourceUri($name) . '/' . app('translator')->get('routes..resources.create');
27
28 19
        $action = $this->getResourceAction($name, $controller, 'create', $options);
29
30 19
        return $this->router->get($uri, $action);
31
    }
32
33
    /**
34
     * Add the edit method for a resourceful route.
35
     *
36
     * @param  string $name
37
     * @param  string $base
38
     * @param  string $controller
39
     * @param  array  $options
40
     *
41
     * @return \Illuminate\Routing\Route
42
     */
43
    protected function addResourceEdit($name, $base, $controller, $options)
44
    {
45
        $uri = $this->getResourceUri($name) . '/{' . $base . '}/' . app('translator')->get('routes..resources.edit');
46
47
        $action = $this->getResourceAction($name, $controller, 'edit', $options);
48
49
        return $this->router->get($uri, $action);
50
    }
51
}
52