<commit_before><?php

/*
 * (c) <NAME> <https://twitter.com/Halleck45>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Hal\File;

/**
 * Checks syntax of file
 *
 * @author <NAME> <https://twitter.com/Halleck45>
 */
class SyntaxChecker
{

    /**
     * Check syntax of file
     *
     * @param $filename
     * @return int
     */
    public function isCorrect($filename) {
        if(1 === version_compare('5.0.4', PHP_VERSION)) {
            return php_check_syntax($filename);
        } else {
            $output = shell_exec(sprintf('php -l %s', escapeshellarg($filename)));
            return preg_match('!No syntax errors detected!', $output);
        }
    }
}<commit_msg>minor: fixes warning when file is not valid (syntax)<commit_after><?php

/*
 * (c) <NAME> <https://twitter.com/Halleck45>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Hal\File;

/**
 * Checks syntax of file
 *
 * @author <NAME> <https://twitter.com/Halleck45>
 */
class SyntaxChecker
{

    /**
     * Check syntax of file
     *
     * @param $filename
     * @return int
     */
    public function isCorrect($filename) {
        if(1 === version_compare('5.0.4', PHP_VERSION)) {
            return php_check_syntax($filename);
        } else {
            $output = shell_exec(sprintf('php -l %s 2>&1', escapeshellarg($filename)));
            return preg_match('!No syntax errors detected!', $output);
        }
    }
}
{'fraction_non_alphanumeric': 0.13920099875156056, 'fraction_numerical': 0.011235955056179775, 'mean_word_length': 2.6103603603603602, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 12, 'https://': 4, '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': '4529436', 'n_tokens_mistral': 497, 'n_tokens_neox': 482, 'n_words': 133}