Passed
Pull Request — master (#235)
by John
05:34
created

BabelController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A marketspace() 0 10 2
A index() 0 8 1
1
<?php
2
3
namespace App\Admin\Controllers;
4
5
use App\Http\Controllers\Controller;
6
use App\Models\Babel\ExtensionModel;
7
use Encore\Admin\Layout\Column;
8
use Encore\Admin\Layout\Content;
9
use Encore\Admin\Layout\Row;
10
use Illuminate\Support\Facades\Redirect;
11
12
class BabelController extends Controller
13
{
14
    /**
15
     * Show the Status Page.
16
     *
17
     * @return Response
0 ignored issues
show
Bug introduced by
The type App\Admin\Controllers\Response was not found. Did you mean Response? If so, make sure to prefix the type with \.
Loading history...
18
     */
19
    public function index(Content $content)
20
    {
21
        return $content
0 ignored issues
show
Bug Best Practice introduced by
The expression return $content->header(...ion(...) { /* ... */ }) returns the type Encore\Admin\Layout\Content which is incompatible with the documented return type App\Admin\Controllers\Response.
Loading history...
22
            ->header('Babel Marketspace')
23
            ->description('Download and Manage your Babel Extension')
24
            ->row(function(Row $row) {
25
                $row->column(12, function(Column $column) {
26
                    $column->append(Self::marketspace());
27
                });
28
            });
29
    }
30
31
    private static function marketspace()
32
    {
33
        $extensionList=ExtensionModel::list();
34
35
        if(empty($extensionList)){
36
            return redirect('/admin');
37
        }
38
39
        return view('admin::babel.marketspace', [
40
            'extensionList'=>$extensionList
41
        ]);
42
    }
43
}
44