Type hinting and using original method instead of alias

This commit is contained in:
Daniel Röhrig 2019-10-25 22:01:42 +02:00
Родитель fc35e1b2b0
Коммит 4b8be45399
1 изменённых файлов: 5 добавлений и 3 удалений

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

@ -114,13 +114,15 @@ class RecipeService
* @param array $json
*
* @return array
*
* @throws Exception
*/
public function checkRecipe($json)
public function checkRecipe(array $json): array
{
if (!$json) {
throw new Exception('Recipe array was null');
}
if (!isset($json['name']) || !$json['name']) {
if (empty($json['name'])) {
throw new Exception('Field "name" is required');
}
@ -479,7 +481,7 @@ class RecipeService
$user_folder = $this->getFolderForUser();
$recipe_folder = $user_folder->getById($id);
if ($recipe_folder && sizeof($recipe_folder) > 0) {
if ($recipe_folder && count($recipe_folder) > 0) {
$recipe_folder[0]->delete();
}