Passed
Pull Request — master (#840)
by Maxim
12:40 queued 05:56
created

AbstractBootloadManager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getClasses() 0 3 1
A bootload() 0 6 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Boot\BootloadManager;
6
7
use Spiral\Boot\BootloadManagerInterface;
8
use Spiral\Core\Container;
9
use Spiral\Core\ScopeInterface;
10
11
/**
12
 * Provides ability to bootload service providers.
13
 */
14
abstract class AbstractBootloadManager implements BootloadManagerInterface, Container\SingletonInterface
15
{
16 343
    public function __construct(
17
        private readonly ScopeInterface $scope,
18
        protected readonly InitializerInterface $initializer
19
    ) {
20
    }
21
22 9
    public function getClasses(): array
23
    {
24 9
        return $this->initializer->getRegistry()->getClasses();
25
    }
26
27 342
    public function bootload(array $classes, array $bootingCallbacks = [], array $bootedCallbacks = []): void
28
    {
29 342
        $this->scope->runScope(
30
            [self::class => $this],
31 342
            function () use ($classes, $bootingCallbacks, $bootedCallbacks): void {
32 342
                $this->boot($classes, $bootingCallbacks, $bootedCallbacks);
33
            }
34
        );
35
    }
36
37
    /**
38
     * Bootload all given bootloaders.
39
     *
40
     * @param array<class-string>|array<class-string, array<string,mixed>> $classes
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<class-string>|arra...g, array<string,mixed>> at position 2 could not be parsed: Unknown type name 'class-string' at position 2 in array<class-string>|array<class-string, array<string,mixed>>.
Loading history...
41
     */
42
    abstract protected function boot(array $classes, array $bootingCallbacks, array $bootedCallbacks): void;
43
}
44