Returns all the column headers for the table view.
@param GaData $results The results from the Core Reporting API.
@return string The formatted results.
15809
private function getColumnHeaders(&$results) {
    $html = '<h3>Column Headers</h3><pre>';

    $headers = $results->getColumnHeaders();
    foreach ($headers as $header) {
      $html .= <<<HTML

Column Name = {$header->getName()}
Column Type = {$header->getColumnType()}
Data Type   = {$header->getDataType()}

HTML;
    }

    $html .= '</pre>';
    return $html;
  }
518390
public function processColumnListing($results)
	{
		$mapping = function ($r) {
			$r = (object) $r;

			return $r->name;
		};

		return array_map($mapping, $results);
	}
334671
public function output_headers($headers) {
        $this->columns = $headers;
        if (method_exists($this->dataformat, 'write_header')) {
            error_log('The function write_header() does not support multiple sheets. In order to support multiple sheets you ' .
                'must implement start_output() and start_sheet() and remove write_header() in your dataformat.');
            $this->dataformat->write_header($headers);
        } else {
            $this->dataformat->start_sheet($headers);
        }
    }
1331717
public function getResponse($result)
    {
        $content = $result->getContent();

        if ($result->headers->get('content-type') == 'application/json'){
            $content = json_decode($result->getContent(),true);
        }

        return array(
          'type' => 'rpc',
          'tid' => $this->tid,
          'action' => $this->action,
          'method' => $this->method,
          'result' => $content
        );
    }
712514
function formatResults (results) {
  return results.map(function (r) {
    return {
      fullName: r.fullName,
      hz: r.hz,
      hzDeviation: r.hzDeviation
    }
  })
}
147765
public function processColumnListing($results)
	{
		return array_map(function ($result) {
			return is_object($result) ? $result->column_name : $result['column_name'];
		}, $results);
	}
379955
private function filter( $data, $columns ) {
		$_format  = [];
		$_data    = [];
		$_columns = $columns;
		foreach ( $data as $k => $v ) {
			$columns = $_columns;
			list( $name, $columns ) = $this->get_field_data( $k, $columns );
			if ( isset( $columns[ $k ] ) ) {
				$_format[] = $columns[ $k ]['format'];
			} else {
				$_format[] = '%s';
			}
			$_data[ $name ] = $v;
		}

		return [ $_data, $_format ];
	}
422156
protected function hydrateModelsAndLoadIncludes($results)
	{
		$hydrated = [];

		foreach($results as $result)
		{
			$hydrated[] = $this->hydrateModel($result);
		}

		$this->loadIncludes($hydrated);

		return $hydrated;
	}
1320113
public function processColumnListing($results)
    {
        return array_values(array_map(function ($result)
        {
            $result = (object) $result;

            return $result->column_name;

        }, $results));
    }
589494
public function setResults($results)
    {
        // hydrate model
        foreach ($results as $entry) {
            /** @var EntityDataModel $model */
            $model = $this->getModel();
            $model->setEntityManager($this->getEntityManager());

            // check for json
            if (array_key_exists('[json]', $entry)) {
                $entry = json_decode($entry['[json]']);
            }

            $model = $this->populate($entry, $model);

            $this->collection[] = $model;
        }

        $this->setCount(count($this->collection));

        return $this;
    }
956725
private function getRowValues($columns, $data, $rowIndex)
    {
        foreach ($columns as $column) {
            if ($column instanceOf TbDataColumn) {
                $result[$column->name] = $this->getDataCellContent($column, $data, $rowIndex);
            } elseif (is_string($column)) {
                if (is_array($data) && array_key_exists($column, $data)) {
                    $result[$column] = $data[$column];
                } elseif ($data instanceOf CActiveRecord && $data->hasAttribute($column)) {
                    $result[$column] = $data->getAttribute($column);
                } else {
                    throw new CException('Column or attribute "' . $column . '" not found!');
                }
            }
        }
        return isset($result) ? $result : false;
    }
502123
def get_header(results):
    ''''''
    ret = ['name', ]
    values = next(iter(results.values()))
    for k, v in values.items():
        if isinstance(v, dict):
            for metric in v.keys():
                ret.append('%s:%s' % (k, metric))
        else:
            ret.append(k)
    return ret
177940
public static function formatListByType(array $result, string $className): array
    {
        if (empty($result)) {
            return [];
        }

        $rowList = [];
        foreach ($result as $row) {
            $rowList[] = self::formatRowByType($row, $className);
        }

        return $rowList;
    }
1134187
private function format(DiffResult $result)
    {
        $serializer = SerializerBuilder::create()->build();

        return $serializer->serialize($result, 'json');
    }
219297
protected function transformResultsToRoutes(array $results)
    {
        $routes = [];
        foreach ($results as $result) {
            $name = $result['route'];
            if (array_key_exists($name, $routes)) {
                /** @var Route $route */
                $route = $routes[$name];
                $paths = $route->getOption('i18n_paths');
                $paths[$result['locale']] = $result['path'];
                $route->setOption('i18n_paths', $paths);
            } else {
                $route = new Route($result['path']);
                if (!array_key_exists($result['controller'], $this->config['controllers'])) {
                    throw new \RuntimeException(sprintf('Undefined controller "%s".', $result['controller']));
                }
                $paths = [$result['locale'] => $result['path']];
                $route
                    ->setDefault('_controller', $this->config['controllers'][$result['controller']]['value'])
                    ->setMethods(['GET'])
                    ->setOption('i18n_paths', $paths)
                ;
                $routes[$name] = $route;
            }
        }
        // TODO check that i18n_paths are set for all locales ?
        return $routes;
    }
873508
protected function getColumns($controller)
    {
        // If user has defined columns, use them
        if ($this->columns) {
            return $this->columns;
        }

        // Read columns from the controller
        $columns = $controller->columns();

        // If showing in sidebar, only show the first column
        // http://stackoverflow.com/a/1028677/59160
        if ($this->layout == 'sidebar') {
            $val = reset($columns); // Making sure this gets called before `key()`
            return [key($columns) => $val];

        // Otherwise, just return all columns
        }

        return $columns;
    }
530350
public function getHeaderRowHTML()
    {
        $output = [];
        foreach ($this->columns as $name => $column) {

            // If multiple formatters are defined, use the first for the header cell
            if (is_array($column)) {
                $column = $column[0];
            }

            if (!is_int($name)) {
                $field = $this->model->getElement($name);

                $output[] = $column->getHeaderCellHTML($field);
            } else {
                $output[] = $column->getHeaderCellHTML();
            }
        }

        return implode('', $output);
    }