DiffEntity.php 534 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Yr\Forecast\Tabular\Time;
  3. class DiffEntity implements DiffInterface {
  4. private $time;
  5. private $entity;
  6. public function __construct(Time $t, DiffInterface $d) {
  7. $this->time = $t;
  8. $this->entity = $d;
  9. }
  10. public function getOccuringTime(): \DateTimeInterface {
  11. return $time->getFrom();
  12. }
  13. public function diff(DiffInterface $d): bool {
  14. if ($d instanceof get_class($this->entity))
  15. return $this->entity->diff($d);
  16. return false;
  17. }
  18. }