Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / league / container / src / Definition / DefinitionFactory.php
1 <?php
2
3 namespace League\Container\Definition;
4
5 use League\Container\ImmutableContainerAwareTrait;
6
7 class DefinitionFactory implements DefinitionFactoryInterface
8 {
9     use ImmutableContainerAwareTrait;
10
11     /**
12      * {@inheritdoc}
13      */
14     public function getDefinition($alias, $concrete)
15     {
16         if (is_callable($concrete)) {
17             return (new CallableDefinition($alias, $concrete))->setContainer($this->getContainer());
18         }
19
20         if (is_string($concrete) && class_exists($concrete)) {
21             return (new ClassDefinition($alias, $concrete))->setContainer($this->getContainer());
22         }
23
24         // if the item is not definable we just return the value to be stored
25         // in the container as an arbitrary value/instance
26         return $concrete;
27     }
28 }