mirror of
https://github.com/standardebooks/web.git
synced 2025-07-15 02:46:46 -04:00
Style tweaks for getters and add more type hinting
This commit is contained in:
parent
9e31ed1aac
commit
50efeb05d1
13 changed files with 87 additions and 84 deletions
18
lib/Poll.php
18
lib/Poll.php
|
@ -98,6 +98,9 @@ class Poll extends Accessor{
|
|||
// ORM METHODS
|
||||
// ***********
|
||||
|
||||
/**
|
||||
* @throws Exceptions\PollNotFoundException
|
||||
*/
|
||||
public static function Get(?int $pollId): Poll{
|
||||
if($pollId === null){
|
||||
throw new Exceptions\PollNotFoundException();
|
||||
|
@ -109,13 +112,12 @@ class Poll extends Accessor{
|
|||
where PollId = ?
|
||||
', [$pollId], 'Poll');
|
||||
|
||||
if(sizeof($result) == 0){
|
||||
throw new Exceptions\PollNotFoundException();
|
||||
}
|
||||
|
||||
return $result[0];
|
||||
return $result[0] ?? throw new Exceptions\PollNotFoundException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exceptions\PollNotFoundException
|
||||
*/
|
||||
public static function GetByUrlName(?string $urlName): Poll{
|
||||
if($urlName === null){
|
||||
throw new Exceptions\PollNotFoundException();
|
||||
|
@ -127,10 +129,6 @@ class Poll extends Accessor{
|
|||
where UrlName = ?
|
||||
', [$urlName], 'Poll');
|
||||
|
||||
if(sizeof($result) == 0){
|
||||
throw new Exceptions\PollNotFoundException();
|
||||
}
|
||||
|
||||
return $result[0];
|
||||
return $result[0] ?? throw new Exceptions\PollNotFoundException();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue