mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 09:32:24 -04:00
Some type check fixes
This commit is contained in:
parent
d4707eb595
commit
bd4b8d8944
6 changed files with 6 additions and 5 deletions
|
@ -6,6 +6,7 @@ use function Safe\json_encode;
|
|||
use function Safe\glob;
|
||||
use function Safe\preg_match;
|
||||
use function Safe\preg_replace;
|
||||
use function Safe\sprintf;
|
||||
use function Safe\substr;
|
||||
|
||||
class Ebook{
|
||||
|
@ -108,7 +109,7 @@ class Ebook{
|
|||
// emits a warning. So, just silence the warning.
|
||||
$bytes = @filesize($this->WwwFilesystemPath . '/text/single-page.xhtml');
|
||||
$sizes = 'BKMGTP';
|
||||
$factor = floor((strlen($bytes) - 1) / 3);
|
||||
$factor = intval(floor((strlen((string)$bytes) - 1) / 3));
|
||||
$this->TextSinglePageSizeNumber = sprintf('%.1f', $bytes / pow(1024, $factor));
|
||||
$this->TextSinglePageSizeUnit = $sizes[$factor] ?? '';
|
||||
$this->TextSinglePageUrl = $this->Url . '/text/single-page';
|
||||
|
|
|
@ -57,7 +57,7 @@ class NewsletterSubscription extends PropertiesBase{
|
|||
', [$this->User->UserId, false, $this->IsSubscribedToNewsletter, $this->IsSubscribedToSummary, $this->Created]);
|
||||
}
|
||||
catch(PDOException $ex){
|
||||
if($ex->errorInfo[1] == 1062){
|
||||
if(($ex->errorInfo[1] ?? 0) == 1062){
|
||||
// Duplicate unique key; email already in use
|
||||
throw new Exceptions\NewsletterSubscriptionExistsException();
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class Payment extends PropertiesBase{
|
|||
', [$this->UserId, $this->Created, $this->ChannelId, $this->TransactionId, $this->Amount, $this->Fee, $this->IsRecurring, $this->IsMatchingDonation]);
|
||||
}
|
||||
catch(PDOException $ex){
|
||||
if($ex->errorInfo[1] == 1062){
|
||||
if(($ex->errorInfo[1] ?? 0) == 1062){
|
||||
// Duplicate unique key; transction ID already exists
|
||||
throw new Exceptions\PaymentExistsException();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Safe\DateTime;
|
||||
use function Safe\strtotime;
|
||||
|
||||
/**
|
||||
* @property User $User
|
||||
|
|
|
@ -88,7 +88,7 @@ class User extends PropertiesBase{
|
|||
', [$this->Email, $this->Name, $this->Uuid, $this->Created]);
|
||||
}
|
||||
catch(PDOException $ex){
|
||||
if($ex->errorInfo[1] == 1062){
|
||||
if(($ex->errorInfo[1] ?? 0) == 1062){
|
||||
// Duplicate unique key; email already in use
|
||||
throw new Exceptions\UserExistsException();
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ try{
|
|||
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
curl_setopt($handle, CURLOPT_POSTFIELDS, '{"Suppressions": [{"EmailAddress": "' . $email . '"}]}');
|
||||
curl_exec($handle);
|
||||
curl_close($handle);
|
||||
}
|
||||
elseif($post->RecordType == 'SubscriptionChange' && $post->SuppressionReason === null){
|
||||
$log->Write('Event type: suppression deletion.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue