You are here

public static function Writer::registerExtension in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Writer/Writer.php \Zend\Feed\Writer\Writer::registerExtension()

Register an Extension by name

Parameters

string $name:

Return value

void

Throws

Exception\RuntimeException if unable to resolve Extension class

1 call to Writer::registerExtension()
Writer::registerCoreExtensions in vendor/zendframework/zend-feed/src/Writer/Writer.php
Register core (default) extensions

File

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

Class

Writer

Namespace

Zend\Feed\Writer

Code

public static function registerExtension($name) {
  $feedName = $name . '\\Feed';
  $entryName = $name . '\\Entry';
  $feedRendererName = $name . '\\Renderer\\Feed';
  $entryRendererName = $name . '\\Renderer\\Entry';
  $manager = static::getExtensionManager();
  if (static::isRegistered($name)) {
    if ($manager
      ->has($feedName) || $manager
      ->has($entryName) || $manager
      ->has($feedRendererName) || $manager
      ->has($entryRendererName)) {
      return;
    }
  }
  if (!$manager
    ->has($feedName) && !$manager
    ->has($entryName) && !$manager
    ->has($feedRendererName) && !$manager
    ->has($entryRendererName)) {
    throw new Exception\RuntimeException('Could not load extension: ' . $name . 'using Plugin Loader. Check prefix paths are configured and extension exists.');
  }
  if ($manager
    ->has($feedName)) {
    static::$extensions['feed'][] = $feedName;
  }
  if ($manager
    ->has($entryName)) {
    static::$extensions['entry'][] = $entryName;
  }
  if ($manager
    ->has($feedRendererName)) {
    static::$extensions['feedRenderer'][] = $feedRendererName;
  }
  if ($manager
    ->has($entryRendererName)) {
    static::$extensions['entryRenderer'][] = $entryRendererName;
  }
}