Piwik\DataTable::getLastRow PHP Метод

getLastRow() публичный Метод

Returns the last row of the DataTable. If there is a summary row, it will always be considered the last row.
public getLastRow ( ) : Row | false
Результат Piwik\DataTable\Row | false The last row or `false` if it cannot be found.
    public function getLastRow()
    {
        if (!is_null($this->summaryRow)) {
            return $this->summaryRow;
        }
        if (count($this->rows) == 0) {
            return false;
        }
        return end($this->rows);
    }

Usage Example

Пример #1
0
 private function getFirstAndLastDataPointsForMetric($metric)
 {
     $first = 0;
     $firstTable = $this->dataTable->getFirstRow();
     if (!empty($firstTable)) {
         $row = $firstTable->getFirstRow();
         if (!empty($row)) {
             $first = floatval($row->getColumn($metric));
         }
     }
     $last = 0;
     $lastTable = $this->dataTable->getLastRow();
     if (!empty($lastTable)) {
         $row = $lastTable->getFirstRow();
         if (!empty($row)) {
             $last = floatval($row->getColumn($metric));
         }
     }
     return array($first, $last);
 }