MCPcopy Create free account
hub / github.com/Rello/analytics / floatvalue

Method floatvalue

lib/Service/StorageService.php:237–252  ·  view source on GitHub ↗
($val)

Source from the content-addressed store, hash-verified

235 }
236
237 private function floatvalue($val) {
238 // if value is a 3 digit comma number with one leading zero like 0,111, it should not go through the 1000 separator removal
239 if (preg_match('/(?<=\b0),(?=\d{3}\b)/', $val) === 1 && preg_match('/(?<=\b0).(?=\d{3}\b)/', $val) === 1) {
240 // remove , as 1000 separator
241 $val = preg_replace('/(?<=\d)\,(?=\d{3}\b)/', '', $val);
242 // remove . as 1000 separator
243 $val = preg_replace('/(?<=\d)\.(?=\d{3}\b)/', '', $val);
244 }
245 // convert remaining comma to decimal point
246 $val = str_replace(",", ".", $val);
247 if (is_numeric($val)) {
248 return number_format(floatval($val), 2, '.', '');
249 } else {
250 return false;
251 }
252 }
253
254 private function convertGermanDateFormat($val) {
255 if ($val !== null) {

Callers 1

updateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected