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

WebsocketsBootloader::start()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2.1481

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 4
ccs 2
cts 3
cp 0.6667
crap 2.1481
rs 10
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