private function applyColumns($matches)
    {
        if (empty($matches) || empty($this->columns) || in_array('*', $this->columns)) {
            return $matches;
        }

        $availableColumns = array_keys(reset($matches));
        $requestedColumns = $this->columns;

        if (count($this->columns) == 1 && $this->columns[0] != '*') {
            $result = [];

            foreach ($matches as $match) {
                $result[] = $match[$this->columns[0]];
            }

            return $result;
        }

        foreach (array_diff($availableColumns, $this->columns) as $remove) {
            foreach ($matches as &$match) {
                unset($match[$remove]);
            }
        }

        return $matches;
    }
private function applyColumns($matches)
    {
        if (empty($matches) || empty($this->columns) || in_array('*', $this->columns)) {
            return $matches;
        }

        $availableColumns = array_keys(reset($matches));
        $requestedColumns = $this->columns;

        if (count($this->columns) == 1 && $this->columns[0] != '*') {
            $result = [];

            foreach ($matches as $match) {
                $result[] = $match[$this->columns[0]];
            }

            return $result;
        }

        foreach (array_diff($availableColumns, $this->columns) as $remove) {
            foreach ($matches as &$match) {
                unset($match[$remove]);
            }
        }

        return $matches;
    }
private function applyColumns ( $ matches ) { if ( empty ( $ matches ) || empty ( $ this -> columns ) || in_array ( '*' , $ this -> columns ) ) { return $ matches ; } $ availableColumns = array_keys ( reset ( $ matches ) ) ; $ requestedColumns = $ this -> columns ; if ( count ( $ this -> columns ) == 1 && $ this -> columns [ 0 ] != '*' ) { $ result = [ ] ; foreach ( $ matches as $ match ) { $ result [ ] = $ match [ $ this -> columns [ 0 ] ] ; } return $ result ; } foreach ( array_diff ( $ availableColumns , $ this -> columns ) as $ remove ) { foreach ( $ matches as & $ match ) { unset ( $ match [ $ remove ] ) ; } } return $ matches ; }
Apply the columns

@param   array $matches The records

@return  array
Apply the columns