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

CycleDependencyPromise::getORM()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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