<commit_before><?php

/**
 * This file is part of the Force Components.
 *
 * (c) <NAME> / Awilum <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

class Arr
{
    /**
     * Protected constructor since this is a static class.
     *
     * @access  protected
     */
    protected function __construct()
    {
        // Nothing here
    }

    /**
     * Subval sort
     *
     *  <code>
     *      $new_array = Arr::subvalSort($old_array, 'sort');
     *  </code>
     *
     * @param  array  $a      Array
     * @param  string $subkey Key
     * @param  string $order  Order type DESC or ASC
     * @return array
     */
     public function subvalSort($a, $subkey, $order = null)
     {
         if (count($a) != 0 || (!empty($a))) {
             foreach ($a as $k => $v) {
                 $b[$k] = function_exists('mb_strtolower') ? mb_strtolower($v[$subkey]) : strtolower($v[$subkey]);
             }
             if ($order == null || $order == 'ASC') {
                 asort($b);
             } elseif ($order == 'DESC') {
                 arsort($b);
             }
             foreach ($b as $key => $val) {
                 $c[] = $a[$key];
             }
             return $c;
         }
     }

    /**
     * Returns value from array using "dot notation".
     * If the key does not exist in the array, the default value will be returned instead.
     *
     *  <code>
     *      $login = Arr::get($_POST, 'login');<commit_msg>General Engine Improvements - Arr::subvalSort() bugfix #20<commit_after><?php

/**
 * This file is part of the Force Components.
 *
 * (c) <NAME> / Awilum <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

class Arr
{
    /**
     * Protected constructor since this is a static class.
     *
     * @access  protected
     */
    protected function __construct()
    {
        // Nothing here
    }

    /**
     * Subval sort
     *
     *  <code>
     *      $new_array = Arr::subvalSort($old_array, 'sort');
     *  </code>
     *
     * @param  array  $a      Array
     * @param  string $subkey Key
     * @param  string $order  Order type DESC or ASC
     * @return array
     */
     public static function subvalSort($a, $subkey, $order = null)
     {
         if (count($a) != 0 || (!empty($a))) {
             foreach ($a as $k => $v) {
                 $b[$k] = function_exists('mb_strtolower') ? mb_strtolower($v[$subkey]) : strtolower($v[$subkey]);
             }
             if ($order == null || $order == 'ASC') {
                 asort($b);
             } elseif ($order == 'DESC') {
                 arsort($b);
             }
             foreach ($b as $key => $val) {
                 $c[] = $a[$key];
             }
             return $c;
         }
     }

    /**
     * Returns value from array using "dot notation".
     * If the key does not exist in the array, the default value will be returned instead.
     *
     *  <code>
     *      $login = Arr::get($_POST, 'login');
{'fraction_non_alphanumeric': 0.14185750636132316, 'fraction_numerical': 0.001272264631043257, 'mean_word_length': 1.6495366470092672, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2459576', 'n_tokens_mistral': 950, 'n_tokens_neox': 950, 'n_words': 283}