A collator class with static methods that can be used for sorting.  
 More...
|  | 
| static | asort (array &$arr, $sortflag=core_collator::SORT_STRING) | 
|  | Locale aware sorting, the key associations are kept, values are sorted alphabetically. 
 | 
|  | 
| static | asort_array_of_arrays_by_key (array &$array, $key, $sortflag=core_collator::SORT_STRING) | 
|  | Locale aware sort of array of arrays. 
 | 
|  | 
| static | asort_objects_by_method (array &$objects, $method, $sortflag=core_collator::SORT_STRING) | 
|  | Locale aware sort of objects by a method in common to all objects. 
 | 
|  | 
| static | asort_objects_by_property (array &$objects, $property, $sortflag=core_collator::SORT_STRING) | 
|  | Locale aware sort of objects by a property in common to all objects. 
 | 
|  | 
| static | callback_naturalise ($matches) | 
|  | 
| static | ksort (array &$arr, $sortflag=core_collator::SORT_STRING) | 
|  | Locale aware sorting, the key associations are kept, keys are sorted alphabetically. 
 | 
|  | 
|  | 
| do const | CASE_SENSITIVE = 64 | 
|  | not ignore case when sorting, use bitwise "|" with SORT_NATURAL or SORT_STRING, equivalent to Collator\UPPER_FIRST 
 | 
|  | 
| compare const | SORT_NATURAL = 6 | 
|  | items like natsort(), equivalent to SORT_NATURAL 
 | 
|  | 
| compare const | SORT_NUMERIC = 2 | 
|  | items as numbers, equivalent to Collator\SORT_NUMERIC 
 | 
|  | 
| compare const | SORT_REGULAR = 0 | 
|  | items using general PHP comparison, equivalent to Collator\SORT_REGULAR, this may bot be locale aware! 
 | 
|  | 
| compare const | SORT_STRING = 1 | 
|  | items as strings, equivalent to Collator\SORT_STRING 
 | 
|  | 
|  | 
| static | ensure_collator_available () | 
|  | Ensures that a collator is available and created. 
 | 
|  | 
| static | naturalise ($string) | 
|  | Normalise numbers in strings for natural sorting comparisons. 
 | 
|  | 
| static | restore_array (array &$arr, array &$original) | 
|  | Restore array contents keeping new keys. 
 | 
|  | 
|  | 
| static Collator false null | $collator = null | 
|  | 
| static string null | $locale = null | 
|  | The locale that was used in instantiating the current collator. 
 | 
|  | 
A collator class with static methods that can be used for sorting. 
- Copyright
- 2011 Sam Hemelryk 2012 Petr Skoda 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ asort()
  
  | 
        
          | static core_collator::asort | ( | array & | $arr, |  
          |  |  |  | $sortflag = core_collator::SORT_STRING ) |  | static | 
 
Locale aware sorting, the key associations are kept, values are sorted alphabetically. 
- Parameters
- 
  
    | array | $arr | array to be sorted (reference) |  | int | $sortflag | One of core_collator\SORT_NUMERIC, core_collator\SORT_STRING, core_collator\SORT_NATURAL, core_collator\SORT_REGULAR optionally "|" core_collator\CASE_SENSITIVE |  
 
- Return values
- 
  
  
 
 
◆ asort_array_of_arrays_by_key()
  
  | 
        
          | static core_collator::asort_array_of_arrays_by_key | ( | array & | $array, |  
          |  |  |  | $key, |  
          |  |  |  | $sortflag = core_collator::SORT_STRING ) |  | static | 
 
Locale aware sort of array of arrays. 
Given an array like: $array = array( array('name' => 'bravo'), array('name' => 'charlie'), array('name' => 'alpha') );
If you call: core_collator\asort_array_of_arrays_by_key($array, 'name')
You will be returned $array sorted by the name key of the subarrays. e.g. $array = array( array('name' => 'alpha'), array('name' => 'bravo'), array('name' => 'charlie') );
- Parameters
- 
  
    | array | $array | An array of objects to sort (handled by reference) |  | string | $key | The key to use for comparison |  | int | $sortflag | One of core_collator\SORT_NUMERIC, core_collator\SORT_STRING, core_collator\SORT_NATURAL, core_collator\SORT_REGULAR optionally "|" core_collator\CASE_SENSITIVE |  
 
- Return values
- 
  
  
 
 
◆ asort_objects_by_method()
  
  | 
        
          | static core_collator::asort_objects_by_method | ( | array & | $objects, |  
          |  |  |  | $method, |  
          |  |  |  | $sortflag = core_collator::SORT_STRING ) |  | static | 
 
Locale aware sort of objects by a method in common to all objects. 
- Parameters
- 
  
    | array | $objects | An array of objects to sort (handled by reference) |  | string | $method | The method to call to generate a value for comparison |  | int | $sortflag | One of core_collator\SORT_NUMERIC, core_collator\SORT_STRING, core_collator\SORT_NATURAL, core_collator\SORT_REGULAR optionally "|" core_collator\CASE_SENSITIVE |  
 
- Return values
- 
  
  
 
 
◆ asort_objects_by_property()
  
  | 
        
          | static core_collator::asort_objects_by_property | ( | array & | $objects, |  
          |  |  |  | $property, |  
          |  |  |  | $sortflag = core_collator::SORT_STRING ) |  | static | 
 
Locale aware sort of objects by a property in common to all objects. 
- Parameters
- 
  
    | array | $objects | An array of objects to sort (handled by reference) |  | string | $property | The property to use for comparison |  | int | $sortflag | One of core_collator\SORT_NUMERIC, core_collator\SORT_STRING, core_collator\SORT_NATURAL, core_collator\SORT_REGULAR optionally "|" core_collator\CASE_SENSITIVE |  
 
- Return values
- 
  
  
 
 
◆ ensure_collator_available()
  
  | 
        
          | static core_collator::ensure_collator_available | ( |  | ) |  |  | staticprotected | 
 
Ensures that a collator is available and created. 
- Return values
- 
  
    | bool | Returns true if collation is available and ready |  
 
 
 
◆ ksort()
  
  | 
        
          | static core_collator::ksort | ( | array & | $arr, |  
          |  |  |  | $sortflag = core_collator::SORT_STRING ) |  | static | 
 
Locale aware sorting, the key associations are kept, keys are sorted alphabetically. 
- Parameters
- 
  
    | array | $arr | array to be sorted (reference) |  | int | $sortflag | One of core_collator\SORT_NUMERIC, core_collator\SORT_STRING, core_collator\SORT_NATURAL, core_collator\SORT_REGULAR optionally "|" core_collator\CASE_SENSITIVE |  
 
- Return values
- 
  
  
 
 
◆ naturalise()
  
  | 
        
          | static core_collator::naturalise | ( |  | $string | ) |  |  | staticprotected | 
 
Normalise numbers in strings for natural sorting comparisons. 
- Parameters
- 
  
  
- Return values
- 
  
    | string | string with normalised numbers |  
 
 
 
◆ restore_array()
  
  | 
        
          | static core_collator::restore_array | ( | array & | $arr, |  
          |  |  | array & | $original ) |  | staticprotected | 
 
Restore array contents keeping new keys. 
- Parameters
- 
  
  
- Return values
- 
  
  
 
 
The documentation for this class was generated from the following file: