<commit_before><?php

namespace munkireport;

/**
* Listings class
*
* Retrieves Listings from custom folder, module folder and Listing folder
*
*/
class Listings
{

    private $listingList = array();
    private $allowedModules = 'all';
    private $alwaysShowTheseModules = array(
      'machine',
      'reportdata',
      'tag'
    );

    public function __construct()
    {

        // Populate allowedModules if hide_inactive_modules is true
        if(conf('hide_inactive_modules')){
          $this->allowedModules = conf('modules', array()) + $this->alwaysShowTheseModules;
        }

        // Get Listings in modules
        $this->searchListingsInModules(conf('module_path'));

        // Get Listings in custom modules
        if(conf('custom_folder')){

            $customPath = conf('custom_folder');

            $this->searchListingsInModules($customPath);

            if (is_dir($customPath.'views/listing/'))
            {
                $this->searchListingsInFolder($customPath.'views/listing/', 'custom');
            }
        }
    }

    public function get()
    {
        return $this->listingList;
    }<commit_msg>Add sorter for listing<commit_after><?php

namespace munkireport;

/**
* Listings class
*
* Retrieves Listings from custom folder, module folder and Listing folder
*
*/
class Listings
{

    private $listingList = array();
    private $allowedModules = 'all';
    private $alwaysShowTheseModules = array(
      'machine',
      'reportdata',
      'tag'
    );

    public function __construct()
    {

        // Populate allowedModules if hide_inactive_modules is true
        if(conf('hide_inactive_modules')){
          $this->allowedModules = conf('modules', array()) + $this->alwaysShowTheseModules;
        }

        // Get Listings in modules
        $this->searchListingsInModules(conf('module_path'));

        // Get Listings in custom modules
        if(conf('custom_folder')){

            $customPath = conf('custom_folder');

            $this->searchListingsInModules($customPath);

            if (is_dir($customPath.'views/listing/'))
            {
                $this->searchListingsInFolder($customPath.'views/listing/', 'custom');
            }
        }

        // Sort on name
        usort($this->listingList, function($a, $b){
            return strcmp($a->name, $b->name);
        });
    }

    public function get()
    {
        return $this->listingList;
    }
{'fraction_non_alphanumeric': 0.12607449856733524, 'fraction_numerical': 0.0, 'mean_word_length': 2.3433652530779754, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '5809071', 'n_tokens_mistral': 698, 'n_tokens_neox': 682, 'n_words': 144}