Don't parse $object->check_execution_time w/ regex as it's always a float (or null)

This commit is contained in:
Alexander A. Klimov 2015-05-18 13:35:38 +02:00
parent 2f98733944
commit 4ff7d7a845
1 changed files with 2 additions and 11 deletions

View File

@ -68,17 +68,8 @@ if ($object->getType() === $object::TYPE_HOST) {
<?php if ($object->check_execution_time): ?>
<tr>
<th><?= $this->translate('Check execution time') ?></th>
<td><?php
$matches = array();
if (preg_match(
'/(?<!.)([0-9]+\.[0-9]{4,})(?!.)/ms',
$object->check_execution_time,
$matches
)) {
printf('%.3f', (float) $matches[1]);
} else {
echo $object->check_execution_time;
}
<td><?= $object->check_execution_time === null
? '-' : round((float) $object->check_execution_time, 3)
?>s</td>
</tr>
<?php endif ?>