WindDirection.php 566 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Yr\Forecast\Tabular\Time;
  3. class WindDirection extends AbstractUnit{
  4. private $name;
  5. public function __construct(\SimpleXMLElement $xml) {
  6. parent::__construct(
  7. (float)$xml['deg'],
  8. (string)$xml['code']
  9. );
  10. $this->name = (string)$xml['name'];
  11. }
  12. public function diff(DiffInterface $d): bool {
  13. if (parent::diff($d))
  14. return $this->getUnit() != $f->getUnit();
  15. return false;
  16. }
  17. public function getName(): string {
  18. return $this->name;
  19. }
  20. }