BasicSubscriber   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getSubscribedEvents() 0 6 1
A handleError() 0 8 2
1
<?php declare(strict_types=1);
2
3
namespace ShopwareBlogBugsnag\Source;
4
5
use Enlight\Event\SubscriberInterface;
0 ignored issues
show
Bug introduced by
The type Enlight\Event\SubscriberInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class BasicSubscriber implements SubscriberInterface
8
{
9
    /**
10
     * @var BugsnagClient
11
     */
12
    private $bugsnagClient;
13
14
    public function __construct(BugsnagClient $bugsnagClient)
15
    {
16
        $this->bugsnagClient = $bugsnagClient;
17
    }
18
19
    public static function getSubscribedEvents(): array
20
    {
21
        return [
22
            'Enlight_Controller_Front_RouteShutdown' => ['handleError', 1000],
23
            'Enlight_Controller_Front_PostDispatch' => ['handleError', 1000],
24
            'Shopware_Console_Add_Command' => ['handleError', 1000],
25
        ];
26
    }
27
28
    /**
29
     * @param \Enlight_Controller_EventArgs $args
0 ignored issues
show
Bug introduced by
The type Enlight_Controller_EventArgs was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
30
     */
31
    public function handleError(\Enlight_Event_EventArgs $args)
0 ignored issues
show
Bug introduced by
The type Enlight_Event_EventArgs was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
    {
33
        $front = $args->getSubject();
34
        if ($front->getParam('noErrorHandler')) {
35
            return;
36
        }
37
38
        $this->bugsnagClient->registerHandler();
39
    }
40
}
41