Piwik\DataTable::getFirstRow PHP Méthode

getFirstRow() public méthode

Returns the first row of the DataTable.
public getFirstRow ( ) : Row | false
Résultat Piwik\DataTable\Row | false The first row or `false` if it cannot be found.
    public function getFirstRow()
    {
        if (count($this->rows) == 0) {
            if (!is_null($this->summaryRow)) {
                return $this->summaryRow;
            }
            return false;
        }
        return reset($this->rows);
    }

Usage Example

 public function test_filter_shouldNotAppendAnything_IfNameToReplaceIsEmpty()
 {
     $columnNamesBefore = array('nb_visits', 'nb_conversions', 'revenue', 'conversion_rate');
     $this->table->filter($this->filter, array(''));
     $this->table->filter($this->filter, array(null));
     $this->table->filter($this->filter, array(false));
     $columnNamesAfter = array_keys($this->table->getFirstRow()->getColumns());
     $this->assertSame($columnNamesBefore, $columnNamesAfter);
 }
All Usage Examples Of Piwik\DataTable::getFirstRow