Failed Conditions
Pull Request — master (#632)
by Michael
02:44
created

SchemaDiffProvider::createToSchema()   A

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 1
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 Doctrine\Migrations\Provider;
6
7
use Doctrine\DBAL\Platforms\AbstractPlatform;
8
use Doctrine\DBAL\Schema\AbstractSchemaManager;
9
use Doctrine\DBAL\Schema\Schema;
10
11
class SchemaDiffProvider implements SchemaDiffProviderInterface
12
{
13
    /** @var AbstractPlatform */
14
    private $platform;
15
16
    /** @var AbstractSchemaManager */
17
    private $schemaManager;
18
19 121
    public function __construct(AbstractSchemaManager $schemaManager, AbstractPlatform $platform)
20
    {
21 121
        $this->schemaManager = $schemaManager;
22 121
        $this->platform      = $platform;
23 121
    }
24
25 13
    public function createFromSchema() : Schema
26
    {
27 13
        return $this->schemaManager->createSchema();
28
    }
29
30 13
    public function createToSchema(Schema $fromSchema) : Schema
31
    {
32 13
        return clone $fromSchema;
33
    }
34
35
    /** @return string[] */
36 13
    public function getSqlDiffToMigrate(Schema $fromSchema, Schema $toSchema) : array
37
    {
38 13
        return $fromSchema->getMigrateToSql($toSchema, $this->platform);
39
    }
40
}
41