twig_check_arrow_in_sandbox example


function twig_sort_filter(Environment $env$array$arrow = null)
{
    if ($array instanceof \Traversable) {
        $array = iterator_to_array($array);
    } elseif (!\is_array($array)) {
        throw new RuntimeError(sprintf('The sort filter only works with arrays or "Traversable", got "%s".', \gettype($array)));
    }

    if (null !== $arrow) {
        twig_check_arrow_in_sandbox($env$arrow, 'sort', 'filter');

        uasort($array$arrow);
    } else {
        asort($array);
    }

    return $array;
}

/** * @internal */
Home | Imprint | This part of the site doesn't use cookies.