<commit_before><?php

/*
 * This file is part of the Phony package.
 *
 * Copyright © 2014 <NAME>
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 */

namespace Eloquent\Phony\Integration\Pho;

use Exception;

/**
 * Emulates Pho's expectation exception for improved assertion failure output.
 *
 * @internal
 */
class PhoAssertionException extends Exception
{
    /**
     * Construct a new Pho assertion exception.
     *
     * @param string         $description The failure description.
     * @param Exception|null $cause       The cause, if available.
     */
    public function __construct($description, Exception $cause = null)
    {
        parent::__construct($description, 0, $cause);

        foreach (\debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $call) {
            if (0 !== strpos($call['class'], 'Eloquent\Phony\\')) {
                break;
            }

            $this->file = $call['file'];
            $this->line = $call['line'];
        }
    }

    /**
     * Generate a string representation of this assertion failure.
     *
     * @return string The string representation.
     */
    public function __toString()
    {
        return "{$this->file}:{$this->line}\n$this->message";
    }
}<commit_msg>Exceptions already have a trace.<commit_after><?php

/*
 * This file is part of the Phony package.
 *
 * Copyright © 2014 <NAME>
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 */

namespace Eloquent\Phony\Integration\Pho;

use Exception;

/**
 * Emulates Pho's expectation exception for improved assertion failure output.
 *
 * @internal
 */
class PhoAssertionException extends Exception
{
    /**
     * Construct a new Pho assertion exception.
     *
     * @param string         $description The failure description.
     * @param Exception|null $cause       The cause, if available.
     */
    public function __construct($description, Exception $cause = null)
    {
        parent::__construct($description, 0, $cause);

        foreach ($this->getTrace() as $call) {
            if (0 !== strpos($call['class'], 'Eloquent\Phony\\')) {
                break;
            }

            $this->file = $call['file'];
            $this->line = $call['line'];
        }
    }

    /**
     * Generate a string representation of this assertion failure.
     *
     * @return string The string representation.
     */
    public function __toString()
    {
        return "{$this->file}:{$this->line}\n$this->message";
    }
}
{'fraction_non_alphanumeric': 0.1198174210726512, 'fraction_numerical': 0.004564473183720046, 'mean_word_length': 2.433420365535248, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 16, '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': '2485351', 'n_tokens_mistral': 739, 'n_tokens_neox': 698, 'n_words': 222}