mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-06 00:27:27 +02:00
Correction de quelques bugs dans les bridges, qui apparaissent à cause du fait qu'ils sont tous instanciés lors du chargement de tout les bridges.
Ré-ajout et ré-utilisation de getName et getURI, qui permettent d'avoir des élements dynamiques. Changement en public de certaines valeurs. Changement du nom de certaines constantes, déja utilisés. Signed-off-by: teromene <teromene@teromene.fr>
This commit is contained in:
@@ -8,6 +8,8 @@ interface BridgeInterface{
|
||||
public function collectData(array $param);
|
||||
public function getCacheDuration();
|
||||
public function loadMetadatas();
|
||||
public function getName();
|
||||
public function getURI();
|
||||
}
|
||||
|
||||
abstract class BridgeAbstract implements BridgeInterface{
|
||||
@@ -207,6 +209,19 @@ class Bridge{
|
||||
throw new \LogicException('Please use ' . __CLASS__ . '::create for new object.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a bridge is an instantiable bridge.
|
||||
* @param string $nameBridge name of the bridge that you want to use
|
||||
* @return true if it is an instantiable bridge, false otherwise.
|
||||
*/
|
||||
static public function isInstantiable($nameBridge) {
|
||||
|
||||
$re = new ReflectionClass($nameBridge);
|
||||
return $re->IsInstantiable();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new bridge object
|
||||
* @param string $nameBridge Defined bridge name you want use
|
||||
@@ -225,7 +240,11 @@ class Bridge{
|
||||
|
||||
require_once $pathBridge;
|
||||
|
||||
return new $nameBridge();
|
||||
if(Bridge::isInstantiable($nameBridge)) {
|
||||
return new $nameBridge();
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static public function setDir($dirBridge){
|
||||
|
Reference in New Issue
Block a user