MiddlewareServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace App\Providers;
5
6
use App\Middleware\BasicAuth;
7
use App\Middleware\BenchMark;
8
use Illuminate\Container\Container;
9
use Psr\Log\LoggerInterface;
10
11
class MiddlewareServiceProvider implements ServiceProviderInterface
12
{
13 1
    public function register(Container $container)
14
    {
15
        $container->singleton(BenchMark::class, function (Container $container) {
16 1
            return new BenchMark($container->get(LoggerInterface::class));
17 1
        });
18
19
        $container->singleton(BasicAuth::class, function () {
20 1
            return new BasicAuth(
21 1
                getenv('BASIC_AUTH_USER'),
22 1
                getenv('BASIC_AUTH_PASSWORD'),
23 1
                getenv('BASIC_AUTH_REALM')
24
            );
25 1
        });
26 1
    }
27
}
28