mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 01:22:23 -04:00
PHPStan tweaks
This commit is contained in:
parent
497f749523
commit
de9e8161ce
6 changed files with 22 additions and 3 deletions
|
@ -87,6 +87,10 @@ class Poll extends PropertiesBase{
|
||||||
// ***********
|
// ***********
|
||||||
|
|
||||||
public static function Get(?int $pollId): Poll{
|
public static function Get(?int $pollId): Poll{
|
||||||
|
if($pollId === null){
|
||||||
|
throw new Exceptions\InvalidPollException();
|
||||||
|
}
|
||||||
|
|
||||||
$result = Db::Query('SELECT * from Polls where PollId = ?', [$pollId], 'Poll');
|
$result = Db::Query('SELECT * from Polls where PollId = ?', [$pollId], 'Poll');
|
||||||
|
|
||||||
if(sizeof($result) == 0){
|
if(sizeof($result) == 0){
|
||||||
|
@ -97,6 +101,10 @@ class Poll extends PropertiesBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetByUrlName(?string $urlName): Poll{
|
public static function GetByUrlName(?string $urlName): Poll{
|
||||||
|
if($urlName === null){
|
||||||
|
throw new Exceptions\InvalidPollException();
|
||||||
|
}
|
||||||
|
|
||||||
$result = Db::Query('SELECT * from Polls where UrlName = ?', [$urlName], 'Poll');
|
$result = Db::Query('SELECT * from Polls where UrlName = ?', [$urlName], 'Poll');
|
||||||
|
|
||||||
if(sizeof($result) == 0){
|
if(sizeof($result) == 0){
|
||||||
|
|
|
@ -31,6 +31,10 @@ class PollItem extends PropertiesBase{
|
||||||
// ***********
|
// ***********
|
||||||
|
|
||||||
public static function Get(?int $pollItemId): PollItem{
|
public static function Get(?int $pollItemId): PollItem{
|
||||||
|
if($pollItemId === null ){
|
||||||
|
throw new Exceptions\InvalidPollItemException();
|
||||||
|
}
|
||||||
|
|
||||||
$result = Db::Query('SELECT * from PollItems where PollItemId = ?', [$pollItemId], 'PollItem');
|
$result = Db::Query('SELECT * from PollItems where PollItemId = ?', [$pollItemId], 'PollItem');
|
||||||
|
|
||||||
if(sizeof($result) == 0){
|
if(sizeof($result) == 0){
|
||||||
|
|
|
@ -51,6 +51,10 @@ class User extends PropertiesBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetByEmail(?string $email): User{
|
public static function GetByEmail(?string $email): User{
|
||||||
|
if($email === null){
|
||||||
|
throw new Exceptions\InvalidUserException();
|
||||||
|
}
|
||||||
|
|
||||||
$result = Db::Query('SELECT * from Users where Email = ?', [$email], 'User');
|
$result = Db::Query('SELECT * from Users where Email = ?', [$email], 'User');
|
||||||
|
|
||||||
if(sizeof($result) == 0){
|
if(sizeof($result) == 0){
|
||||||
|
|
|
@ -100,10 +100,9 @@ class Vote extends PropertiesBase{
|
||||||
$this->VoteId = Db::GetLastInsertedId();
|
$this->VoteId = Db::GetLastInsertedId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function Get(?string $pollUrlName, ?int $userId): ?Vote{
|
public static function Get(?string $pollUrlName, ?int $userId): Vote{
|
||||||
if($pollUrlName === null || $userId === null){
|
if($pollUrlName === null || $userId === null){
|
||||||
vdd('nn');
|
throw new Exceptions\InvalidVoteException();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Db::Query('SELECT v.* from Votes v inner join
|
$result = Db::Query('SELECT v.* from Votes v inner join
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?
|
<?
|
||||||
require_once('Core.php');
|
require_once('Core.php');
|
||||||
|
|
||||||
|
use function \Safe\session_unset;
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
$subscription = new NewsletterSubscription();
|
$subscription = new NewsletterSubscription();
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?
|
<?
|
||||||
require_once('Core.php');
|
require_once('Core.php');
|
||||||
|
|
||||||
|
use function Safe\session_unset;
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
$vote = new Vote();
|
$vote = new Vote();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue