Style tweaks for getters and add more type hinting

This commit is contained in:
Alex Cabal 2024-04-30 22:45:20 -05:00
parent 9e31ed1aac
commit 50efeb05d1
13 changed files with 87 additions and 84 deletions

View file

@ -560,6 +560,10 @@ class Museum extends Accessor{
return $outputUrl;
}
/**
* @throws Exceptions\MuseumNotFoundException
* @throws Exceptions\InvalidUrlException
*/
public static function GetByUrl(?string $url): Museum{
if($url === null){
throw new Exceptions\MuseumNotFoundException();
@ -583,10 +587,6 @@ class Museum extends Accessor{
limit 1;
', [$parsedUrl['host']], 'Museum');
if(sizeof($result) == 0){
throw new Exceptions\MuseumNotFoundException();
}
return $result[0];
return $result[0] ?? throw new Exceptions\MuseumNotFoundException();
}
}