<commit_before><?php

/*
 * This file is part of the Blackfire SDK package.
 *
 * (c) Blackfire <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Blackfire\Bridge\Laravel;

use Blackfire\Build\BuildHelper;
use Symfony\Component\Process\Process;

trait BlackfireTestArtisanCommandsTrait
{
    /**
     * Run an Artisan console command by name.
     *
     * @param string                                                 $command
     * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer
     *
     * @return int
     *
     * @throws \Symfony\Component\Console\Exception\CommandNotFoundException
     */
    public function call($command, array $parameters = array(), $outputBuffer = null)
    {
        if ('testing' === env('APP_ENV') && array_key_exists('blackfire-laravel-tests', $parameters)) {
            $buildHelper = BuildHelper::getInstance();

            $process = new Process(
                array_merge(array(
                    'blackfire',
                    '--json',
                    'run',
                    '--env='.$buildHelper->getBlackfireEnvironmentId(),
                    './artisan',
                 ), explode(' ', $command)),
                null,
                array(
                    'APP_ENV' => 'testing',
                )
            );

            $process->run();
            $output = json_decode($process->getOutput());

            $statusCode = $output->status->code;
            if (64 !== $statusCode ) {
                $graphUrl = $output->_links->graph_url->href;
                throw new \PHPUnit\Framework\AssertionFailedError("Profile on error:\n$graphUrl");
            }

            $reportState = $output->report->state;
            if ('failed' === $reportState) {
                $graphUrl = $output->_links->graph_url->href;
                throw new \PHPUnit\Framework\AssertionFailedError("Blackfire assertions on failure:\n$graphUrl");
            }

            unset($parameters['blackfire-laravel-tests']);
        }

        return parent::call($command, $parameters, $outputBuffer);
    }
}
<commit_msg>fix typo<commit_after><?php

/*
 * This file is part of the Blackfire SDK package.
 *
 * (c) Blackfire <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Blackfire\Bridge\Laravel;

use Blackfire\Build\BuildHelper;
use Symfony\Component\Process\Process;

trait BlackfireTestArtisanCommandsTrait
{
    /**
     * Run an Artisan console command by name.
     *
     * @param string                                                 $command
     * @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer
     *
     * @return int
     *
     * @throws \Symfony\Component\Console\Exception\CommandNotFoundException
     */
    public function call($command, array $parameters = array(), $outputBuffer = null)
    {
        if ('testing' === env('APP_ENV') && array_key_exists('blackfire-laravel-tests', $parameters)) {
            $buildHelper = BuildHelper::getInstance();

            $process = new Process(
                array_merge(array(
                    'blackfire',
                    '--json',
                    'run',
                    '--env='.$buildHelper->getBlackfireEnvironmentId(),
                    './artisan',
                 ), explode(' ', $command)),
                null,
                array(
                    'APP_ENV' => 'testing',
                )
            );

            $process->run();
            $output = json_decode($process->getOutput());

            $statusCode = $output->status->code;
            if (64 !== $statusCode) {
                $graphUrl = $output->_links->graph_url->href;
                throw new \PHPUnit\Framework\AssertionFailedError("Profile on error:\n$graphUrl");
            }

            $reportState = $output->report->state;
            if ('failed' === $reportState) {
                $graphUrl = $output->_links->graph_url->href;
                throw new \PHPUnit\Framework\AssertionFailedError("Blackfire assertions on failure:\n$graphUrl");
            }

            unset($parameters['blackfire-laravel-tests']);
        }

        return parent::call($command, $parameters, $outputBuffer);
    }
}

{'fraction_non_alphanumeric': 0.12516945323090828, 'fraction_numerical': 0.0009037505648441031, 'mean_word_length': 1.8287539936102237, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6202765', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1108, 'n_words': 241}