PluginController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 4
c 3
b 0
f 1
lcom 0
cbo 1
dl 0
loc 32
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A plugins() 0 5 1
A install() 0 8 1
A uninstall() 0 8 1
A getPluginSlug() 0 3 1
1
<?php namespace Mascame\Artificer\Http\Controllers;
2
3
use App;
4
use Mascame\Arrayer\Builder;
5
use Mascame\Artificer\Options\AdminOption;
6
use Redirect;
7
use View;
8
9
class PluginController extends BaseController
10
{
11
12
    public function plugins()
13
    {
14
        return View::make($this->getView('plugins'))
15
            ->with('plugins', App::make('ArtificerPluginManager')->getAll());
16
    }
17
18
    public function install($plugin)
19
    {
20
        $plugin = $this->getPluginSlug($plugin);
21
22
        App::make('ArtificerPluginManager')->installer()->install($plugin);
23
24
        return \Redirect::route('admin.plugins');
0 ignored issues
show
Bug introduced by
The method route() does not seem to exist on object<redirect>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
    }
26
27
    public function uninstall($plugin)
28
    {
29
        $plugin = $this->getPluginSlug($plugin);
30
31
        App::make('ArtificerPluginManager')->installer()->uninstall($plugin);
32
33
        return \Redirect::route('admin.plugins');
0 ignored issues
show
Bug introduced by
The method route() does not seem to exist on object<redirect>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
    }
35
36
    protected function getPluginSlug($plugin) {
37
        return \App::make('ArtificerPluginManager')->getFromSlug($plugin)->namespace;
38
    }
39
40
}