Perfdata: simplify code design

refs #8194
This commit is contained in:
Alexander A. Klimov 2016-04-27 11:35:44 +02:00 committed by Johannes Meyer
parent e006902254
commit 7865db9053

View File

@ -111,7 +111,7 @@ class Perfdata
{ {
if (empty($perfdata)) { if (empty($perfdata)) {
throw new InvalidArgumentException('Perfdata::fromString expects a string with content'); throw new InvalidArgumentException('Perfdata::fromString expects a string with content');
} elseif (false === strpos($perfdata, '=')) { } elseif (strpos($perfdata, '=') === false) {
throw new InvalidArgumentException( throw new InvalidArgumentException(
'Perfdata::fromString expects a key=value formatted string. Got "' . $perfdata . '" instead' 'Perfdata::fromString expects a key=value formatted string. Got "' . $perfdata . '" instead'
); );
@ -211,8 +211,8 @@ class Perfdata
} }
if ($this->maxValue !== null) { if ($this->maxValue !== null) {
$minValue = $this->minValue !== null ? $this->minValue : 0; $minValue = $this->minValue !== null ? $this->minValue : 0.0;
if ((float) ($this->maxValue - $minValue) === 0.0) { if ($this->maxValue == $minValue) {
return null; return null;
} }