Passed
Pull Request — master (#52)
by Aleksei
13:46
created

CycleDependencyProxy::getDatabaseProvider()   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
16
final class CycleDependencyProxy
17
{
18
    private ContainerInterface $container;
19
    public function __construct(ContainerInterface $container)
20
    {
21
        $this->container = $container;
22
    }
23
    public function getDatabaseProvider(): DatabaseProviderInterface
24
    {
25
        return $this->container->get(DatabaseProviderInterface::class);
26
    }
27
    public function getMigrationConfig(): MigrationConfig
28
    {
29
        return $this->container->get(MigrationConfig::class);
30
    }
31
    public function getMigrator(): Migrator
32
    {
33
        return $this->container->get(Migrator::class);
34
    }
35
    /**
36
     * Can be used in other packages
37
     */
38
    public function getORM(): ORMInterface
39
    {
40
        return $this->container->get(ORMInterface::class);
41
    }
42
    public function getSchema(): SchemaInterface
43
    {
44
        return $this->container->get(SchemaInterface::class);
45
    }
46
    public function getSchemaManager(): SchemaManager
47
    {
48
        return $this->container->get(SchemaManager::class);
49
    }
50
    public function getSchemaConveyor(): SchemaConveyorInterface
51
    {
52
        return $this->container->get(SchemaConveyorInterface::class);
53
    }
54
}
55