<commit_before><?php
namespace Grav\Common;

/**
 * Contain some useful language functions
 */
class Language
{
    protected $languages = [];
    protected $default;
    protected $active;
    protected $page_extension;

    public function __construct(Grav $grav)
    {
        $this->languages = $grav['config']->get('system.languages.supported', []);
        $this->default = reset($this->languages);

    }

    public function enabled()
    {
        if (empty($this->languages)) {
            return false;
        }
        return true;
    }

    public function getLanguages()
    {
        return $this->languages;
    }

    public function setLanguages($langs)
    {
        $this->languages = $langs;
    }

    public function getAvailable()
    {
        return implode('|', $this->languages);
    }

    public function getDefault()
    {
        return $this->default;
    }

    public function setDefault($lang)
    {
        if ($this->validate($lang)) {
            $this->default = $lang;
            return $lang;
        }
        return false;
    }
<commit_msg>optimized enabled test<commit_after><?php
namespace Grav\Common;

/**
 * Contain some useful language functions
 */
class Language
{
    protected $languages = [];
    protected $default;
    protected $active;
    protected $page_extension;
    protected $enabled = true;

    public function __construct(Grav $grav)
    {
        $this->languages = $grav['config']->get('system.languages.supported', []);
        $this->default = reset($this->languages);

        if (empty($this->languages)) {
            $this->enabled = false;
        }

    }

    public function enabled()
    {
        return $this->enabled;
    }

    public function getLanguages()
    {
        return $this->languages;
    }

    public function setLanguages($langs)
    {
        $this->languages = $langs;
    }

    public function getAvailable()
    {
        return implode('|', $this->languages);
    }

    public function getDefault()
    {
        return $this->default;
    }

    public function setDefault($lang)
    {
        if ($this->validate($lang)) {
            $this->default = $lang;
            return $lang;
        }
        return false;
    }

{'fraction_non_alphanumeric': 0.13053196244970944, 'fraction_numerical': 0.0, 'mean_word_length': 2.086896551724138, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '1991620', 'n_tokens_mistral': 650, 'n_tokens_neox': 630, 'n_words': 139}