Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 /**
  * @param TransformerInterface $transformer
  * @return mixed
  */
 public function transform(TransformerInterface $transformer)
 {
     return $transformer->transformItem($this->getResponse());
 }