You are here

class ExtensionPluginManager in Zircon Profile 8.0

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

Plugin manager implementation for feed writer extensions

Validation checks that we have an Entry, Feed, or Extension\AbstractRenderer.

Hierarchy

Expanded class hierarchy of ExtensionPluginManager

File

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

Namespace

Zend\Feed\Writer
View source
class ExtensionPluginManager extends AbstractPluginManager {

  /**
   * Default set of extension classes
   *
   * @var array
   */
  protected $invokableClasses = [
    'atomrendererfeed' => 'Zend\\Feed\\Writer\\Extension\\Atom\\Renderer\\Feed',
    'contentrendererentry' => 'Zend\\Feed\\Writer\\Extension\\Content\\Renderer\\Entry',
    'dublincorerendererentry' => 'Zend\\Feed\\Writer\\Extension\\DublinCore\\Renderer\\Entry',
    'dublincorerendererfeed' => 'Zend\\Feed\\Writer\\Extension\\DublinCore\\Renderer\\Feed',
    'itunesentry' => 'Zend\\Feed\\Writer\\Extension\\ITunes\\Entry',
    'itunesfeed' => 'Zend\\Feed\\Writer\\Extension\\ITunes\\Feed',
    'itunesrendererentry' => 'Zend\\Feed\\Writer\\Extension\\ITunes\\Renderer\\Entry',
    'itunesrendererfeed' => 'Zend\\Feed\\Writer\\Extension\\ITunes\\Renderer\\Feed',
    'slashrendererentry' => 'Zend\\Feed\\Writer\\Extension\\Slash\\Renderer\\Entry',
    'threadingrendererentry' => 'Zend\\Feed\\Writer\\Extension\\Threading\\Renderer\\Entry',
    'wellformedwebrendererentry' => 'Zend\\Feed\\Writer\\Extension\\WellFormedWeb\\Renderer\\Entry',
  ];

  /**
   * Do not share instances
   *
   * @var bool
   */
  protected $shareByDefault = false;

  /**
   * Validate the plugin
   *
   * Checks that the extension loaded is of a valid type.
   *
   * @param  mixed $plugin
   * @return void
   * @throws Exception\InvalidArgumentException if invalid
   */
  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__));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ExtensionPluginManager::$invokableClasses protected property Default set of extension classes
ExtensionPluginManager::$shareByDefault protected property Do not share instances
ExtensionPluginManager::validatePlugin public function Validate the plugin