public function jsonCollectionResponse($key, Collection $collection, array $extras = array())
    {
        $key = is_string($key)
            ? $key
            : 'entries'
        ;

        if ($this->presenter instanceof Presenter) {
            $entries = $this->presenter->collection($collection);
        }

        return $this->jsonResponse(array_replace($extras, array(
            $key     => isset($entries) ? $entries : $collection,
            'offset' => $collection->offset(),
            'limit'  => $collection->limit(),
            'total'  => $collection->total(),
        )));
    }
public function jsonCollectionResponse($key, Collection $collection, array $extras = array())
    {
        $key = is_string($key)
            ? $key
            : 'entries'
        ;

        if ($this->presenter instanceof Presenter) {
            $entries = $this->presenter->collection($collection);
        }

        return $this->jsonResponse(array_replace($extras, array(
            $key     => isset($entries) ? $entries : $collection,
            'offset' => $collection->offset(),
            'limit'  => $collection->limit(),
            'total'  => $collection->total(),
        )));
    }
public function jsonCollectionResponse ( $ key , Collection $ collection , array $ extras = array ( ) ) { $ key = is_string ( $ key ) ? $ key : 'entries' ; if ( $ this -> presenter instanceof Presenter ) { $ entries = $ this -> presenter -> collection ( $ collection ) ; } return $ this -> jsonResponse ( array_replace ( $ extras , array ( $ key => isset ( $ entries ) ? $ entries : $ collection , 'offset' => $ collection -> offset ( ) , 'limit' => $ collection -> limit ( ) , 'total' => $ collection -> total ( ) , ) ) ) ; }
Format a json collection Response.

@param string                   $key        JSON key for the collection
@param \Subbly\Model\Collection $collection The entries collection
@param array                    $extras     Extras values

@return Response
Format a json collection Response .