From 26d05c32c4eaad960cd7c1c27b0852c73abe2777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Badet=20Aur=C3=A9lien?= Date: Fri, 18 Nov 2016 14:52:18 +0100 Subject: [PATCH 1/2] add function getExtraInfos() to BridgeAbstract --- lib/BridgeAbstract.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php index 95170996..6fee1c00 100644 --- a/lib/BridgeAbstract.php +++ b/lib/BridgeAbstract.php @@ -194,6 +194,13 @@ abstract class BridgeAbstract implements BridgeInterface { public function getURI(){ return static::URI; } + + public function getExtraInfos(){ + $ExtraInfos = array(); + $ExtraInfos->'name'= getName(); + $ExtraInfos->'uri'= getURI(); + return $ExtraInfos; + } public function setCache(\CacheInterface $cache){ $this->cache = $cache; From 1af4c88e32e8480052926b935f05ac0180ff4478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Badet=20Aur=C3=A9lien?= Date: Fri, 18 Nov 2016 15:04:06 +0100 Subject: [PATCH 2/2] replace call to $bridge->getName() and $bridge->getURI() by $bridge->getExtraInfos() replace call to $bridge->getName() and $bridge->getURI() by $bridge->getExtraInfos() defined by default in BridgeAbstract. So we could pass additionals ExtraInfos from custom bridges to custom formats. --- index.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index b4ae384c..b61a02a8 100644 --- a/index.php +++ b/index.php @@ -159,13 +159,9 @@ try { // Data transformation try { $format = Format::create($format); - $format - ->setItems($bridge->getItems()) - ->setExtraInfos(array( - 'name' => $bridge->getName(), - 'uri' => $bridge->getURI(), - )) - ->display(); + $format->setItems($bridge->getItems()); + $format->setExtraInfos($bridge->getExtraInfos()); + $format->display(); } catch(Exception $e){ echo "The bridge has crashed. You should report this to the bridges maintainer"; }