decorated = $decorated; $this->pluginDefinitionAnnotationName = $plugin_definition_annotation_name; } /** * {@inheritdoc} */ public function getDefinitions() { $definitions = $this->decorated->getDefinitions(); foreach ($definitions as $id => $definition) { // Annotation constructors expect an array of values. If the definition is // not an array, it usually means it has been processed already and can be // ignored. if (is_array($definition)) { $definitions[$id] = (new $this->pluginDefinitionAnnotationName($definition))->get(); } } return $definitions; } /** * Passes through all unknown calls onto the decorated object. * * @param string $method * The method to call on the decorated plugin discovery. * @param array $args * The arguments to send to the method. * * @return mixed * The method result. */ public function __call($method, $args) { return call_user_func_array([$this->decorated, $method], $args); } }