protected function parse($configuration)
    {
        $result = [];

        // Extract commands of Doozr from configuration
        foreach ($configuration as $root => $children) {
            foreach ($children as $key => $values) {
                foreach ($values as $node => $value) {
                    $dom   = [];
                    $doozr = [];

                    switch ($node) {
                        case 'tag':
                            $tag = $value;
                            break;
                        case 'properties':
                            $properties = $value;

                            // Get commands of form
                            foreach ($properties as $property => $value) {
                                if ($this->containsCommand($property) === true) {
                                    $doozr[] = [
                                        'method' => $this->getMethodByKey($property),
                                        'value'  => $value,
                                    ];
                                } else {
                                    $dom[$property] = $value;
                                }
                            }
                            break;
                    }
                }

                if (isset($result[$root]) === false) {
                    $result[$root] = [];
                }

                $result[$root][] = [
                    'dom'   => $dom,
                    'doozr' => $doozr,
                ];
            }
        }

        // After iterating all parts with the same logic shift child form to root -> only one possible!
        $result['form'] = $result['form'][0];

        $this->setConfiguration(array_to_object($result));
    }
protected function parse($configuration)
    {
        $result = [];

        // Extract commands of Doozr from configuration
        foreach ($configuration as $root => $children) {
            foreach ($children as $key => $values) {
                foreach ($values as $node => $value) {
                    $dom   = [];
                    $doozr = [];

                    switch ($node) {
                        case 'tag':
                            $tag = $value;
                            break;
                        case 'properties':
                            $properties = $value;

                            // Get commands of form
                            foreach ($properties as $property => $value) {
                                if ($this->containsCommand($property) === true) {
                                    $doozr[] = [
                                        'method' => $this->getMethodByKey($property),
                                        'value'  => $value,
                                    ];
                                } else {
                                    $dom[$property] = $value;
                                }
                            }
                            break;
                    }
                }

                if (isset($result[$root]) === false) {
                    $result[$root] = [];
                }

                $result[$root][] = [
                    'dom'   => $dom,
                    'doozr' => $doozr,
                ];
            }
        }

        // After iterating all parts with the same logic shift child form to root -> only one possible!
        $result['form'] = $result['form'][0];

        $this->setConfiguration(array_to_object($result));
    }
protected function parse ( $ configuration ) { $ result = [ ] ; // Extract commands of Doozr from configuration foreach ( $ configuration as $ root => $ children ) { foreach ( $ children as $ key => $ values ) { foreach ( $ values as $ node => $ value ) { $ dom = [ ] ; $ doozr = [ ] ; switch ( $ node ) { case 'tag' : $ tag = $ value ; break ; case 'properties' : $ properties = $ value ; // Get commands of form foreach ( $ properties as $ property => $ value ) { if ( $ this -> containsCommand ( $ property ) === true ) { $ doozr [ ] = [ 'method' => $ this -> getMethodByKey ( $ property ) , 'value' => $ value , ] ; } else { $ dom [ $ property ] = $ value ; } } break ; } } if ( isset ( $ result [ $ root ] ) === false ) { $ result [ $ root ] = [ ] ; } $ result [ $ root ] [ ] = [ 'dom' => $ dom , 'doozr' => $ doozr , ] ; } } // After iterating all parts with the same logic shift child form to root -> only one possible! $ result [ 'form' ] = $ result [ 'form' ] [ 0 ] ; $ this -> setConfiguration ( array_to_object ( $ result ) ) ; }
Parses a configuration.

@param mixed $configuration Configuration to parse

@author Benjamin Carl <opensource@clickalicious.de>
Parses a configuration .