Passed
Pull Request — master (#660)
by butschster
07:40
created

WebsocketsBootloader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 11
ccs 2
cts 3
cp 0.6667
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A start() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Broadcasting\Bootloader;
6
7
use Spiral\Boot\Bootloader\Bootloader;
8
use Spiral\Bootloader\Http\HttpBootloader;
9
use Spiral\Broadcasting\Config\BroadcastConfig;
10
use Spiral\Broadcasting\Driver\AuthorizationMiddleware;
0 ignored issues
show
Bug introduced by
The type Spiral\Broadcasting\Driver\AuthorizationMiddleware 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...
11
use Spiral\Core\Container\SingletonInterface;
12
13
final class WebsocketsBootloader extends Bootloader implements SingletonInterface
14
{
15
    protected const DEPENDENCIES = [
16
        HttpBootloader::class,
17
        BroadcastingBootloader::class,
18
    ];
19
20 192
    public function start(HttpBootloader $http, BroadcastConfig $config): void
21
    {
22 192
        if ($config->getAuthorizationPath() !== null) {
23
            $http->addMiddleware(AuthorizationMiddleware::class);
24
        }
25
    }
26
}
27