Clean up API routes

This commit is contained in:
James Cole
2024-10-20 17:55:06 +02:00
parent 6ff84b8e90
commit acadc89eaa
5 changed files with 69 additions and 94 deletions

View File

@@ -105,11 +105,11 @@ trait ConvertsDataTypes
/**
* Return string value.
*/
public function convertString(string $field): string
public function convertString(string $field, string $default = ''): string
{
$entry = $this->get($field);
if (!is_scalar($entry)) {
return '';
return $default;
}
return (string)$this->clearString((string)$entry);