Passed
Push — master ( a5cb85...5e6469 )
by Alexander
11:41 queued 08:50
created

CycleDependencyProxy::getMigrator()   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 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Cycle\Command;
6
7
use Cycle\Database\DatabaseProviderInterface;
8
use Cycle\Migrations\Config\MigrationConfig;
9
use Cycle\Migrations\Migrator;
10
use Cycle\ORM\ORMInterface;
11
use Cycle\ORM\SchemaInterface;
12
use Psr\Container\ContainerInterface;
13
use Yiisoft\Yii\Cycle\Schema\SchemaConveyorInterface;
14
use Yiisoft\Yii\Cycle\Schema\SchemaProviderInterface;
15
16
final class CycleDependencyProxy
17
{
18
    private ContainerInterface $container;
19
20 4
    public function __construct(ContainerInterface $container)
21
    {
22 4
        $this->container = $container;
23
    }
24
25
    public function getDatabaseProvider(): DatabaseProviderInterface
26
    {
27
        return $this->container->get(DatabaseProviderInterface::class);
28
    }
29
30
    public function getMigrationConfig(): MigrationConfig
31
    {
32
        return $this->container->get(MigrationConfig::class);
33
    }
34
35
    public function getMigrator(): Migrator
36
    {
37
        return $this->container->get(Migrator::class);
38
    }
39
40
    /**
41
     * Can be used in other packages
42
     */
43
    public function getORM(): ORMInterface
44
    {
45
        return $this->container->get(ORMInterface::class);
46
    }
47
48 2
    public function getSchema(): SchemaInterface
49
    {
50 2
        return $this->container->get(SchemaInterface::class);
51
    }
52
53 2
    public function getSchemaProvider(): SchemaProviderInterface
54
    {
55 2
        return $this->container->get(SchemaProviderInterface::class);
56
    }
57
58
    public function getSchemaConveyor(): SchemaConveyorInterface
59
    {
60
        return $this->container->get(SchemaConveyorInterface::class);
61
    }
62
}
63