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

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