Visual Console Refactor: some parameters aren't required anymore

Former-commit-id: 3788b8dc8c055a04a627bf99e12ab30420d54351
This commit is contained in:
Alejandro Gallardo Escobar 2019-04-23 11:40:45 +02:00
parent 3a3c62a855
commit c461825a27
1 changed files with 38 additions and 54 deletions

View File

@ -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. * 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. * Extract a show Statistics value.
* *