value = $value; $this->unit = $unit; } public function getValue(): float { return $this->value; } public function getUnit(): string { return $this->unit; } public function setThresholdValue(int $t): self { $this->threshold = $t; } public function diff(DiffInterface $d): bool { if ($d instanceof $this) return abs($this->value - $d->getValue()) > static::DEFAULT_VARIANCE; return false; } public function __toString(): string { return sprintf( "%s: %f %s", basename(str_replace( '\\', DIRECTORY_SEPARATOR, get_class($this) )), $this->value, $this->unit); } }