Project

General

Profile

Actions

Feature proposal #7190

open

Improve Get array handling

Added by krileon almost 6 years ago. Updated 5 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 #1

Updated by krileon almost 6 years ago

  • Target version changed from CB 2.2 to CB 2.8
Actions #2

Updated by beat about 1 year ago

  • Target version changed from CB 2.8 to CB 2.8.1
Actions #3

Updated by beat 8 months ago

  • Target version changed from CB 2.8.1 to CB 2.8.2
Actions #4

Updated by beat 7 months ago

  • Target version changed from CB 2.8.2 to CB 2.9.0
Actions #5

Updated by beat 5 months ago

  • Target version changed from CB 2.9.0 to CB 2.9.2
Actions

Also available in: Atom PDF