98a50b0c6b5f81c7d5b1a525e8887dad06a2205d
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / DependencyCollectorTrait.php
1 <?php
2
3 namespace Drupal\drupalmoduleupgrader;
4
5 use Symfony\Component\DependencyInjection\ContainerInterface;
6
7 /**
8  * Provides a default implementation of ContainerFactoryPluginInterface which
9  * will pull any dependencies declared in the plugin definition out of the
10  * container.
11  */
12 trait DependencyCollectorTrait {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
18     $arguments = array_slice(func_get_args(), 1);
19     $arguments += array_map([ $container, 'get' ], @($plugin_definition['dependencies'] ? : []));
20     return (new \ReflectionClass(get_called_class()))->newInstanceArgs($arguments);
21   }
22
23 }