Code Duplication    Length = 15-15 lines in 3 locations

src/Handler/BindCommandHandler.php 3 locations

@@ 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->getContainingModule() instanceof RootModule) {
225
            throw new RuntimeException(sprintf(
226
                'Can only delete bindings from the module "%s".',
227
                $this->modules->getRootModuleName()
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->getContainingModule() instanceof RootModule) {
248
            throw new RuntimeException(sprintf(
249
                'Cannot enable bindings in the module "%s".',
250
                $bindingToEnable->getContainingModule()->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->getContainingModule() instanceof RootModule) {
271
            throw new RuntimeException(sprintf(
272
                'Cannot disable bindings in the module "%s".',
273
                $bindingToDisable->getContainingModule()->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.