mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 06:40:33 -04:00
Use instanceof instead of is_a() to check some classes
This commit is contained in:
parent
1627c99a46
commit
2fc92b8768
4 changed files with 4 additions and 4 deletions
|
@ -55,7 +55,7 @@ class AtomFeed extends Feed{
|
|||
$currentEntries = [];
|
||||
foreach($this->Entries as $entry){
|
||||
$obj = new StdClass();
|
||||
if(is_a($entry, 'Ebook')){
|
||||
if($entry instanceof Ebook){
|
||||
$obj->Updated = $entry->Updated->format('Y-m-d\TH:i:s\Z');
|
||||
$obj->Id = SITE_URL . $entry->Url;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class DbConnection{
|
|||
foreach($params as $parameter){
|
||||
$name++;
|
||||
|
||||
if(is_a($parameter, 'DateTime') || is_a($parameter, 'DateTimeImmutable')){
|
||||
if($parameter instanceof DateTimeInterface){
|
||||
$parameter = $parameter->format('Y-m-d H:i:s');
|
||||
}
|
||||
elseif(is_bool($parameter)){
|
||||
|
|
|
@ -27,7 +27,7 @@ class OpdsFeed extends AtomFeed{
|
|||
protected function SaveUpdated(string $entryId, DateTime $updated): void{
|
||||
// Only save the updated timestamp for the given entry ID in this file
|
||||
foreach($this->Entries as $entry){
|
||||
if(is_a($entry, 'OpdsNavigationEntry')){
|
||||
if($entry instanceof OpdsNavigationEntry){
|
||||
if($entry->Id == SITE_URL . $entryId){
|
||||
$entry->Updated = $updated;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ $passwordRequired = false;
|
|||
http_response_code(401);
|
||||
|
||||
if($exception){
|
||||
if(is_a($exception, 'Exceptions\PasswordRequiredException')){
|
||||
if($exception instanceof Exceptions\PasswordRequiredException){
|
||||
// This login requires a password to proceed.
|
||||
// Prompt the user for a password.
|
||||
http_response_code(401);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue