You are here

protected function ParserBase::kSort in Feeds XPath Parser 8

Recursivly sorts an array.

Also casts integer string to integers.

Parameters

array $array: The array to sort.

1 call to ParserBase::kSort()
ParserBase::feedFormValidate in lib/Drupal/feeds_xpathparser/ParserBase.php
Overrides parent::feedFormValidate().

File

lib/Drupal/feeds_xpathparser/ParserBase.php, line 440
Contains \Drupal\feeds_xpathparser\ParserBase.

Class

ParserBase
Base class for the HTML and XML parsers.

Namespace

Drupal\feeds_xpathparser

Code

protected function kSort(&$array) {
  ksort($array);
  foreach ($array as $key => &$value) {
    if (is_array($value)) {
      $this
        ->kSort($value);
    }
    elseif (ctype_digit($value)) {
      $value = (int) $value;
    }
  }
}