public function testGetLongestTime() { $this->assertSame('2s', \histou\helper\CustomTime::getLongestTime(array("1s", "2s"))); $this->assertSame('60s', \histou\helper\CustomTime::getLongestTime(array("60s", "1m"))); $this->assertSame('2m', \histou\helper\CustomTime::getLongestTime(array("100s", "2m"))); $this->assertSame('0s', \histou\helper\CustomTime::getLongestTime(array())); }
/** Creates a array, with all sub elements. @return array **/ public function toArray() { foreach ($this->rows as $row) { array_push($this->data['rows'], $row->toArray()); } if (!empty(Dashboard::$forecast)) { $this->data['time']['to'] = 'now+' . \histou\helper\CustomTime::getLongestTime(Dashboard::$forecast); } return $this->data; }