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

AdminTmuxController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 45
dl 0
loc 63
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A edit() 0 56 3
1
<?php
2
3
namespace App\Http\Controllers\Admin;
4
5
use App\Http\Controllers\BasePageController;
6
use App\Models\Settings;
7
use Illuminate\Http\Request;
8
9
class AdminTmuxController extends BasePageController
10
{
11
    /**
12
     * @param \Illuminate\Http\Request $request
13
     *
14
     * @throws \Exception
15
     */
16
    public function edit(Request $request)
17
    {
18
        $this->setAdminPrefs();
19
20
        // Set the current action.
21
        $action = $request->input('action') ?? 'view';
22
23
        switch ($action) {
24
            case 'submit':
25
                Settings::settingsUpdate($request->all());
26
                $meta_title = $title = 'Tmux Settings Edit';
27
                $this->smarty->assign('site', $this->settings);
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

27
                $this->smarty->/** @scrutinizer ignore-call */ 
28
                               assign('site', $this->settings);

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...
28
                break;
29
30
            case 'view':
31
            default:
32
                $meta_title = $title = 'Tmux Settings Edit';
33
                $this->smarty->assign('site', $this->settings);
34
                break;
35
        }
36
37
        $this->smarty->assign('yesno_ids', [1, 0]);
38
        $this->smarty->assign('yesno_names', ['yes', 'no']);
39
40
        $this->smarty->assign('backfill_ids', [0, 4, 1]);
41
        $this->smarty->assign('backfill_names', ['Disabled', 'Safe', 'All']);
42
        $this->smarty->assign('backfill_group_ids', [1, 2, 3, 4, 5, 6]);
43
        $this->smarty->assign('backfill_group', ['Newest', 'Oldest', 'Alphabetical', 'Alphabetical - Reverse', 'Most Posts', 'Fewest Posts']);
44
        $this->smarty->assign('backfill_days', ['Days per Group', 'Safe Backfill day']);
45
        $this->smarty->assign('backfill_days_ids', [1, 2]);
46
        $this->smarty->assign('dehash_ids', [0, 1]);
47
        $this->smarty->assign('dehash_names', ['Disabled', 'Enabled']);
48
        $this->smarty->assign('import_ids', [0, 1, 2]);
49
        $this->smarty->assign('import_names', ['Disabled', 'Import - Do Not Use Filenames', 'Import - Use Filenames']);
50
        $this->smarty->assign('releases_ids', [0, 1]);
51
        $this->smarty->assign('releases_names', ['Disabled', 'Update Releases']);
52
        $this->smarty->assign('post_ids', [0, 1, 2, 3]);
53
        $this->smarty->assign('post_names', ['Disabled', 'PostProcess Additional', 'PostProcess NFOs', 'All']);
54
        $this->smarty->assign('fix_crap_radio_ids', ['Disabled', 'All', 'Custom']);
55
        $this->smarty->assign('fix_crap_radio_names', ['Disabled', 'All', 'Custom']);
56
        $this->smarty->assign('fix_crap_check_ids', ['blacklist', 'blfiles', 'executable', 'gibberish', 'hashed', 'installbin', 'passworded', 'passwordurl', 'sample', 'scr', 'short', 'size', 'huge', 'nzb', 'codec']);
57
        $this->smarty->assign('fix_crap_check_names', ['blacklist', 'blfiles', 'executable', 'gibberish', 'hashed', 'installbin', 'passworded', 'passwordurl', 'sample', 'scr', 'short', 'size', 'huge', 'nzb', 'codec']);
58
        $this->smarty->assign('sequential_ids', [0, 1]);
59
        $this->smarty->assign('sequential_names', ['Disabled', 'Enabled']);
60
        $this->smarty->assign('binaries_ids', [0, 1]);
61
        $this->smarty->assign('binaries_names', ['Disabled', 'Enabled']);
62
        $this->smarty->assign('lookup_reqids_ids', [0, 1, 2]);
63
        $this->smarty->assign('lookup_reqids_names', ['Disabled', 'Lookup Request IDs', 'Lookup Request IDs Threaded']);
64
        $this->smarty->assign('predb_ids', [0, 1]);
65
        $this->smarty->assign('predb_names', ['Disabled', 'Enabled']);
66
67
        $content = $this->smarty->fetch('tmux-edit.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

67
        /** @scrutinizer ignore-call */ 
68
        $content = $this->smarty->fetch('tmux-edit.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...
68
69
        $this->smarty->assign(compact('title', 'meta_title', 'content'));
70
71
        $this->adminrender();
72
    }
73
}
74