/** * Bind an item to a transformer and start building a response. * @param $item * @param int $statusCode * @return ApiResponse */ public function item($item, $statusCode = self::HTTP_OK) { if ($this->transformer) { $item = $this->transformer->transformItem($item); } return $this->header('Content-Type', 'application/json')->setContent($this->encode($item))->setStatusCode($statusCode); }
/** * @param TransformerInterface $transformer * @return mixed */ public function transform(TransformerInterface $transformer) { return $transformer->transformItem($this->getResponse()); }