jsonBodyHelper = $helper; return $this; } public function getJsonBodyHelper() { if ($this->jsonBodyHelper instanceof JsonBodyHelper) { return $this->jsonBodyHelper; } if (null === $this->jsonBodyHelper) { throw new \LogicException(JsonBodyHelper::class . ' locator was not set'); } $instance = call_user_func($this->jsonBodyHelper); if (!$instance instanceof JsonBodyHelper) { throw new \LogicException(sprintf( 'Expects locator to return instance of "%s", got "%s"', JsonBodyHelper::class, is_object($instance) ? get_class($instance) : gettype($instance) )); } $this->jsonBodyHelper = $instance; return $this->jsonBodyHelper; } /** * @param Request $request * @param null|string $schemaUri * @return stdClass */ public function decodeJsonBody(Request $request, $schemaUri = null, $format = JsonBodyHelper::OBJECT) { return $this->getJsonBodyHelper()->decodeJsonBody($request, $schemaUri, $format); } }