Code Duplication    Length = 15-15 lines in 3 locations

src/Handler/BindCommandHandler.php 3 locations

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