<commit_before><?php

namespace allejo\stakx\Twig;

use allejo\stakx\Object\ContentItem;

class OrderFilter
{
    public function __invoke ($array, $key, $order = "ASC")
    {
        if (!is_array($array))
        {
            return $array;
        }

        usort($array, function ($a, $b) use ($key, $order)
        {
            $a = ($a instanceof ContentItem) ? $a->getFrontMatter() : $a;
            $b = ($b instanceof ContentItem) ? $b->getFrontMatter() : $b;
<commit_msg>Fix order filter to work with PageViews<commit_after><?php

namespace allejo\stakx\Twig;

use allejo\stakx\Object\FrontMatterObject;

class OrderFilter
{
    public function __invoke ($array, $key, $order = "ASC")
    {
        if (!is_array($array))
        {
            return $array;
        }

        usort($array, function ($a, $b) use ($key, $order)
        {
            $a = ($a instanceof FrontMatterObject) ? $a->getFrontMatter() : $a;
            $b = ($b instanceof FrontMatterObject) ? $b->getFrontMatter() : $b;

{'fraction_non_alphanumeric': 0.15019762845849802, 'fraction_numerical': 0.0, 'mean_word_length': 2.4338983050847456, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2232646', 'n_tokens_mistral': 336, 'n_tokens_neox': 335, 'n_words': 80}