Registers an layout extension.

@param ExtensionInterface $extension
@param int                $priority
432014
public function addExtension(ExtensionInterface $extension, $priority = 0)
    {
        $this->extensions[$priority][] = $extension;
        $this->sorted                  = null;
        $this->typeExtensions          = [];
    }
60562
public function attach(EventManagerInterface $events, $priority = 1)
    {
        $this->listeners[] = $events->attach(ComposerEvent::EVENT_HTML_BODY_PRE, [$this, 'injectLayoutViewModel']);
    }
1188404
public static void registerExtension (String extension, Class<? extends StreamDecoder> clazz)
    {
        _extensions.put(extension, clazz);
    }
587453
public function addFormViewProvider(FormViewProviderInterface $provider, $priority = 0)
    {
        $this->formViewProviders[$priority][] = $provider;
        $this->needsSorting = true;
    }
206047
public function registerExtension(ExtensionInterface $extension)
    {
        foreach ($extension->supports() as $section)
        {
            $this->extensions[$section] = $extension;
        }
    }
812855
private function addExtension(
        array &$targets,
        string $target,
        string $extension,
        array $attributes
    ): void {
        if (!isset($targets[$target])) {
            $targets[$target] = new \SplPriorityQueue();
        }

        $priority = $attributes['priority'] ?? 0;
        $targets[$target]->insert(new Reference($extension), $priority);
    }
699113
public function on($event, callable $callback, int $priority = 0): EventInterface
    {
        //deal with multiple events
        if (is_array($event)) {
            foreach ($event as $item) {
                $this->on($item, $callback, $priority);
            }

            return $this;
        }

        //set up the observer
        $observer = $this->resolve(EventObserver::class, $callback);

        //is there a regexp ?
        if (strpos($event, '#') === 0 && strrpos($event, '#') !== 0) {
            $this->regex[] = $event;
        //is there a sprintf ?
        //because sscanf will match Render Home Page
        //and Render Home Body with Render %s Page
        //so this needs to be pseudo
        } else if (preg_match('#%[sducoxXbgGeEfF]#s', $event)) {
            //transform that into a regex
            $event = preg_quote($event, '#');
            $event = preg_replace('#%[sducoxXbgGeEfF]#s', '(.+)', $event);
            $event = '#' . $event . '#s';

            $this->regex[] = $event;
        }

        $this->observers[$event][] = [
            'priority' => $priority,
            'observer' => $observer
        ];

        return $this;
    }
1147838
public function register_extensions() {
		$extensions = func_get_args();

		foreach ( $extensions as $extension ) {
			if ( $extension instanceof Twig_ExtensionInterface ) {
				$this->add_extension( $extension );
			} else if ( is_string( $extension ) && class_exists( $extension ) ) {
				$this->add_extension( new $extension );
			} else {
				foreach ( (array) $extension as $ext ) {
					$this->register_extensions( $ext );
				}
			}
		}
	}
444963
protected function registerListener($event, $listener, $priority)
    {
        if (!is_callable($listener)) {
            throw new DispatcherException(sprintf('Invalid event listener. Only callables or ListenerInterface instances can be registered, got "%s"', gettype($listener)));
        }

        if (!isset($this->events[$event])) {
            $this->events[$event] = [];
        }

        if ($priority === null) {
            $this->events[$event][] = $listener;

            return;
        }

        array_splice($this->events[$event], (int) $priority, 0, [$listener]);
    }
1155194
private function registerExtension(\Twig_Environment $twig)
    {
        $extensions = $this->getExtensions();
        if (count($extensions)) {
            foreach ($extensions as $key => $extension) {
                $this->load($twig, $key, $extension);
            }
        }
    }
1026315
public function addInterface($interface, $extends = [])
    {
        $interfaceId = $this->registerInterface($interface);
        if (!empty($extends)) {
            $interfaceIds = [];
            foreach ($extends as $name) {
                $interfaceIds[] = $this->registerInterface($name);
            }
            $this->interfaceExtends[$interfaceId] = $interfaceIds;
        }
    }
798299
protected void register(final Class<? extends Component<?>> interfaceClass, final Class<? extends Component<?>> implClass, final PriorityLevel priority) {
        register(interfaceClass, implClass, priority, 0);
    }
368968
public function registerParameterValueProvider(IParameterValueProvider $parameterValueProvider, $priority = 0)
    {
        $this->providers[(int)$priority][] = $parameterValueProvider;
        ksort($this->providers);
    }
615289
protected function resolveInterfaceExtension(InterfaceDefinition $definition, Endpoint $endpoint): void
    {
        $bundleNamespace = ClassUtils::relatedBundleNamespace($definition->getClass());
        $extensionClass = ClassUtils::applyNamingConvention($bundleNamespace, 'Extension', null, $definition->getName().'Extension');
        if (class_exists($extensionClass)) {
            foreach ($definition->getImplementors() as $implementor) {
                $definition->addExtension($extensionClass);
                $object = $endpoint->getType($implementor);
                if ($object instanceof HasExtensionsInterface) {
                    $object->addExtension($extensionClass);
                }
            }
        }
    }
1278553
public function attach(EntryNameResolverInterface $resolver, $priority = self::DEFAULT_PRIORITY)
    {
        $this->resolvers->insert(
            [
                'instance' => $resolver,

            ],
            $priority
        );

        return $this;
    }
1319964
public function addAdaptMenu(MenuAdaptorInterface $adaptor, $priority = 0)
    {
        $this->adaptors[$priority][] = $adaptor;
        unset($this->sorted);
    }
1032212
public function attach(ResolverInterface $resolver, $priority = 1)
    {
        $this->queue->insert($resolver, $priority);
        return $this;
    }