-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split methods into separate setters and getters
- Loading branch information
1 parent
e619a2d
commit 6fabf2f
Showing
5 changed files
with
30 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,28 @@ | ||
<?php | ||
<?php declare(strict_types=1); | ||
namespace Imbo\Auth\AccessControl; | ||
|
||
/** | ||
* Abstract query interface for access control | ||
*/ | ||
abstract class AbstractQuery { | ||
/** | ||
* Limit | ||
* | ||
* @var int | ||
*/ | ||
private $limit = 20; | ||
|
||
/** | ||
* Page | ||
* | ||
* @var int | ||
*/ | ||
private $page = 1; | ||
|
||
/** | ||
* Set or get the limit | ||
* | ||
* @param int $limit The limit to set. Skip to get the current value | ||
* @return self|int | ||
*/ | ||
public function limit($limit = null) { | ||
if ($limit === null) { | ||
return $this->limit; | ||
} | ||
|
||
$this->limit = (int) $limit; | ||
private int $limit = 20; | ||
private int $page = 1; | ||
|
||
public function setLimit(int $limit): self { | ||
$this->limit = $limit; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Set or get the page | ||
* | ||
* @param int $page The page to set. Skip to get the current value | ||
* @return self|int | ||
*/ | ||
public function page($page = null) { | ||
if ($page === null) { | ||
return $this->page; | ||
} | ||
|
||
$this->page = (int) $page; | ||
public function getLimit(): int { | ||
return $this->limit; | ||
} | ||
|
||
public function setPage(int $page): self { | ||
$this->page = $page; | ||
return $this; | ||
} | ||
|
||
public function getPage(): int { | ||
return $this->page; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters