Exemplo n.º 1
0
 /**
  * @return Duration
  */
 public function duration()
 {
     return Duration::createFromDateInterval($this->start()->toDateTime()->diff($this->end()->toDateTime()));
 }
Exemplo n.º 2
0
 /**
  * @param Duration $duration
  *
  * @return self
  */
 public function sub(Duration $duration)
 {
     return static::createFromDateTime($this->toDateTime()->sub($duration->toDateInterval()));
 }
 /**
  * @return array
  */
 public function validProvider()
 {
     return [[Date::create(2015, 6, 15), Duration::create(0, 0, 2, 0, 0, 0), 5, 'R5/2015-06-15T00:00:00Z/P2D']];
 }
Exemplo n.º 4
0
 public function validProvider()
 {
     return [[Date::create(2015, 6, 15), Date::create(2015, 6, 17), Duration::create(0, 0, 2, 0, 0, 0), '2015-06-15T00:00:00/2015-06-17T00:00:00'], [DateTimeOfDay::create(Date::create(2012, 6, 17), TimeOfDay::create(23, 1, 0)), DateTimeOfDay::create(Date::create(2015, 6, 17), TimeOfDay::create(23, 2, 0)), Duration::create(3, 0, 0, 0, 1, 0)], [Date::create(2015, 6, 15), Duration::create(0, 1, 5, 0, 0, 0), Duration::create(0, 1, 5, 0, 0, 0)], [Duration::create(0, 5, 12, 0, 0, 0), Date::create(2015, 6, 17), Duration::create(0, 5, 12, 0, 0, 0), '2015-01-05T00:00:00/2015-06-17T00:00:00']];
 }
Exemplo n.º 5
0
 /**
  * @dataProvider validProvider
  * @expectedException \Zelenin\Ddd\Core\Domain\Exception\NotMatchTypeException
  */
 public function testEqualsNotSameType($year, $month, $day, $hour, $minute, $second, $iso8601format)
 {
     $object1 = Duration::create($year, $month, $day, $hour, $minute, $second);
     $object2 = Date::create(1, 1, 1);
     $object1->equalsTo($object2);
 }