public function saveFieldValueUnderLocation($fieldName, $locationIndex)
{
$this->response = $this->client->getLastResponse();
$fieldValue = null;
if ($this->responseIsJson) {
if ($this->associative) {
if (!is_array($this->responseData) || !array_key_exists($fieldName, $this->responseData)) {
throw new \Exception('Field "' . $fieldName . '" is not set!');
}
$fieldValue = $this->responseData[$fieldName];
} else {
if (!$this->responseData instanceof stdClass || !property_exists($this->responseData, $name)) {
throw new \Exception('Field "' . $fieldName . '" is not set!');
}
$fieldValue = $this->responseData->{$fieldName};
}
$this->locations[$locationIndex] = $fieldValue;
} else {
return new Step\Then('the response is JSON');
}
}