Passed
Push — dev ( c55b95...34fb50 )
by Darko
06:54
created

AdminCommentsController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 11
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A destroy() 0 7 2
A index() 0 12 1
1
<?php
2
3
namespace App\Http\Controllers\Admin;
4
5
use App\Http\Controllers\BasePageController;
6
use App\Models\ReleaseComment;
7
8
class AdminCommentsController extends BasePageController
9
{
10
    /**
11
     * @throws \Exception
12
     */
13
    public function index()
14
    {
15
        $this->setAdminPrefs();
16
17
        $meta_title = $title = 'Comments List';
18
19
        $commentsList = ReleaseComment::getCommentsRange();
20
        $this->smarty->assign('commentslist', $commentsList);
0 ignored issues
show
Bug introduced by
The method assign() does not exist on Illuminate\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $this->smarty->/** @scrutinizer ignore-call */ 
21
                       assign('commentslist', $commentsList);

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...
21
22
        $content = $this->smarty->fetch('comments-list.tpl');
0 ignored issues
show
Bug introduced by
The method fetch() does not exist on Illuminate\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        /** @scrutinizer ignore-call */ 
23
        $content = $this->smarty->fetch('comments-list.tpl');

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...
23
        $this->smarty->assign(compact('title', 'meta_title', 'content'));
24
        $this->adminrender();
25
    }
26
27
    /**
28
     * @param $id
29
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
30
     */
31
    public function destroy($id)
32
    {
33
        if ($id) {
34
            ReleaseComment::deleteComment($id);
35
        }
36
37
        return redirect()->back();
38
    }
39
}
40