Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| ApieRemoveResourceCommand | |
100.00% |
6 / 6 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
| getCommandName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getCommandHelp | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getMetadata | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getSuccessMessage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| requiresId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Console\Commands; |
| 3 | |
| 4 | use Apie\Core\Actions\ActionResponse; |
| 5 | use Apie\Core\Identifiers\KebabCaseSlug; |
| 6 | use Apie\Core\Metadata\MetadataFactory; |
| 7 | use Apie\Core\Metadata\MetadataInterface; |
| 8 | use Apie\TypeConverter\ReflectionTypeFactory; |
| 9 | |
| 10 | final class ApieRemoveResourceCommand extends ApieMetadataDirectedConsoleCommand |
| 11 | { |
| 12 | protected function getCommandName(): string |
| 13 | { |
| 14 | return KebabCaseSlug::fromClass($this->reflectionClass) . ':remove'; |
| 15 | } |
| 16 | |
| 17 | protected function getCommandHelp(): string |
| 18 | { |
| 19 | return 'This command allows you to remove a ' . $this->reflectionClass->getShortName() . ' instance'; |
| 20 | } |
| 21 | |
| 22 | protected function getMetadata(): MetadataInterface |
| 23 | { |
| 24 | return MetadataFactory::getMetadataStrategyForType(ReflectionTypeFactory::createReflectionType('null')) |
| 25 | ->getCreationMetadata($this->apieContext); |
| 26 | } |
| 27 | |
| 28 | protected function getSuccessMessage(ActionResponse $actionResponse): string |
| 29 | { |
| 30 | return "Resource was successfully deleted."; |
| 31 | } |
| 32 | |
| 33 | protected function requiresId(): bool |
| 34 | { |
| 35 | return true; |
| 36 | } |
| 37 | } |