<commit_before><?php
namespace Hal\Application;

use Hal\Application\Config\ConfigException;
use Hal\Application\Config\Parser;
use Hal\Application\Config\Validator;
use Hal\Component\File\Finder;
use Hal\Component\Issue\Issuer;
use Hal\Report;
use Hal\Violation\ViolationParser;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Output\ConsoleOutput;


class Application
{

    /**
     * @param $argv
     */
    public function run($argv)
    {
        // formatter
        $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, new OutputFormatter());

        // issues and debug
        $issuer = (new Issuer($output));//->enable();

        // config
        $config = (new Parser())->parse($argv);
        try {
            (new Validator())->validate($config);
        } catch (ConfigException $e) {

            if ($config->has('help')) {
                $output->writeln((new Validator())->help());
                exit(1);
            }

            if ($config->has('version')) {
                $output->writeln(sprintf("PhpMetrics %s <http://phpmetrics.org>\nby <NAME> <https://twitter.com/Halleck45>", getVersion()));
                exit(1);
            }

            $output->writeln(sprintf("\n<error>%s</error>\n", $e->getMessage()));
            $output->writeln((new Validator())->help());
            exit(1);
        }

        if ($config->has('quiet')) {
            $output->setVerbosity(ConsoleOutput::VERBOSITY_QUIET);
        }

        // find files
        $finder = new Finder($config->get('extensions'), $config->get('exclude'));
        $files = $finder->fetch($config->get('files'));

        // analyze
        try {
            $metrics = (new Analyze($config, $output, $issuer))->run($files);
        }catch(ConfigException $e) {
            $output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
            exit(1);
        }<commit_msg>changed status code for --help and --version option<commit_after><?php
namespace Hal\Application;

use Hal\Application\Config\ConfigException;
use Hal\Application\Config\Parser;
use Hal\Application\Config\Validator;
use Hal\Component\File\Finder;
use Hal\Component\Issue\Issuer;
use Hal\Report;
use Hal\Violation\ViolationParser;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Output\ConsoleOutput;


class Application
{

    /**
     * @param $argv
     */
    public function run($argv)
    {
        // formatter
        $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, new OutputFormatter());

        // issues and debug
        $issuer = (new Issuer($output));//->enable();

        // config
        $config = (new Parser())->parse($argv);
        try {
            (new Validator())->validate($config);
        } catch (ConfigException $e) {

            if ($config->has('help')) {
                $output->writeln((new Validator())->help());
                exit(0);
            }

            if ($config->has('version')) {
                $output->writeln(sprintf("PhpMetrics %s <http://phpmetrics.org>\nby <NAME> <https://twitter.com/Halleck45>", getVersion()));
                exit(0);
            }

            $output->writeln(sprintf("\n<error>%s</error>\n", $e->getMessage()));
            $output->writeln((new Validator())->help());
            exit(1);
        }

        if ($config->has('quiet')) {
            $output->setVerbosity(ConsoleOutput::VERBOSITY_QUIET);
        }

        // find files
        $finder = new Finder($config->get('extensions'), $config->get('exclude'));
        $files = $finder->fetch($config->get('files'));

        // analyze
        try {
            $metrics = (new Analyze($config, $output, $issuer))->run($files);
        }catch(ConfigException $e) {
            $output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
            exit(1);
        }
{'fraction_non_alphanumeric': 0.1725370086778969, 'fraction_numerical': 0.0030627871362940277, 'mean_word_length': 2.3381601362862012, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 59, 'https://': 2, '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': '3813359', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1120, 'n_words': 193}