From 28331e7cd6f061394a841db047ca1315dc7cde66 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 23 Apr 2017 21:06:23 +0200 Subject: [PATCH] [BridgeAbstract] Return cached infos when using cached items Re-requesting the same feed in normal mode (not debug mode) returns the cached version. The name and URI of the feed however was not returned. This adds checks to getName() and getURI() in order to return the cached infos when using the cached version. Notice: For this to work correctly all bridges must call to parent::getName() and parent::getURI() respectively if the queriedContext is not defined. Example: switch($this->queriedContext){ case 'My context': // do your stuff here! break; default: parent::getName(); } --- lib/BridgeAbstract.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php index 2b1c7639..898b4d05 100644 --- a/lib/BridgeAbstract.php +++ b/lib/BridgeAbstract.php @@ -237,6 +237,11 @@ abstract class BridgeAbstract implements BridgeInterface { } public function getName(){ + // Return cached name when bridge is using cached data + if(isset($this->extraInfos)){ + return $this->extraInfos['name']; + } + return static::NAME; } @@ -245,6 +250,11 @@ abstract class BridgeAbstract implements BridgeInterface { } public function getURI(){ + // Return cached uri when bridge is using cached data + if(isset($this->extraInfos)){ + return $this->extraInfos['uri']; + } + return static::URI; }