name = (string)$xml['name']; } /** * Returns the wind direction in full, * e.g «Northeast». * * @return string */ public function getName(): string { return $this->name; } /** * Returns a direction on the compass, not * in degree, but in interger between 1 - 16, * each explining which spectre. * * E.g * 1: North, * 2: North-northeast, * 3: North-east, * [...] * 9: South * etc.. * * @return int compass spectre */ public function getDirection(): int { return (($this->getValue()-11.5) / 22.5); } /** * {@inheritDoc} */ public function diff(DiffInterface $d): int { if (parent::diff($d)) return $this->getDirection() - $d->getDirection(); return 0; } }