You are here

protected function PHPUnit_Framework_Constraint_IsJson::matches in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Constraint/IsJson.php \PHPUnit_Framework_Constraint_IsJson::matches()

Evaluates the constraint for parameter $other. Returns true if the constraint is met, false otherwise.

Parameters

mixed $other Value or object to evaluate.:

Return value

bool

Overrides PHPUnit_Framework_Constraint::matches

File

vendor/phpunit/phpunit/src/Framework/Constraint/IsJson.php, line 25

Class

PHPUnit_Framework_Constraint_IsJson
Constraint that asserts that a string is valid JSON.

Code

protected function matches($other) {
  json_decode($other);
  if (json_last_error()) {
    return false;
  }
  return true;
}