Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Christian Wolf 2021-05-23 19:20:51 +02:00
Родитель b0b900ffc2
Коммит 535922e5cc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9FC3120E932F73F1
1 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -216,17 +216,17 @@ class RecipeService {
// Make sure that "recipeYield" is an integer which is at least 1
if (isset($json['recipeYield']) && $json['recipeYield']) {
// Check if "recipeYield is an array
if(is_array($json['recipeYield'])) {
if(count($json['recipeYield']) == 1) {
$json['recipeYield'] = $json['recipeYield'][0];
} else {
// XXX How to parse an array correctly?
$json['recipeYield'] = join(' ', $json['recipeYield']);
}
}
$regex_matches = [];
// Check if "recipeYield is an array
if (is_array($json['recipeYield'])) {
if (count($json['recipeYield']) == 1) {
$json['recipeYield'] = $json['recipeYield'][0];
} else {
// XXX How to parse an array correctly?
$json['recipeYield'] = join(' ', $json['recipeYield']);
}
}
$regex_matches = [];
preg_match('/(\d*)/', $json['recipeYield'], $regex_matches);
if (count($regex_matches) >= 1) {
$yield = filter_var($regex_matches[0], FILTER_SANITIZE_NUMBER_INT);