Passed
Push — master ( 227314...d8a269 )
by Alexander
14:02
created

CycleDependencyPromise   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 33
ccs 0
cts 27
cp 0
rs 10
c 1
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getDatabaseManager() 0 3 1
A getMigrationConfig() 0 3 1
A getSchema() 0 3 1
A getSchemaConveyor() 0 3 1
A getORM() 0 3 1
A getMigrator() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Command;
6
7
use Cycle\ORM\ORMInterface;
8
use Cycle\ORM\SchemaInterface;
9
use Psr\Container\ContainerInterface;
10
use Spiral\Database\DatabaseManager;
11
use Spiral\Migrations\Config\MigrationConfig;
12
use Spiral\Migrations\Migrator;
13
use Yiisoft\Yii\Cycle\Conveyor\SchemaConveyorInterface;
14
15
final class CycleDependencyPromise
16
{
17
    private ContainerInterface $container;
18
    public function __construct(ContainerInterface $container)
19
    {
20
        $this->container = $container;
21
    }
22
    public function getDatabaseManager(): DatabaseManager
23
    {
24
        return $this->container->get(DatabaseManager::class);
25
    }
26
    public function getMigrationConfig(): MigrationConfig
27
    {
28
        return $this->container->get(MigrationConfig::class);
29
    }
30
    public function getMigrator(): Migrator
31
    {
32
        return $this->container->get(Migrator::class);
33
    }
34
    /**
35
     * Can be used in other packages
36
     */
37
    public function getORM(): ORMInterface
38
    {
39
        return $this->container->get(ORMInterface::class);
40
    }
41
    public function getSchema(): SchemaInterface
42
    {
43
        return $this->container->get(SchemaInterface::class);
44
    }
45
    public function getSchemaConveyor(): SchemaConveyorInterface
46
    {
47
        return $this->container->get(SchemaConveyorInterface::class);
48
    }
49
}
50