Clean up requests

This commit is contained in:
James Cole
2020-07-18 08:42:13 +02:00
parent 58c1880219
commit c7eab7873e
21 changed files with 60 additions and 52 deletions

View File

@@ -64,6 +64,25 @@ trait ConvertsDataTypes
return (int) $this->get($field);
}
/**
* Return floating value.
*
* @param string $field
*
* @return float|null
*/
protected function float(string $field): ?float
{
$res = $this->get($field);
if (null === $res) {
return null;
}
return (float) $res;
}
/**
* Parse and clean a string, but keep the newlines.
*