private function Formatter::is_number in Forena Reports 8
Determines if a value is a number.
Parameters
$value:
Return value
bool
1 call to Formatter::is_number()
- Formatter::number in src/
FrxPlugin/ FieldFormatter/ Formatter.php - Format field as a number
File
- src/
FrxPlugin/ FieldFormatter/ Formatter.php, line 48 - contains various methods for extending report formating, layout, transformation and design.
Class
- Formatter
- Formatter for common drupal fields.
Namespace
Drupal\forena\FrxPlugin\FieldFormatterCode
private function is_number($value) {
$non_numeric_chars = trim($value, ' +-.,0123456789');
// Determine if it contains +- in the interior
// Zero is ok here bu
$inner_symbols = FALSE;
if (strpos($value, '+') || strpos($value, '-') || strpos($value, ' ')) {
$inner_symbols = TRUE;
}
return empty($non_numeric_chars) && trim($value) !== '' && !$inner_symbols ? TRUE : FALSE;
}