Visual Console Refactor: error fix

Former-commit-id: f627143575317076eb9998f7e09029c3063870ca
This commit is contained in:
Alejandro Gallardo Escobar 2019-04-03 12:11:13 +02:00
parent 24d8964fd9
commit 32ba3aa1d4
1 changed files with 8 additions and 4 deletions

View File

@ -39,7 +39,7 @@ final class SimpleValue extends Item
* @throws \InvalidArgumentException If any input value is considered
* invalid.
*
* @overrides Item::validateData.
* @overrides Item->validateData.
*/
protected function validateData(array $data): void
{
@ -59,19 +59,20 @@ final class SimpleValue extends Item
*
* @return array Data structure representing the model.
*
* @overrides Item::decode.
* @overrides Item->decode.
*/
protected function decode(array $data): array
{
$return = parent::decode($data);
$return['type'] = SIMPLE_VALUE;
$return['processValue'] = static::extractProcessValue($data);
$return['valueType'] = static::extractValueType($data);
$return['value'] = $data['value'];
if ($return['processValue'] !== 'none') {
$return['period'] = static::extractPeriod($data);
}
$return['valueType'] = static::extractValueType($data);
$return['value'] = $data['value'];
return $return;
}
@ -176,6 +177,9 @@ final class SimpleValue extends Item
if (\preg_match('/src=\"(data:image.*)"/', $value, $matches) === 1) {
$data['valueType'] = 'image';
$data['value'] = $matches[1];
} else {
$data['valueType'] = 'string';
$data['value'] = $value;
}
return $data;