Code Duplication    Length = 21-24 lines in 2 locations

src/Handler/InstallerCommandHandler.php 1 location

@@ 91-114 (lines=24) @@
88
        // The first description is for the installer
89
        $description = $descriptions ? array_shift($descriptions) : null;
90
91
        foreach ($args->getOption('param') as $parameter) {
92
            // Subsequent descriptions are for the parameters
93
            $paramDescription = $descriptions ? array_shift($descriptions) : null;
94
95
            // Optional parameter with default value
96
            if (false !== ($pos = strpos($parameter, '='))) {
97
                $parameters[] = new InstallerParameter(
98
                    substr($parameter, 0, $pos),
99
                    InstallerParameter::OPTIONAL,
100
                    StringUtil::parseValue(substr($parameter, $pos + 1)),
101
                    $paramDescription
102
                );
103
104
                continue;
105
            }
106
107
            // Required parameter
108
            $parameters[] = new InstallerParameter(
109
                $parameter,
110
                InstallerParameter::REQUIRED,
111
                null,
112
                $paramDescription
113
            );
114
        }
115
116
        $this->installerManager->addRootInstallerDescriptor(new InstallerDescriptor(
117
            $args->getArgument('name'),

src/Handler/TypeCommandHandler.php 1 location

@@ 322-342 (lines=21) @@
319
320
    private function parseParams(Args $args, array &$bindingParams)
321
    {
322
        foreach ($args->getOption('param') as $parameter) {
323
            // Optional parameter with default value
324
            if (false !== ($pos = strpos($parameter, '='))) {
325
                $key = substr($parameter, 0, $pos);
326
327
                $bindingParams[$key] = new BindingParameter(
328
                    $key,
329
                    BindingParameter::OPTIONAL,
330
                    StringUtil::parseValue(substr($parameter, $pos + 1))
331
                );
332
333
                continue;
334
            }
335
336
            // Required parameter
337
            $bindingParams[$parameter] = new BindingParameter(
338
                $parameter,
339
                BindingParameter::REQUIRED,
340
                null
341
            );
342
        }
343
    }
344
345
    private function parseUnsetParams(Args $args, array &$bindingParams, array &$paramDescriptions)