1 | <?php |
||
30 | final class Definition implements DefinitionInterface |
||
31 | { |
||
32 | /** @var VersionId */ |
||
33 | private $id; |
||
34 | |||
35 | /** @var MigrationInterface */ |
||
36 | private $migration; |
||
37 | |||
38 | /** |
||
39 | * Definition constructor. |
||
40 | * @param MigrationInterface $migration |
||
41 | * @param null|string|ValueObjectInterface $id Overrides the ID for the migration with the specified ID |
||
42 | */ |
||
43 | 8 | public function __construct(MigrationInterface $migration, $id = null) |
|
44 | { |
||
45 | 8 | if (null === $id) { |
|
46 | 7 | $id = VersionId::fromMigration($migration); |
|
47 | 7 | } else { |
|
48 | 1 | $id = new VersionId((string) $id); |
|
49 | } |
||
50 | 8 | $this->id = $id; |
|
51 | |||
52 | 8 | $this->migration = $migration; |
|
53 | 8 | } |
|
54 | |||
55 | /** |
||
56 | * @inheritdoc |
||
57 | */ |
||
58 | 3 | public function getId() |
|
62 | |||
63 | /** |
||
64 | * @return MigrationInterface |
||
65 | */ |
||
66 | 2 | public function getMigration() |
|
70 | } |
||
71 |