From c461825a275458ec7eb61c6774f08960e460c4a9 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 23 Apr 2019 11:40:45 +0200 Subject: [PATCH] Visual Console Refactor: some parameters aren't required anymore Former-commit-id: 3788b8dc8c055a04a627bf99e12ab30420d54351 --- .../models/VisualConsole/Items/Group.php | 92 ++++++++----------- 1 file changed, 38 insertions(+), 54 deletions(-) diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php index b2350aeec3..d433636e11 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Group.php @@ -49,60 +49,6 @@ final class Group extends Item } - /** - * Extract a image src value. - * - * @param array $data Unknown input data structure. - * - * @return mixed String representing the image url (not empty) or null. - * - * @throws \InvalidArgumentException When a valid image src can't be found. - */ - private static function extractImageSrc(array $data): string - { - $imageSrc = static::notEmptyStringOr( - static::issetInArray($data, ['imageSrc', 'image']), - null - ); - - if ($imageSrc === null) { - throw new \InvalidArgumentException( - 'the image src property is required and should be a non empty string' - ); - } - - return $imageSrc; - } - - - /** - * Extract a status image src value. - * - * @param array $data Unknown input data structure. - * - * @return mixed String representing the status image url (not empty) - * or null. - * - * @throws \InvalidArgumentException When a valid status image src - * can't be found. - */ - private static function extractStatusImageSrc(array $data): string - { - $statusImageSrc = static::notEmptyStringOr( - static::issetInArray($data, ['statusImageSrc']), - null - ); - - if ($statusImageSrc === null) { - throw new \InvalidArgumentException( - 'the status image src property is required and should be a non empty string' - ); - } - - return $statusImageSrc; - } - - /** * Extract a group Id value. * @@ -129,6 +75,44 @@ final class Group extends Item } + /** + * Extract a image src value. + * + * @param array $data Unknown input data structure. + * + * @return mixed String representing the image url (not empty) or null. + * + * @throws \InvalidArgumentException When a valid image src can't be found. + */ + private static function extractImageSrc(array $data): string + { + return static::notEmptyStringOr( + static::issetInArray($data, ['imageSrc', 'image']), + null + ); + } + + + /** + * Extract a status image src value. + * + * @param array $data Unknown input data structure. + * + * @return mixed String representing the status image url (not empty) + * or null. + * + * @throws \InvalidArgumentException When a valid status image src + * can't be found. + */ + private static function extractStatusImageSrc(array $data): string + { + return static::notEmptyStringOr( + static::issetInArray($data, ['statusImageSrc']), + null + ); + } + + /** * Extract a show Statistics value. *