"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Neos.Flow/Classes/Mvc/View/JsonView.php" between
flow-development-collection-7.1.0.tar.gz and flow-development-collection-7.1.1.tar.gz

About: TYPO3 Flow is a web application platform enabling developers creating fast, reliable and complex web solutions ("the next level of PHP programming"; old name "FLOW3").

JsonView.php  (flow-development-collection-7.1.0):JsonView.php  (flow-development-collection-7.1.1)
skipping to change at line 213 skipping to change at line 213
$this->controllerContext->getResponse()->setContentType('application/jso n'); $this->controllerContext->getResponse()->setContentType('application/jso n');
$propertiesToRender = $this->renderArray(); $propertiesToRender = $this->renderArray();
$options = $this->getOption('jsonEncodingOptions'); $options = $this->getOption('jsonEncodingOptions');
return json_encode($propertiesToRender, JSON_THROW_ON_ERROR | $options); return json_encode($propertiesToRender, JSON_THROW_ON_ERROR | $options);
} }
/** /**
* Loads the configuration and transforms the value to a serializable * Loads the configuration and transforms the value to a serializable
* array. * array.
* *
* @return array An array containing the values, ready to be JSON encoded * @return array|string|int|float|null An array containing the values, ready to be JSON encoded
* @api * @api
*/ */
protected function renderArray() protected function renderArray()
{ {
if (count($this->variablesToRender) === 1) { if (count($this->variablesToRender) === 1) {
$variableName = current($this->variablesToRender); $variableName = current($this->variablesToRender);
$valueToRender = $this->variables[$variableName] ?? null; $valueToRender = $this->variables[$variableName] ?? null;
$configuration = $this->configuration[$variableName] ?? []; $configuration = $this->configuration[$variableName] ?? [];
} else { } else {
$valueToRender = []; $valueToRender = [];
skipping to change at line 238 skipping to change at line 238
} }
return $this->transformValue($valueToRender, $configuration); return $this->transformValue($valueToRender, $configuration);
} }
/** /**
* Transforms a value depending on type recursively using the * Transforms a value depending on type recursively using the
* supplied configuration. * supplied configuration.
* *
* @param mixed $value The value to transform * @param mixed $value The value to transform
* @param array $configuration Configuration for transforming the value * @param array $configuration Configuration for transforming the value
* @return array The transformed value * @return array|string|int|float|null The transformed value
*/ */
protected function transformValue($value, array $configuration) protected function transformValue($value, array $configuration)
{ {
if (is_array($value) || $value instanceof \ArrayAccess) { if (is_array($value) || $value instanceof \ArrayAccess) {
$array = []; $array = [];
foreach ($value as $key => $element) { foreach ($value as $key => $element) {
if (isset($configuration['_descendAll']) && is_array($configurat ion['_descendAll'])) { if (isset($configuration['_descendAll']) && is_array($configurat ion['_descendAll'])) {
$array[$key] = $this->transformValue($element, $configuratio n['_descendAll']); $array[$key] = $this->transformValue($element, $configuratio n['_descendAll']);
} else { } else {
if (isset($configuration['_only']) && is_array($configuratio n['_only']) && !in_array($key, $configuration['_only'])) { if (isset($configuration['_only']) && is_array($configuratio n['_only']) && !in_array($key, $configuration['_only'])) {
skipping to change at line 273 skipping to change at line 273
return $value; return $value;
} }
} }
/** /**
* Traverses the given object structure in order to transform it into an * Traverses the given object structure in order to transform it into an
* array structure. * array structure.
* *
* @param object $object Object to traverse * @param object $object Object to traverse
* @param array $configuration Configuration for transforming the given obje ct or NULL * @param array $configuration Configuration for transforming the given obje ct or NULL
* @return array Object structure as an array * @return array|string Object structure as an array
*/ */
protected function transformObject($object, array $configuration) protected function transformObject($object, array $configuration)
{ {
if ($object instanceof \DateTimeInterface) { if ($object instanceof \DateTimeInterface) {
return $object->format($this->getOption('datetimeFormat')); return $object->format($this->getOption('datetimeFormat'));
} else { } else {
$propertyNames = ObjectAccess::getGettablePropertyNames($object); $propertyNames = ObjectAccess::getGettablePropertyNames($object);
$propertiesToRender = []; $propertiesToRender = [];
foreach ($propertyNames as $propertyName) { foreach ($propertyNames as $propertyName) {
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)