/** * @param Params $params * @param \stdClass|string $schema * @param array &$entityData */ protected function prepareData(Params $params, $schema, array &$entityData) { foreach ($entityData as &$data) { $json = Util\ArrayHelper::toObject($data); if (!$this->jsonCoder->matchSchema($json, $schema)) { $message = $this->jsonCoder->getSchemaErrorMessage(); throw new ParseException($message); } $this->hydrant->hydrate($params, $data); } return $entityData; }
/** * Returns the latest schema matching errors as a text message. * @return string * @see http://php.net/manual/en/function.json-last-error-msg.php */ public function getSchemaErrorMessage() { return $this->jsonCoder->getSchemaErrorMessage(); }