« Previous | Next » 

Revision 69bd32c6

ID69bd32c6c0af1bb4ad10b73178a8a4a595db1777

Added by Bastian Waidelich about 8 years ago

[FEATURE] Flexible array sorter

Introduces a new utility class ``PositionalArraySorter`` that can be used to sort
an array based on a "position string".

This feature is especially useful for sorting configuration options with
multiple sources.
Example::

SomeSetting:
'key1':
foo: 'bar'
position: 'start'
'key2':
foo: 'baz'
position: 'after key1'
'key3':
foo: 'quux'
position: 'end'
possible position strings are:
  • start (<weight>)
  • end (<weight>)
  • before <key> (<weight>)
  • after <key> (<weight>)
  • <numerical-order>

Usage::

$arraySorter = new PositionalArraySorter($unorderedArray);
$orderedArray = $arraySorter-&gt;toArray();

Change-Id: If7487f8724462a5ff48375eda1085a2831becf5a
Resolves: #52074
Releases: master

  • added
  • modified
  • copied
  • renamed
  • deleted