public function theResponseHasAField($name)
{
if ($this->responseIsJson) {
if ($this->associative) {
if (!is_array($this->responseData) || !array_key_exists($name, $this->responseData)) {
throw new \Exception('Field "' . $name . '" is not set!');
}
} else {
if (!$this->responseData instanceof stdClass || !property_exists($this->responseData, $name)) {
throw new \Exception('Field "' . $name . '" is not set!');
}
}
} else {
return new Step\Then('the response is JSON');
}
}