Exemple #1
0
 /**
  * Converts a value from its database representation to its PHP representation
  *
  * @param mixed            $value    The value to convert
  * @param AbstractPlatform $platform The currently used database platform
  *
  * @return mixed
  *
  * @throws ConversionException When the conversion fails
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return null;
     }
     if ($value instanceof Time) {
         return $value;
     }
     try {
         $time = Time::fromString($value);
     } catch (Exception $exception) {
         throw ConversionException::conversionFailed($value, static::TYPE_NAME);
     }
     return $time;
 }
Exemple #2
0
 /**
  * @expectedException \AssertionError
  */
 public function test_that_compare_to_throws_exception_for_invalid_argument()
 {
     $time = Time::create(16, 30, 6);
     $time->compareTo('16:30:06');
 }
Exemple #3
0
 /**
  * Retrieves the microsecond
  *
  * @return int
  */
 public function micro()
 {
     return $this->time->micro();
 }
Exemple #4
0
 public function test_that_with_time_returns_expected_instance()
 {
     $dateTime = DateTime::now();
     $dateTime = $dateTime->withTime(Time::create(12, 0, 0));
     $this->assertSame('12:00:00', $dateTime->time()->toString());
 }
Exemple #5
0
 /**
  * Retrieves the second
  *
  * @return int
  */
 public function second() : int
 {
     return $this->time->second();
 }
Exemple #6
0
 /**
  * @expectedException Novuso\System\Exception\DomainException
  */
 public function test_that_from_string_throws_exception_for_invalid_format()
 {
     Time::fromString('16:30:06');
 }