Project

General

Profile

Actions

Feature proposal #7190

open

Improve Get array handling

Added by krileon over 6 years ago. Updated 3 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Start date:
15 June 2018
Due date:
% Done:

0%

Estimated time:

Description

Improve Get array handling to handle more strict dimensional arrays. Examples as follows.

array( GetterInterface::STRING )

The above returns the following IF values exist.

array( 'string', 'string', 'string' )

If no values exist you get the following.

array( 0 => null )

This is due to the $default, which should probably just be returned if no values are found. In short the nested values $default should always be null. If returned value is null then don't add it to the array. If the array is empty then return $default. This would give you the following as the return instead of above.

array()

For multi dimensional arrays the default fallback needs to be applied to sub types. Example as follows. Note the below usage is not used anywhere and can be freely improved without B/C concerns.

array( GetterInterface::STRING, 'type_1' => array( 'subtype_1' => GetterInterface::COMMAND ) )

With the above type_1 array is passed down and has no default. So subtype_1 is casted to command, but other keys in the array aren't casted to anything. The string typing should inherit.

Actions

Also available in: Atom PDF