Camspiers\StatisticalClassifier\DataSource\CSV::readColumns PHP Method

readColumns() protected method

protected readColumns ( $handle ) : array
$handle
return array
    protected function readColumns($handle)
    {
        if ($handle === false) {
            throw new \RuntimeException("Could not read file '{$this->options['file']}'");
        }
        $columns = $this->readLine($handle);
        if ($columns === false) {
            throw new \RuntimeException("Failed to determine csv columns");
        }
        /**
         * Result:
         * array(
         *    'ColumnName1' => 0,
         *    'ColumnName2' => 1
         * )
         */
        $columns = array_flip($columns);
        return $columns;
    }