Skip to content

Commit

Permalink
1.38.0
Browse files Browse the repository at this point in the history
[+] Release
  • Loading branch information
wombat committed Sep 25, 2019
1 parent 4fcee93 commit 3667f05
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions functions/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ function array_fill_like_list(array &$target_array, array $indexes, array $sourc
function array_search_callback(array $a, callable $callback);
function array_sort_in_given_order(array $array, array $order, $sort_key):array;

function http_redirect($uri, $replace_prev_headers = false, $code = 302, $scheme = '');

function pluralForm($number, $forms, string $glue = '|'):string;
}

if (!function_exists('Arris\checkAllowedValue')) {
Expand Down Expand Up @@ -254,6 +257,35 @@ function http_redirect($uri, $replace_prev_headers = false, $code = 302, $scheme
}
}

if (!function_exists('Arris\pluralForm')) {
/**
*
* @param $number
* @param array $forms (array or string with glues, x|y|z or [x,y,z]
* @param string $glue
* @return string
*/
function pluralForm($number, $forms, string $glue = '|'):string
{
if (is_string($forms)) {
$forms = explode($forms, $glue);
} elseif (!is_array($forms)) {
return '';
}

if (count($forms) != 3) return '';

return
($number % 10 == 1 && $number % 100 != 11)
? $forms[0]
: (
($number % 10 >= 2 && $number % 10 <= 4 && ($number % 100 < 10 || $number % 100 >= 20))
? $forms[1]
: $forms[2]
);
}
}

// template function
if (!function_exists('Arris\__template__')) {
function __template__()
Expand Down

0 comments on commit 3667f05

Please sign in to comment.