mirror of
https://github.com/friendica/friendica
synced 2025-04-28 13:04:23 +02:00
Changes
- renamed Item::visibleActivity() to Item::isVisibleActivity() as this returns a boolean value - added some type-hints - added some documentation
This commit is contained in:
parent
e33f5612ab
commit
83cbe586ac
9 changed files with 159 additions and 114 deletions
|
@ -48,11 +48,11 @@ class Pager
|
|||
*
|
||||
* Guesses the page number from the GET parameter 'page'.
|
||||
*
|
||||
* @param L10n $l10n
|
||||
* @param string $queryString The query string of the current page
|
||||
* @param integer $itemsPerPage An optional number of items per page to override the default value
|
||||
* @param L10n $l10n
|
||||
* @param string $queryString The query string of the current page
|
||||
* @param int $itemsPerPage An optional number of items per page to override the default value
|
||||
*/
|
||||
public function __construct(L10n $l10n, $queryString, $itemsPerPage = 50)
|
||||
public function __construct(L10n $l10n, string $queryString, int $itemsPerPage = 50)
|
||||
{
|
||||
$this->l10n = $l10n;
|
||||
|
||||
|
@ -64,9 +64,9 @@ class Pager
|
|||
/**
|
||||
* Returns the start offset for a LIMIT clause. Starts at 0.
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getStart()
|
||||
public function getStart(): int
|
||||
{
|
||||
return max(0, ($this->page * $this->itemsPerPage) - $this->itemsPerPage);
|
||||
}
|
||||
|
@ -74,9 +74,9 @@ class Pager
|
|||
/**
|
||||
* Returns the number of items per page
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
*/
|
||||
public function getItemsPerPage()
|
||||
public function getItemsPerPage(): int
|
||||
{
|
||||
return $this->itemsPerPage;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class Pager
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPage()
|
||||
public function getPage(): int
|
||||
{
|
||||
return $this->page;
|
||||
}
|
||||
|
@ -108,9 +108,9 @@ class Pager
|
|||
/**
|
||||
* Sets the number of items per page, 1 minimum.
|
||||
*
|
||||
* @param integer $itemsPerPage
|
||||
* @param int $itemsPerPage
|
||||
*/
|
||||
public function setItemsPerPage($itemsPerPage)
|
||||
public function setItemsPerPage(int $itemsPerPage)
|
||||
{
|
||||
$this->itemsPerPage = max(1, intval($itemsPerPage));
|
||||
}
|
||||
|
@ -118,11 +118,11 @@ class Pager
|
|||
/**
|
||||
* Sets the current page number. Starts at 1.
|
||||
*
|
||||
* @param integer $page
|
||||
* @param int $page
|
||||
*/
|
||||
public function setPage($page)
|
||||
public function setPage(int $page)
|
||||
{
|
||||
$this->page = max(1, intval($page));
|
||||
$this->page = max(1, $page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,7 +132,7 @@ class Pager
|
|||
*
|
||||
* @param string $queryString
|
||||
*/
|
||||
public function setQueryString($queryString)
|
||||
public function setQueryString(string $queryString)
|
||||
{
|
||||
$stripped = preg_replace('/([&?]page=[0-9]*)/', '', $queryString);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue