/** * @param mixed $data The data which will be presented * @param string $rel The name of the relation inside of the _embedded field * @param string $route The name of the route, for generating the links * @param array $parameters The parameters to append to the route * @param int $page The number of the current page * @param int $limit The size of one page * @param int $total The total number of elements */ public function __construct($data, $rel, $route, $parameters, $page, $limit, $total) { parent::__construct(new CollectionRepresentation($data, $rel), $route, $parameters, $page, $limit, $limit ? ceil($total / $limit) : 1); $this->total = $total; $this->data = $data; $this->rel = $rel; }
/** * @param null $page * @param null $limit * @return array */ public function getParameters($page = null, $limit = null, $where = null, $search = null, $order = null) { $parameters = parent::getParameters($page, $limit); $parameters[$this->whereParameterName] = null == $where ? $this->getWhere() : $where; $parameters[$this->searchParameterName] = null == $search ? $this->getSearch() : $search; $parameters[$this->orderParameterName] = null == $order ? $this->getOrder() : $order; return $parameters; }
/** * {@inheritdoc} * * @param array $totals */ public function __construct($inline, $route, array $parameters, $page, $limit, $pages, $pageParameterName, $limitParameterName, $absolute, $total, $totals, $time) { parent::__construct($inline, $route, $parameters, $page, $limit, $pages, $pageParameterName, $limitParameterName, $absolute, $total, $time); $this->totals = $totals; $this->time = $time; }