src/Contao/Dca/Builder/Legacy/LegacyDcaDataDefinitionBuilder.php
protected function createCommand($commandName, array $commandDca)
    {

        $command = $this->createCommandInstance($commandName, $commandDca);
        $command->setName($commandName);

        $parameters = $command->getParameters();

        if (isset($commandDca['href'])) {
            \parse_str($commandDca['href'], $queryParameters);
            foreach ($queryParameters as $name => $value) {
                $parameters[$name] = $value;
            }
            unset($commandDca['href']);
        }

        if (isset($commandDca['parameters'])) {
            foreach ($commandDca['parameters'] as $name => $value) {
                $parameters[$name] = $value;
            }
            unset($commandDca['parameters']);
        }

        if (isset($commandDca['label'])) {
            $lang = $commandDca['label'];

            if (\is_array($lang)) {
                $label       = \reset($lang);
                $description = \next($lang);

                $command->setDescription($description);
            } else {
                $label = $lang;
            }

            $command->setLabel($label);

            unset($commandDca['label']);
        }

        if (isset($commandDca['description'])) {
            $command->setDescription($commandDca['description']);

            unset($commandDca['description']);
        }

        // Callback is transformed into event in parseCallbacks().
        unset($commandDca['button_callback']);

        if (\count($commandDca)) {
            $extra = $command->getExtra();

            foreach ($commandDca as $name => $value) {
                $extra[$name] = $value;
            }
        }

        return $command;
    }
protected function createCommand($commandName, array $commandDca)
    {

        $command = $this->createCommandInstance($commandName, $commandDca);
        $command->setName($commandName);

        $parameters = $command->getParameters();

        if (isset($commandDca['href'])) {
            \parse_str($commandDca['href'], $queryParameters);
            foreach ($queryParameters as $name => $value) {
                $parameters[$name] = $value;
            }
            unset($commandDca['href']);
        }

        if (isset($commandDca['parameters'])) {
            foreach ($commandDca['parameters'] as $name => $value) {
                $parameters[$name] = $value;
            }
            unset($commandDca['parameters']);
        }

        if (isset($commandDca['label'])) {
            $lang = $commandDca['label'];

            if (\is_array($lang)) {
                $label       = \reset($lang);
                $description = \next($lang);

                $command->setDescription($description);
            } else {
                $label = $lang;
            }

            $command->setLabel($label);

            unset($commandDca['label']);
        }

        if (isset($commandDca['description'])) {
            $command->setDescription($commandDca['description']);

            unset($commandDca['description']);
        }

        // Callback is transformed into event in parseCallbacks().
        unset($commandDca['button_callback']);

        if (\count($commandDca)) {
            $extra = $command->getExtra();

            foreach ($commandDca as $name => $value) {
                $extra[$name] = $value;
            }
        }

        return $command;
    }
protected function createCommand ( $ commandName , array $ commandDca ) { $ command = $ this -> createCommandInstance ( $ commandName , $ commandDca ) ; $ command -> setName ( $ commandName ) ; $ parameters = $ command -> getParameters ( ) ; if ( isset ( $ commandDca [ 'href' ] ) ) { \ parse_str ( $ commandDca [ 'href' ] , $ queryParameters ) ; foreach ( $ queryParameters as $ name => $ value ) { $ parameters [ $ name ] = $ value ; } unset ( $ commandDca [ 'href' ] ) ; } if ( isset ( $ commandDca [ 'parameters' ] ) ) { foreach ( $ commandDca [ 'parameters' ] as $ name => $ value ) { $ parameters [ $ name ] = $ value ; } unset ( $ commandDca [ 'parameters' ] ) ; } if ( isset ( $ commandDca [ 'label' ] ) ) { $ lang = $ commandDca [ 'label' ] ; if ( \ is_array ( $ lang ) ) { $ label = \ reset ( $ lang ) ; $ description = \ next ( $ lang ) ; $ command -> setDescription ( $ description ) ; } else { $ label = $ lang ; } $ command -> setLabel ( $ label ) ; unset ( $ commandDca [ 'label' ] ) ; } if ( isset ( $ commandDca [ 'description' ] ) ) { $ command -> setDescription ( $ commandDca [ 'description' ] ) ; unset ( $ commandDca [ 'description' ] ) ; } // Callback is transformed into event in parseCallbacks(). unset ( $ commandDca [ 'button_callback' ] ) ; if ( \ count ( $ commandDca ) ) { $ extra = $ command -> getExtra ( ) ; foreach ( $ commandDca as $ name => $ value ) { $ extra [ $ name ] = $ value ; } } return $ command ; }
Create a command from dca.

@param string $commandName The name of the command to parse.
@param array  $commandDca  The chunk from the DCA containing the command specification.

@return CommandInterface
Create a command from dca .