Passed
Push — master ( d5dda9...c69dbe )
by Alexander
02:26
created

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