コード例 #1
0
 public function __construct($timeString)
 {
     if (is_int($timeString)) {
         $this->inSeconds = $timeString;
         return;
     }
     if (!Zeit::IsValidTime($timeString)) {
         throw new DatumException("Keine gültige Zeit übergeben: {$timeString}");
     }
     preg_match('/^([0-9]{2}):([0-9]{2}):([0-9]{2})$/', $timeString, $match);
     $this->inSeconds = ($match[1] == 24 ? 0 : $match[1]) * 3600 + $match[2] * 60 + $match[3];
 }
コード例 #2
0
 public function testIsValidTimeFail()
 {
     $this->assertFalse(Zeit::IsValidTime("09:18:77"));
 }