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

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