Passed
Push — master ( 3eb4db...99d5ff )
by Kirill
03:12
created

Bootloader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 28
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A defineSingletons() 0 3 1
A defineDependencies() 0 3 1
A defineBindings() 0 3 1
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Boot\Bootloader;
13
14
/**
15
 * Provides ability to initiate set of container bindings using simple string form without closures.
16
 *
17
 * You can make any initializer automatically bootable by defining boot() method with
18
 * automatically resolved arguments.
19
 *
20
 * Attention, you are able to define your own set of shared (short bindings) components in your
21
 * bootloader, DO NOT share your business models this way - use regular DI.
22
 */
23
abstract class Bootloader implements BootloaderInterface, DependedInterface
24
{
25
    protected const BINDINGS     = [];
26
    protected const SINGLETONS   = [];
27
    protected const DEPENDENCIES = [];
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function defineBindings(): array
33
    {
34
        return static::BINDINGS;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function defineSingletons(): array
41
    {
42
        return static::SINGLETONS;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function defineDependencies(): array
49
    {
50
        return static::DEPENDENCIES;
51
    }
52
}
53