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
![]() |
|||||
15 | private static $menu_title = 'Bugsnag'; |
||||
0 ignored issues
–
show
|
|||||
16 | |||||
17 | private static $allowed_actions = [ |
||||
0 ignored issues
–
show
|
|||||
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
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
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
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
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
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
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
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
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
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 |