doForceInfo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Violet88\BugsnagModule;
4
5
use Psr\Log\LoggerInterface;
6
use RuntimeException;
7
use SilverStripe\Admin\CMSMenu;
8
use SilverStripe\Admin\LeftAndMain;
9
use SilverStripe\Control\Controller;
10
use SilverStripe\Core\Injector\Injector;
11
use SilverStripe\SiteConfig\SiteConfig;
12
13
class BugsnagSiteConfigExtension_Controller extends LeftAndMain {
14
  private static $url_segment = 'admin/settings/bugsnag';
0 ignored issues
show
introduced by
The private property $url_segment is not used, and could be removed.
Loading history...
15
  private static $menu_title = 'Bugsnag';
0 ignored issues
show
introduced by
The private property $menu_title is not used, and could be removed.
Loading history...
16
17
  private static $allowed_actions = [
0 ignored issues
show
introduced by
The private property $allowed_actions is not used, and could be removed.
Loading history...
18
    'doForceError',
19
    'doForceWarning',
20
    'doForceInfo',
21
  ];
22
23
  public function init() {
24
    parent::init();
25
26
    CMSMenu::remove_menu_item('Violet88-BugsnagModule-BugsnagSiteConfigExtension_Controller');
27
  }
28
29
  public function doForceError($request) {
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

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

29
  public function doForceError(/** @scrutinizer ignore-unused */ $request) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    $bugsnag = Injector::inst()->get(Bugsnag::class);
31
    $bugsnag->sendException(new RuntimeException("Force BugSnag error"), 'error');
32
33
    return $this->redirect('/admin/settings#Root_Bugsnag');
34
  }
35
36
  public function doForceWarning($request) {
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

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

36
  public function doForceWarning(/** @scrutinizer ignore-unused */ $request) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    $bugsnag = Injector::inst()->get(Bugsnag::class);
38
    $bugsnag->sendException(new RuntimeException("Force BugSnag warning"), 'warning');
39
40
    return $this->redirect('/admin/settings#Root_Bugsnag');
41
  }
42
43
  public function doForceInfo($request) {
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

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

43
  public function doForceInfo(/** @scrutinizer ignore-unused */ $request) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
44
    $bugsnag = Injector::inst()->get(Bugsnag::class);
45
    $bugsnag->sendException(new RuntimeException("Force BugSnag info"), 'info');
46
47
    return $this->redirect('/admin/settings#Root_Bugsnag');
48
  }
49
}
50