/** * @param $items * @param int $statusCode * @return ApiResponse */ public function collection($items, $statusCode = null) { if ($this->transformer) { $items = $this->transformer->transformCollection($items, $this->getTransformerOptions()); } if (is_null($statusCode)) { $statusCode = $this->getStatusCode(); } if (is_null($statusCode)) { $statusCode = self::HTTP_OK; } return $this->header('Content-Type', 'application/json')->setContent($this->encode($items))->setStatusCode($statusCode); }
/** * @param TransformerInterface $transformer * @return mixed */ public function transform(TransformerInterface $transformer) { return ['message' => $this->getMessage(), 'invalid' => $transformer->transformCollection($this->getResponse())]; }