piwik/core/Archive/DataTableFactory.php
/**
     * Creates a Set from an array index.
     *
     * @param array $index @see DataCollection
     * @param array $resultIndices @see make
     * @param array $keyMetadata The metadata to add to the table when it's created.
     * @return DataTable\Map
     */
Creates a Set from an array index.
Creates a Set from an array index .
private function createDataTableMapFromIndex($index, $resultIndices, $keyMetadata = array())
    {
        $resultIndexLabel = reset($resultIndices);
        $resultIndex = key($resultIndices);
        array_shift($resultIndices);
        $result = new DataTable\Map();
        $result->setKeyName($resultIndexLabel);
        foreach ($index as $label => $value) {
            $keyMetadata[$resultIndex] = $label;
            if (empty($resultIndices)) {
                $newTable = $this->createDataTable($value, $keyMetadata);
            } else {
                $newTable = $this->createDataTableMapFromIndex($value, $resultIndices, $keyMetadata);
            }
            $result->addTable($newTable, $this->prettifyIndexLabel($resultIndex, $label));
        }
        return $result;
    }
private function createDataTableMapFromIndex ( $ index , $ resultIndices , $ keyMetadata = array ( ) ) { $ resultIndexLabel = reset ( $ resultIndices ) ; $ resultIndex = key ( $ resultIndices ) ; array_shift ( $ resultIndices ) ; $ result = new DataTable \ Map ( ) ; $ result -> setKeyName ( $ resultIndexLabel ) ; foreach ( $ index as $ label => $ value ) { $ keyMetadata [ $ resultIndex ] = $ label ; if ( empty ( $ resultIndices ) ) { $ newTable = $ this -> createDataTable ( $ value , $ keyMetadata ) ; } else { $ newTable = $ this -> createDataTableMapFromIndex ( $ value , $ resultIndices , $ keyMetadata ) ; } $ result -> addTable ( $ newTable , $ this -> prettifyIndexLabel ( $ resultIndex , $ label ) ) ; } return $ result ; }
Creates a Set from an array index.
Creates a Set from an array index .