CycleDependencyProxy::getDatabaseProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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