public static function FeedsConfigurable::instance in Feeds 7.2
Same name and namespace in other branches
- 6 includes/FeedsConfigurable.inc \FeedsConfigurable::instance()
- 7 includes/FeedsConfigurable.inc \FeedsConfigurable::instance()
Provides a statically cached instance of a FeedsConfigurable subclass.
Don't use directly, use feeds_importer() or feeds_plugin() instead.
Parameters
string $class: The name of a subclass of FeedsConfigurable.
string $id: The ID of this configuration object.
Return value
FeedsConfigurable An instance of this class.
Throws
InvalidArgumentException When an empty configuration identifier is passed.
See also
1 call to FeedsConfigurable::instance()
- feeds_importer in ./
feeds.module - Gets an importer instance.
2 methods override FeedsConfigurable::instance()
- FeedsPlugin::instance in plugins/
FeedsPlugin.inc - Instantiates a FeedsPlugin object.
- FeedsSource::instance in includes/
FeedsSource.inc - Instantiates an unique FeedsSource per class, importer ID and Feed node ID.
File
- includes/
FeedsConfigurable.inc, line 83 - FeedsConfigurable and helper functions.
Class
- FeedsConfigurable
- Base class for configurable classes.
Code
public static function instance($class, $id) {
// @todo Verify that $class is an existing subclass of FeedsConfigurable.
if (!strlen($id)) {
throw new InvalidArgumentException(t('Empty configuration identifier.'));
}
$instances =& drupal_static(__METHOD__, array());
if (!isset($instances[$class][$id])) {
$instances[$class][$id] = new $class($id);
}
return $instances[$class][$id];
}