<commit_before><?php
namespace Helmich\Psr7Assert\Constraint;

use PHPUnit_Framework_Assert as Assert;
use PHPUnit_Framework_Constraint as Constraint;
use Psr\Http\Message\ResponseInterface;

class HasStatusConstraint extends Constraint
{

    /** @var Constraint */
    private $status;

    public function __construct($status)
    {
        parent::__construct();

        if (!$status instanceof Constraint) {
            $status = Assert::equalTo($status);
        }

        $this->status = $status;
    }

    /**
     * Returns a string representation of the object.
     *
     * @return string
     */
    public function toString()
    {
        return "response status {$this->status->toString()}";
    }

    protected function matches($other)
    {
        if (!$other instanceof ResponseInterface) {
            return false;
        }

        return $this->status->evaluate($other->getStatusCode(), '', true);
    }
}<commit_msg>Better failure message for HasStatusConstraint<commit_after><?php
namespace Helmich\Psr7Assert\Constraint;

use PHPUnit_Framework_Assert as Assert;
use PHPUnit_Framework_Constraint as Constraint;
use Psr\Http\Message\ResponseInterface;

class HasStatusConstraint extends Constraint
{

    /** @var Constraint */
    private $status;

    public function __construct($status)
    {
        parent::__construct();

        if (!$status instanceof Constraint) {
            $status = Assert::equalTo($status);
        }

        $this->status = $status;
    }

    /**
     * Returns a string representation of the object.
     *
     * @return string
     */
    public function toString()
    {
        return "response status {$this->status->toString()}";
    }

    protected function matches($other)
    {
        if (!$other instanceof ResponseInterface) {
            return false;
        }

        return $this->status->evaluate($other->getStatusCode(), '', true);
    }

    protected function additionalFailureDescription($other)
    {
        if ($other instanceof ResponseInterface) {
            return 'Actual status is ' . $other->getStatusCode() . " and the body contains: " . $other->getBody();
        }
        return '';
    }
}
{'fraction_non_alphanumeric': 0.11399908800729594, 'fraction_numerical': 0.0009119927040583675, 'mean_word_length': 2.57328990228013, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '7044092', 'n_tokens_mistral': 577, 'n_tokens_neox': 570, 'n_words': 144}