Piwik\DataTable\Filter\Sort::__construct PHP Method

__construct() public method

Constructor.
public __construct ( DataTable $table, string $columnToSort, string $order = 'desc', boolean $naturalSort = true, boolean $recursiveSort = true, boolean $doSortBySecondaryColumn = false )
$table Piwik\DataTable The table to eventually filter.
$columnToSort string The name of the column to sort by.
$order string order `'asc'` or `'desc'`.
$naturalSort boolean Whether to use a natural sort or not (see {@link http://php.net/natsort}).
$recursiveSort boolean Whether to sort all subtables or not.
$doSortBySecondaryColumn boolean If true will sort by a secondary column. The column is automatically detected and will be either nb_visits or label, if possible.
    public function __construct($table, $columnToSort, $order = 'desc', $naturalSort = true, $recursiveSort = true, $doSortBySecondaryColumn = false)
    {
        parent::__construct($table);
        if ($recursiveSort) {
            $table->enableRecursiveSort();
        }
        $this->columnToSort = $columnToSort;
        $this->naturalSort = $naturalSort;
        $this->order = strtolower($order);
        $this->isSecondaryColumnSortEnabled = $doSortBySecondaryColumn;
    }