You are here

public function ExtensionPluginManager::validatePlugin in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-feed/src/Reader/ExtensionPluginManager.php \Zend\Feed\Reader\ExtensionPluginManager::validatePlugin()
  2. 8 vendor/zendframework/zend-feed/src/Writer/ExtensionPluginManager.php \Zend\Feed\Writer\ExtensionPluginManager::validatePlugin()
Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Writer/ExtensionPluginManager.php \Zend\Feed\Writer\ExtensionPluginManager::validatePlugin()

Validate the plugin

Checks that the extension loaded is of a valid type.

Parameters

mixed $plugin:

Return value

void

Throws

Exception\InvalidArgumentException if invalid

File

vendor/zendframework/zend-feed/src/Writer/ExtensionPluginManager.php, line 56

Class

ExtensionPluginManager
Plugin manager implementation for feed writer extensions

Namespace

Zend\Feed\Writer

Code

public function validatePlugin($plugin) {
  if ($plugin instanceof Extension\AbstractRenderer) {

    // we're okay
    return;
  }
  if ('Feed' == substr(get_class($plugin), -4)) {

    // we're okay
    return;
  }
  if ('Entry' == substr(get_class($plugin), -5)) {

    // we're okay
    return;
  }
  throw new Exception\InvalidArgumentException(sprintf('Plugin of type %s is invalid; must implement %s\\Extension\\RendererInterface ' . 'or the classname must end in "Feed" or "Entry"', is_object($plugin) ? get_class($plugin) : gettype($plugin), __NAMESPACE__));
}