mirror of
https://github.com/sitelease/sugar-cube-client.git
synced 2026-01-18 10:09:12 +01:00
Code optimization
This commit is contained in:
@ -54,7 +54,7 @@ class Team implements \JsonSerializable {
|
|||||||
static function fromJson(object $map): self {
|
static function fromJson(object $map): self {
|
||||||
return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->name) && is_string($map->name) ? $map->name : ''))
|
return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->name) && is_string($map->name) ? $map->name : ''))
|
||||||
->setDescription(isset($map->description) && is_string($map->description) ? $map->description : '')
|
->setDescription(isset($map->description) && is_string($map->description) ? $map->description : '')
|
||||||
->setPermission(isset($map->permission) && is_string($map->permission) ? $map->permission : TeamPermission::NONE);
|
->setPermission($map->permission ?? TeamPermission::NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,7 +128,7 @@ class Team implements \JsonSerializable {
|
|||||||
* @return $this This instance.
|
* @return $this This instance.
|
||||||
*/
|
*/
|
||||||
function setPermission(string $value): self {
|
function setPermission(string $value): self {
|
||||||
$this->permission = TeamPermission::isDefined($value) ? $value : TeamPermission::NONE;
|
$this->permission = TeamPermission::coerce($value, TeamPermission::NONE);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user