<commit_before><?php
namespace phorkie;

class SetupCheck
{
    protected $deps = array(
        'pear.php.net/VersionControl_Git'  => 'VersionControl_Git',
        'pear.twig-project.org/Twig'       => 'Twig_Autoloader',
        'pear.php.net/Date_HumanDiff'      => 'Date_HumanDiff',
        'pear.php.net/HTTP_Request2'       => 'HTTP_Request2',
        'pear.php.net/OpenID'              => 'OpenID',
        'pear.php.net/Pager'               => 'Pager',
        'pear.php.net/Services_Libravatar' => 'Services_Libravatar',
        'pear2.php.net/PEAR2_Services_Linkback'  => '\\PEAR2\\Services\\Linkback\\Client',
        'zustellzentrum.cweiske.de/MIME_Type_PlainDetect' => 'MIME_Type_PlainDetect',
    );

    protected $writableDirs;
    protected $elasticsearch;

    public $messages = array();

    public function __construct()
    {
        $cfg = $GLOBALS['phorkie']['cfg'];
        $this->writableDirs = array(
            'gitdir'  => Tools::foldPath($cfg['gitdir']),
            'workdir' => Tools::foldPath($cfg['workdir']),
        );
        $this->elasticsearch = $cfg['elasticsearch'];
    }

    public static function run()
    {
        $sc = new self();
        $sc->checkConfigFiles();
        $sc->checkDeps();
        $sc->checkDirs();
        $sc->checkGit();
        $sc->checkDatabase();
        $sc->checkMimeTypeDetection();
        $sc->checkRemoteForking();

        return $sc->messages;
    }

    public function checkConfigFiles()
    {
        foreach ($GLOBALS['phorkie']['cfgfiles'] as $file => $loaded) {
            if ($loaded) {
                $this->ok('Loaded config file: ' . Tools::foldPath($file));
            } else {
                $this->info(
                    'Possible config file: ' . Tools::foldPath($file)
                    . ' (not loaded)'
                );
            }
        }
    }

    public function checkDeps()
    {<commit_msg>prevent notice on cli scripts<commit_after><?php
namespace phorkie;

class SetupCheck
{
    protected $deps = array(
        'pear.php.net/VersionControl_Git'  => 'VersionControl_Git',
        'pear.twig-project.org/Twig'       => 'Twig_Autoloader',
        'pear.php.net/Date_HumanDiff'      => 'Date_HumanDiff',
        'pear.php.net/HTTP_Request2'       => 'HTTP_Request2',
        'pear.php.net/OpenID'              => 'OpenID',
        'pear.php.net/Pager'               => 'Pager',
        'pear.php.net/Services_Libravatar' => 'Services_Libravatar',
        'pear2.php.net/PEAR2_Services_Linkback'  => '\\PEAR2\\Services\\Linkback\\Client',
        'zustellzentrum.cweiske.de/MIME_Type_PlainDetect' => 'MIME_Type_PlainDetect',
    );

    protected $writableDirs;
    protected $elasticsearch;

    public $messages = array();

    public function __construct()
    {
        $cfg = $GLOBALS['phorkie']['cfg'];
        $this->writableDirs = array(
            'gitdir'  => Tools::foldPath($cfg['gitdir']),
            'workdir' => Tools::foldPath($cfg['workdir']),
        );
        $this->elasticsearch = $cfg['elasticsearch'];
    }

    public static function run()
    {
        $sc = new self();
        $sc->checkConfigFiles();
        $sc->checkDeps();
        $sc->checkDirs();
        $sc->checkGit();
        $sc->checkDatabase();
        $sc->checkMimeTypeDetection();
        $sc->checkRemoteForking();

        return $sc->messages;
    }

    public function checkConfigFiles()
    {
        if (!isset($GLOBALS['phorkie']['cfgfiles'])
            || count($GLOBALS['phorkie']['cfgfiles']) == 0
        ) {
            $this->info('No config files registered');
            return;
        }

        foreach ($GLOBALS['phorkie']['cfgfiles'] as $file => $loaded) {
            if ($loaded) {
                $this->ok('Loaded config file: ' . Tools::foldPath($file));
            } else {
                $this->info(
                    'Possible config file: ' . Tools::foldPath($file)
                    . ' (not loaded)'
                );
            }
        }
    }

    public function checkDeps()
    {
{'fraction_non_alphanumeric': 0.1592088998763906, 'fraction_numerical': 0.002719406674907293, 'mean_word_length': 1.9859778597785978, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 52, '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': '3713977', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1253, 'n_words': 187}