You are here

class ExtensionPluginManager in Zircon Profile 8

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

Plugin manager implementation for feed reader extensions based on the AbstractPluginManager.

Validation checks that we have an Extension\AbstractEntry or Extension\AbstractFeed.

Hierarchy

Expanded class hierarchy of ExtensionPluginManager

File

vendor/zendframework/zend-feed/src/Reader/ExtensionPluginManager.php, line 21

Namespace

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

  /**
   * Default set of extension classes
   *
   * @var array
   */
  protected $invokableClasses = [
    'atomentry' => 'Zend\\Feed\\Reader\\Extension\\Atom\\Entry',
    'atomfeed' => 'Zend\\Feed\\Reader\\Extension\\Atom\\Feed',
    'contententry' => 'Zend\\Feed\\Reader\\Extension\\Content\\Entry',
    'creativecommonsentry' => 'Zend\\Feed\\Reader\\Extension\\CreativeCommons\\Entry',
    'creativecommonsfeed' => 'Zend\\Feed\\Reader\\Extension\\CreativeCommons\\Feed',
    'dublincoreentry' => 'Zend\\Feed\\Reader\\Extension\\DublinCore\\Entry',
    'dublincorefeed' => 'Zend\\Feed\\Reader\\Extension\\DublinCore\\Feed',
    'podcastentry' => 'Zend\\Feed\\Reader\\Extension\\Podcast\\Entry',
    'podcastfeed' => 'Zend\\Feed\\Reader\\Extension\\Podcast\\Feed',
    'slashentry' => 'Zend\\Feed\\Reader\\Extension\\Slash\\Entry',
    'syndicationfeed' => 'Zend\\Feed\\Reader\\Extension\\Syndication\\Feed',
    'threadentry' => 'Zend\\Feed\\Reader\\Extension\\Thread\\Entry',
    'wellformedwebentry' => 'Zend\\Feed\\Reader\\Extension\\WellFormedWeb\\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\AbstractEntry || $plugin instanceof Extension\AbstractFeed) {

      // we're okay
      return;
    }
    throw new Exception\InvalidArgumentException(sprintf('Plugin of type %s is invalid; must implement %s\\Extension\\AbstractFeed ' . 'or %s\\Extension\\AbstractEntry', is_object($plugin) ? get_class($plugin) : gettype($plugin), __NAMESPACE__, __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