|
@@ 220-234 (lines=15) @@
|
| 217 |
|
* |
| 218 |
|
* @return int The status code. |
| 219 |
|
*/ |
| 220 |
|
public function handleDelete(Args $args) |
| 221 |
|
{ |
| 222 |
|
$bindingToRemove = $this->getBindingByUuidPrefix($args->getArgument('uuid')); |
| 223 |
|
|
| 224 |
|
if (!$bindingToRemove->getContainingPackage() instanceof RootPackage) { |
| 225 |
|
throw new RuntimeException(sprintf( |
| 226 |
|
'Can only delete bindings from the package "%s".', |
| 227 |
|
$this->packages->getRootPackageName() |
| 228 |
|
)); |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
$this->discoveryManager->removeRootBindingDescriptor($bindingToRemove->getUuid()); |
| 232 |
|
|
| 233 |
|
return 0; |
| 234 |
|
} |
| 235 |
|
|
| 236 |
|
/** |
| 237 |
|
* Handles the "bind --enable" command. |
|
@@ 243-257 (lines=15) @@
|
| 240 |
|
* |
| 241 |
|
* @return int The status code. |
| 242 |
|
*/ |
| 243 |
|
public function handleEnable(Args $args) |
| 244 |
|
{ |
| 245 |
|
$bindingToEnable = $this->getBindingByUuidPrefix($args->getArgument('uuid')); |
| 246 |
|
|
| 247 |
|
if ($bindingToEnable->getContainingPackage() instanceof RootPackage) { |
| 248 |
|
throw new RuntimeException(sprintf( |
| 249 |
|
'Cannot enable bindings in the package "%s".', |
| 250 |
|
$bindingToEnable->getContainingPackage()->getName() |
| 251 |
|
)); |
| 252 |
|
} |
| 253 |
|
|
| 254 |
|
$this->discoveryManager->enableBindingDescriptor($bindingToEnable->getUuid()); |
| 255 |
|
|
| 256 |
|
return 0; |
| 257 |
|
} |
| 258 |
|
|
| 259 |
|
/** |
| 260 |
|
* Handles the "bind --disable" command. |
|
@@ 266-280 (lines=15) @@
|
| 263 |
|
* |
| 264 |
|
* @return int The status code. |
| 265 |
|
*/ |
| 266 |
|
public function handleDisable(Args $args) |
| 267 |
|
{ |
| 268 |
|
$bindingToDisable = $this->getBindingByUuidPrefix($args->getArgument('uuid')); |
| 269 |
|
|
| 270 |
|
if ($bindingToDisable->getContainingPackage() instanceof RootPackage) { |
| 271 |
|
throw new RuntimeException(sprintf( |
| 272 |
|
'Cannot disable bindings in the package "%s".', |
| 273 |
|
$bindingToDisable->getContainingPackage()->getName() |
| 274 |
|
)); |
| 275 |
|
} |
| 276 |
|
|
| 277 |
|
$this->discoveryManager->disableBindingDescriptor($bindingToDisable->getUuid()); |
| 278 |
|
|
| 279 |
|
return 0; |
| 280 |
|
} |
| 281 |
|
|
| 282 |
|
/** |
| 283 |
|
* Returns the binding states selected in the console arguments. |