mirror of
https://github.com/sitelease/sugar-cube-client.git
synced 2025-11-01 12:32:29 +01:00
Better validation of counters
This commit is contained in:
@ -457,7 +457,7 @@ class Repository implements \JsonSerializable {
|
|||||||
* @return $this This instance.
|
* @return $this This instance.
|
||||||
*/
|
*/
|
||||||
function setForksCount(int $value): self {
|
function setForksCount(int $value): self {
|
||||||
$this->forksCount = $value;
|
$this->forksCount = max(0, $value);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ class Repository implements \JsonSerializable {
|
|||||||
* @return $this This instance.
|
* @return $this This instance.
|
||||||
*/
|
*/
|
||||||
function setOpenIssuesCount(int $value): self {
|
function setOpenIssuesCount(int $value): self {
|
||||||
$this->openIssuesCount = $value;
|
$this->openIssuesCount = max(0, $value);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ class Repository implements \JsonSerializable {
|
|||||||
* @return $this This instance.
|
* @return $this This instance.
|
||||||
*/
|
*/
|
||||||
function setStarsCount(int $value): self {
|
function setStarsCount(int $value): self {
|
||||||
$this->starsCount = $value;
|
$this->starsCount = max(0, $value);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,7 +597,7 @@ class Repository implements \JsonSerializable {
|
|||||||
* @return $this This instance.
|
* @return $this This instance.
|
||||||
*/
|
*/
|
||||||
function setWatchersCount(int $value): self {
|
function setWatchersCount(int $value): self {
|
||||||
$this->watchersCount = $value;
|
$this->watchersCount = max(0, $value);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user