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

CycleDependencyProxy   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 37
ccs 0
cts 16
cp 0
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getORM() 0 3 1
A getSchemaConveyor() 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
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