Check if `$actual` matches the matcher.

@param  string  $actual The actual value.
@return boolean         Returns `true` on success and `false` otherwise.
499891
public function match($actual)
    {
        $target = null;
        $matcher = null;
        foreach ($this->_matchers as $target => $value) {
            if (!$target) {
                $matcher = $value;
                continue;
            }
            if ($actual instanceof $target) {
                $matcher = $value;
            }
        }
        if (!$matcher) {
            throw new Exception("Unexisting matcher attached to `'{$this->_name}'` for `{$target}`.");
        }
        $args = $this->_args;
        array_unshift($args, $actual);
        $boolean = call_user_func_array($matcher . '::match', $args);
        return $this->_not ? !$boolean : $boolean;
    }
657750
public static function assertLooselyEquals($actual, $expected, Throwable $exception)
    {
        /** @noinspection TypeUnsafeComparisonInspection This assertion is wanted to be unsafe type. */
        static::makeAssertion($actual == $expected, $exception);
        return $actual;
    }
861588
public static function assertStringMatchIgnoreWhitespace(
        $expected, $actual, $message='') {
          Assert::assertThat(
            $actual,
            new StringMatchIgnoreWhitespace($expected),
            $message);
    }
49404
public static function match($actual, $expected)
    {
        $length = static::actual($actual);
        static::_buildDescription($actual, $length, $expected);

        return $length === $expected;
    }
294093
public function matches($pattern): bool
    {
        Assert::typeOf(['string', __CLASS__], $pattern);

        return preg_match((string) $pattern, $this->data) === 1;
    }
1155646
public function match($matchUrl = null)
    {
        if (null !== $matchUrl) {
            $this->setMatchUrl($matchUrl);
        }

        if ($this->isUrlEqual()) {
            return true;
        } else {
            return false;
        }

    }
292657
protected function assertArrayEquals(array $actual, array $expected)
    {
        $propertyAccessor = new PropertyAccessor();

        foreach ($expected as $key => $needle) {
            $expectedValue = $expected[$key];

            // Fix type
            if ($expectedValue == '@true') {
                $expectedValue = true;
            } else if ($expectedValue == '@false') {
                $expectedValue = false;
            } else if ($expectedValue == '@null') {
                $expectedValue = null;
            } else if (preg_match('/^@\[([^\]]+)?\]$/', $expectedValue, $parts)) {
                if (!empty($parts[1])) {
                    $expectedValue = explode(',', $parts[1]);
                    $expectedValue = array_map('trim', $expectedValue);
                } else {
                    $expectedValue = [];
                }
            }

            if (strpos($key, '[') !== false) {
                // Try get value via "PropertyPath"
                $elements = explode('[', $key);
                $elements = array_map(function ($element){
                    return trim($element, '][');
                }, $elements);

                $propertyPath = '[' . implode($elements, '][') . ']';

                $propertyPath = new PropertyPath($propertyPath);
                $actualValue = $propertyAccessor->getValue($actual, $propertyPath);
                $rootKey = $propertyPath->getElement(0);
            } else {
                $actualValue = $actual[$key];
                $rootKey = $key;
            }

            Assertions::assertArrayHasKey($rootKey, $actual, sprintf(
                'Not found key "%s" in array (%s).',
                $rootKey,
                json_encode($actual)
            ));

            if ($expectedValue == '@notNull') {
                Assertions::assertNotNull($actualValue, sprintf(
                    'Failed assert equals for key "%s". Expected: NOT NULL. Body: "%s"',
                    $key,
                    $this->response->getBody()
                ));
            } else {
                Assertions::assertEquals($expectedValue, $actualValue, sprintf(
                    'Failed assert equals for key "%s". Expected: "%s"; Actual: "%s". Body: "%s"',
                    $key,
                    is_scalar($expectedValue) ? $expectedValue : (is_array($expectedValue) ? 'Array(' . json_encode($expectedValue) . ')' : 'Invalid type'),
                    is_scalar($actualValue) ? $actualValue : (is_array($actualValue) ? 'Array(' . json_encode($actualValue) . ')' : 'Invalid type'),
                    $this->response->getBody()
                ));
            }
        }
    }
1053036
protected function matches($other)
    {
        foreach ($this->constraints as $key => $constraint) {
            if (! array_key_exists($key, $other)) {
                return false;
            }

            if (! $constraint->evaluate($other[$key], '', true)) {
                return false;
            }
        }

        if ($this->isStrict and array_diff_key($other, $this->constraints)) {
            return false;
        }

        return true;
    }
1275647
protected function compareUrl($expectedUrl, $actualUrl)
    {
        $expectedUrlInfo = parse_url($expectedUrl);
        $actualUrlInfo = parse_url($actualUrl);
        foreach ($expectedUrlInfo as $name => $expectedValue) {
            if ($name == 'query') {
                parse_str($expectedValue, $expectedUrlParams);
                parse_str($actualUrlInfo[$name], $actualUrlParams);
                $paramsDiff = array_diff_assoc($expectedUrlParams, $actualUrlParams);
                if (!empty($paramsDiff)) {
                    return false;
                }
            } elseif ($expectedValue != $actualUrlInfo[$name]) {
                return false;
            }
        }
        return true;
    }
367645
protected function assertGreaterThanOrEqual($expected, $actual, $message = '')
    {
        \PHPUnit\Framework\Assert::assertGreaterThanOrEqual($expected, $actual, $message);
    }
584118
protected function doMatch($actual = null)
    {
        if (isset($this->countable)) {
            $actual = $this->getCount();
        }

        if (!is_numeric($actual)) {
            throw new \InvalidArgumentException(get_class($this) . ' requires a numeric value');
        }

        return $this->matchNumeric($actual);
    }
945573
public function matches(CalledUri $calledUri): bool
    {
        if (!$this->matchesPath($calledUri)) {
            return false;
        }

        if (in_array($calledUri->method(), $this->allowedRequestMethods)) {
            return true;
        }

        if (in_array(Http::GET, $this->allowedRequestMethods)) {
            return $calledUri->methodEquals(Http::HEAD);
        }

        return false;
    }
1056154
public function doMatch($actual)
    {
        $this->type = gettype($actual);

        return $this->expected === $this->type;
    }
611155
protected function matchArrayIndex($actual)
    {
        if (isset($actual[$this->getKey()])) {
            $this->assertion->setActual($actual[$this->getKey()]);

            return $this->isExpected($actual[$this->getKey()]);
        }

        return false;
    }
810936
public <T> void assertThat(T actual, org.hamcrest.Matcher<? super T> matcher) {
    try {
      org.hamcrest.MatcherAssert.assertThat(actual, matcher);
    } catch (AssertionError e) {
      fail(e);
    }
  }
838766
public static function provideDiff($expected, $actual, $message = null)
    {
        return 'Mismatch: (- expected, + actual)' . PHP_EOL . PHP_EOL .
            '- ' . $expected . PHP_EOL .
            '+ ' . $actual . PHP_EOL . PHP_EOL .
            'Info: ' . $message;
    }
91104
public static function matchesType($actual, $type)
    {
        if ($actual === $type) {
            return true;
        }

        $split = explode('/', $actual);

        return isset($split[1]) && preg_match('#'.preg_quote($split[0], '#').'/.+\+'.preg_quote($split[1], '#').'#', $type);
    }