mirror of
https://github.com/standardebooks/web.git
synced 2025-07-14 18:42:00 -04:00
Add PropertyFromHttp trait and update codebase to use new pattern
This commit is contained in:
parent
c35c47b793
commit
acb30b897c
47 changed files with 851 additions and 527 deletions
|
@ -18,15 +18,10 @@ class DonationDrive{
|
|||
public function __construct(public string $Name, public DateTimeImmutable $Start, public DateTimeImmutable $End, public int $BaseTargetDonationCount, public int $StretchTargetDonationCount){
|
||||
}
|
||||
|
||||
public static function GetByIsRunning(): ?DonationDrive{
|
||||
foreach(DONATION_DRIVE_DATES as $donationDrive){
|
||||
if(NOW > $donationDrive->Start && NOW < $donationDrive->End){
|
||||
return $donationDrive;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
// *******
|
||||
// GETTERS
|
||||
// *******
|
||||
|
||||
protected function GetDonationCount(): int{
|
||||
if(!isset($this->_DonationCount)){
|
||||
|
@ -92,4 +87,19 @@ class DonationDrive{
|
|||
|
||||
return $this->_IsStretchEnabled;
|
||||
}
|
||||
|
||||
|
||||
// ***********
|
||||
// ORM METHODS
|
||||
// ***********
|
||||
|
||||
public static function GetByIsRunning(): ?DonationDrive{
|
||||
foreach(DONATION_DRIVE_DATES as $donationDrive){
|
||||
if(NOW > $donationDrive->Start && NOW < $donationDrive->End){
|
||||
return $donationDrive;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue