protected function prepareStructureAndData(array $data)
    {
        // check passed input (simple)
        if (!isset($data[1]) || !isset($data[2]) || !isset($data[3])) {
            throw new Exception('Array passed to '.__METHOD__.' could not be processed!');
        }

        // extract required information
        $tag = ($data[1][0] !== '') ? $data[1][0] : null;

        if ($tag !== null) {
            $keys   = array_slice($data[2], 1);
            $values = array_slice($data[3], 1);
        } else {
            $keys   = $data[2];
            $values = $data[3];
        }

        // get result combined and keys in lower case
        $properties = array_change_key_case(array_combine($keys, $values), CASE_LOWER);

        $result = [
            'tag'        => $tag,
            'properties' => $properties,
        ];

        return $result;
    }
protected function prepareStructureAndData(array $data)
    {
        // check passed input (simple)
        if (!isset($data[1]) || !isset($data[2]) || !isset($data[3])) {
            throw new Exception('Array passed to '.__METHOD__.' could not be processed!');
        }

        // extract required information
        $tag = ($data[1][0] !== '') ? $data[1][0] : null;

        if ($tag !== null) {
            $keys   = array_slice($data[2], 1);
            $values = array_slice($data[3], 1);
        } else {
            $keys   = $data[2];
            $values = $data[3];
        }

        // get result combined and keys in lower case
        $properties = array_change_key_case(array_combine($keys, $values), CASE_LOWER);

        $result = [
            'tag'        => $tag,
            'properties' => $properties,
        ];

        return $result;
    }
protected function prepareStructureAndData ( array $ data ) { // check passed input (simple) if ( ! isset ( $ data [ 1 ] ) || ! isset ( $ data [ 2 ] ) || ! isset ( $ data [ 3 ] ) ) { throw new Exception ( 'Array passed to ' . __METHOD__ . ' could not be processed!' ) ; } // extract required information $ tag = ( $ data [ 1 ] [ 0 ] !== '' ) ? $ data [ 1 ] [ 0 ] : null ; if ( $ tag !== null ) { $ keys = array_slice ( $ data [ 2 ] , 1 ) ; $ values = array_slice ( $ data [ 3 ] , 1 ) ; } else { $ keys = $ data [ 2 ] ; $ values = $ data [ 3 ] ; } // get result combined and keys in lower case $ properties = array_change_key_case ( array_combine ( $ keys , $ values ) , CASE_LOWER ) ; $ result = [ 'tag' => $ tag , 'properties' => $ properties , ] ; return $ result ; }
Takes an array of extracted properties and prepare it's structure and data for further use.

@param array $data The data to re-arrange

@author Benjamin Carl <opensource@clickalicious.de>

@return array The array with the resulting new structure

@throws Exception
Takes an array of extracted properties and prepare it s structure and data for further use .