@@ -19,53 +19,53 @@ |
||
| 19 | 19 | |
| 20 | 20 | class PatchInstaller2 implements PackageInstallerInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * (non-PHPdoc) |
|
| 24 | - * @see \Mouf\Installer\PackageInstallerInterface::install() |
|
| 25 | - * @param MoufManager $moufManager |
|
| 26 | - * @throws \Mouf\MoufException |
|
| 27 | - */ |
|
| 28 | - public static function install(MoufManager $moufManager) |
|
| 29 | - { |
|
| 30 | - // Let's create the instance. |
|
| 31 | - $patchDefaultType = InstallUtils::getOrCreateInstance('patch.default_type', PatchType::class, $moufManager); |
|
| 32 | - $patchDefaultType->getConstructorArgumentProperty('name')->setValue(''); |
|
| 33 | - $patchDefaultType->getConstructorArgumentProperty('description')->setValue('Patches that should be always applied should have this type. Typically, use this type for DDL changes or reference data insertion.'); |
|
| 22 | + /** |
|
| 23 | + * (non-PHPdoc) |
|
| 24 | + * @see \Mouf\Installer\PackageInstallerInterface::install() |
|
| 25 | + * @param MoufManager $moufManager |
|
| 26 | + * @throws \Mouf\MoufException |
|
| 27 | + */ |
|
| 28 | + public static function install(MoufManager $moufManager) |
|
| 29 | + { |
|
| 30 | + // Let's create the instance. |
|
| 31 | + $patchDefaultType = InstallUtils::getOrCreateInstance('patch.default_type', PatchType::class, $moufManager); |
|
| 32 | + $patchDefaultType->getConstructorArgumentProperty('name')->setValue(''); |
|
| 33 | + $patchDefaultType->getConstructorArgumentProperty('description')->setValue('Patches that should be always applied should have this type. Typically, use this type for DDL changes or reference data insertion.'); |
|
| 34 | 34 | |
| 35 | - $patchTestDataType = InstallUtils::getOrCreateInstance('patch.testdata_type', PatchType::class, $moufManager); |
|
| 36 | - $patchTestDataType->getConstructorArgumentProperty('name')->setValue('test_data'); |
|
| 37 | - $patchTestDataType->getConstructorArgumentProperty('description')->setValue('Use this type to mark patches that contain test data that should only be used in staging environment.'); |
|
| 35 | + $patchTestDataType = InstallUtils::getOrCreateInstance('patch.testdata_type', PatchType::class, $moufManager); |
|
| 36 | + $patchTestDataType->getConstructorArgumentProperty('name')->setValue('test_data'); |
|
| 37 | + $patchTestDataType->getConstructorArgumentProperty('description')->setValue('Use this type to mark patches that contain test data that should only be used in staging environment.'); |
|
| 38 | 38 | |
| 39 | - $patchService = InstallUtils::getOrCreateInstance('patchService', PatchService::class, $moufManager); |
|
| 39 | + $patchService = InstallUtils::getOrCreateInstance('patchService', PatchService::class, $moufManager); |
|
| 40 | 40 | |
| 41 | - if (empty($patchService->getConstructorArgumentProperty('types')->getValue())) { |
|
| 42 | - $patchService->getConstructorArgumentProperty('types')->setValue([ $patchDefaultType, $patchTestDataType ]); |
|
| 43 | - } |
|
| 41 | + if (empty($patchService->getConstructorArgumentProperty('types')->getValue())) { |
|
| 42 | + $patchService->getConstructorArgumentProperty('types')->setValue([ $patchDefaultType, $patchTestDataType ]); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - $consoleUtils = new ConsoleUtils($moufManager); |
|
| 45 | + $consoleUtils = new ConsoleUtils($moufManager); |
|
| 46 | 46 | |
| 47 | - $listPatchesCommand = $moufManager->createInstance(ListPatchesCommand::class); |
|
| 48 | - $listPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 49 | - $consoleUtils->registerCommand($listPatchesCommand); |
|
| 47 | + $listPatchesCommand = $moufManager->createInstance(ListPatchesCommand::class); |
|
| 48 | + $listPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 49 | + $consoleUtils->registerCommand($listPatchesCommand); |
|
| 50 | 50 | |
| 51 | - $applyAllPatchesCommand = $moufManager->createInstance(ApplyAllPatchesCommand::class); |
|
| 52 | - $applyAllPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 53 | - $consoleUtils->registerCommand($applyAllPatchesCommand); |
|
| 51 | + $applyAllPatchesCommand = $moufManager->createInstance(ApplyAllPatchesCommand::class); |
|
| 52 | + $applyAllPatchesCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 53 | + $consoleUtils->registerCommand($applyAllPatchesCommand); |
|
| 54 | 54 | |
| 55 | - $applyPatchCommand = $moufManager->createInstance(ApplyPatchCommand::class); |
|
| 56 | - $applyPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 57 | - $consoleUtils->registerCommand($applyPatchCommand); |
|
| 55 | + $applyPatchCommand = $moufManager->createInstance(ApplyPatchCommand::class); |
|
| 56 | + $applyPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 57 | + $consoleUtils->registerCommand($applyPatchCommand); |
|
| 58 | 58 | |
| 59 | - $skipPatchCommand = $moufManager->createInstance(SkipPatchCommand::class); |
|
| 60 | - $skipPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 61 | - $consoleUtils->registerCommand($skipPatchCommand); |
|
| 59 | + $skipPatchCommand = $moufManager->createInstance(SkipPatchCommand::class); |
|
| 60 | + $skipPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 61 | + $consoleUtils->registerCommand($skipPatchCommand); |
|
| 62 | 62 | |
| 63 | - $revertPatchCommand = $moufManager->createInstance(RevertPatchCommand::class); |
|
| 64 | - $revertPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 65 | - $consoleUtils->registerCommand($revertPatchCommand); |
|
| 63 | + $revertPatchCommand = $moufManager->createInstance(RevertPatchCommand::class); |
|
| 64 | + $revertPatchCommand->getConstructorArgumentProperty("patchService")->setValue($patchService); |
|
| 65 | + $consoleUtils->registerCommand($revertPatchCommand); |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | - // Let's rewrite the MoufComponents.php file to save the component |
|
| 69 | - $moufManager->rewriteMouf(); |
|
| 70 | - } |
|
| 68 | + // Let's rewrite the MoufComponents.php file to save the component |
|
| 69 | + $moufManager->rewriteMouf(); |
|
| 70 | + } |
|
| 71 | 71 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $patchService = InstallUtils::getOrCreateInstance('patchService', PatchService::class, $moufManager); |
| 40 | 40 | |
| 41 | 41 | if (empty($patchService->getConstructorArgumentProperty('types')->getValue())) { |
| 42 | - $patchService->getConstructorArgumentProperty('types')->setValue([ $patchDefaultType, $patchTestDataType ]); |
|
| 42 | + $patchService->getConstructorArgumentProperty('types')->setValue([$patchDefaultType, $patchTestDataType]); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $consoleUtils = new ConsoleUtils($moufManager); |
@@ -39,20 +39,20 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * Skips the patch (sets its status to "skipped"). |
| 41 | 41 | */ |
| 42 | - public function skip(): void; |
|
| 42 | + public function skip(): void; |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Reverts (cancels) the patch. |
| 46 | 46 | * Note: patchs do not have to provide a "revert" feature (see canRevert method). |
| 47 | 47 | */ |
| 48 | - public function revert(): void; |
|
| 48 | + public function revert(): void; |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Returns true if this patch can be canceled, false otherwise. |
| 52 | 52 | * |
| 53 | 53 | * @return boolean |
| 54 | 54 | */ |
| 55 | - public function canRevert(): bool; |
|
| 55 | + public function canRevert(): bool; |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Returns the status of this patch. |
@@ -65,28 +65,28 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @return string |
| 67 | 67 | */ |
| 68 | - public function getStatus(): string; |
|
| 68 | + public function getStatus(): string; |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Returns a unique name for this patch. |
| 72 | 72 | * |
| 73 | 73 | * @return string |
| 74 | 74 | */ |
| 75 | - public function getUniqueName(): string; |
|
| 75 | + public function getUniqueName(): string; |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * Returns a short description of the patch. |
| 79 | 79 | * |
| 80 | 80 | * @return string |
| 81 | 81 | */ |
| 82 | - public function getDescription(): string; |
|
| 82 | + public function getDescription(): string; |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Returns the error message of the last action performed, or null if last action was successful. |
| 86 | 86 | * |
| 87 | 87 | * @return string |
| 88 | 88 | */ |
| 89 | - public function getLastErrorMessage(): ?string; |
|
| 89 | + public function getLastErrorMessage(): ?string; |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Returns the URL that can be used to edit this patch. |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - public function getEditUrl(): ?string; |
|
| 97 | + public function getEditUrl(): ?string; |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Returns the type of the patch. |
|
| 101 | - * |
|
| 102 | - * @return PatchType |
|
| 103 | - */ |
|
| 104 | - public function getPatchType() : PatchType; |
|
| 99 | + /** |
|
| 100 | + * Returns the type of the patch. |
|
| 101 | + * |
|
| 102 | + * @return PatchType |
|
| 103 | + */ |
|
| 104 | + public function getPatchType() : PatchType; |
|
| 105 | 105 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return string |
| 88 | 88 | */ |
| 89 | - public function getLastErrorMessage(): ?string; |
|
| 89 | + public function getLastErrorMessage(): ? string; |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Returns the URL that can be used to edit this patch. |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - public function getEditUrl(): ?string; |
|
| 97 | + public function getEditUrl(): ? string; |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Returns the type of the patch. |