Passed
Pull Request — master (#68)
by Aleksei
02:29
created

CycleDependencyProxy   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
eloc 11
c 1
b 0
f 0
dl 0
loc 44
ccs 0
cts 18
cp 0
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getORM() 0 3 1
A getSchemaConveyor() 0 3 1
A getSchemaProvider() 0 3 1
A getSchemaManager() 0 3 1
A getMigrationConfig() 0 3 1
A getMigrator() 0 3 1
A getSchema() 0 3 1
A getDatabaseProvider() 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\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