@@ 75-89 (lines=15) @@ | ||
72 | * |
|
73 | * @return int The status code |
|
74 | */ |
|
75 | public function handleInstall(Args $args) |
|
76 | { |
|
77 | $pluginClass = $args->getArgument('class'); |
|
78 | ||
79 | if ($this->manager->hasPluginClass($pluginClass)) { |
|
80 | throw new RuntimeException(sprintf( |
|
81 | 'The plugin class "%s" is already installed.', |
|
82 | $pluginClass |
|
83 | )); |
|
84 | } |
|
85 | ||
86 | $this->manager->addPluginClass($pluginClass); |
|
87 | ||
88 | return 0; |
|
89 | } |
|
90 | ||
91 | /** |
|
92 | * Handles the "puli plugin --remove" command. |
|
@@ 98-112 (lines=15) @@ | ||
95 | * |
|
96 | * @return int The status code |
|
97 | */ |
|
98 | public function handleDelete(Args $args) |
|
99 | { |
|
100 | $pluginClass = $args->getArgument('class'); |
|
101 | ||
102 | if (!$this->manager->hasPluginClass($pluginClass)) { |
|
103 | throw new RuntimeException(sprintf( |
|
104 | 'The plugin class "%s" is not installed.', |
|
105 | $pluginClass |
|
106 | )); |
|
107 | } |
|
108 | ||
109 | $this->manager->removePluginClass($pluginClass); |
|
110 | ||
111 | return 0; |
|
112 | } |
|
113 | } |
|
114 |