| Total Complexity | 5 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class FactoryEntry implements EntryInterface |
||
| 15 | { |
||
| 16 | /** @var EntryInterface The actual container entry used to determine the value */ |
||
| 17 | private $entry; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * FactoryType constructor. |
||
| 21 | * @param EntryInterface $type The actual container entry used to determine the value |
||
| 22 | */ |
||
| 23 | 1 | public function __construct(EntryInterface $type) |
|
| 24 | { |
||
| 25 | 1 | $this->entry = $type; |
|
| 26 | 1 | } |
|
| 27 | |||
| 28 | /** {@inheritdoc} */ |
||
| 29 | 1 | public static function createFromCacheParameters(array $parameters): EntryInterface |
|
| 30 | { |
||
| 31 | /** @var EntryInterface $class */ |
||
| 32 | 1 | [$class, $cacheParameters] = $parameters; |
|
| 33 | |||
| 34 | /** @var FactoryEntry $factory */ |
||
| 35 | 1 | $factory = (new \ReflectionClass(static::class))->newInstanceWithoutConstructor(); |
|
| 36 | 1 | $factory->entry = $class::createFromCacheParameters($cacheParameters); |
|
| 37 | |||
| 38 | 1 | return $factory; |
|
| 39 | } |
||
| 40 | |||
| 41 | /** {@inheritdoc} */ |
||
| 42 | 1 | public function getCacheParameters(): array |
|
| 43 | { |
||
| 44 | return [ |
||
| 45 | 1 | \get_class($this->entry), |
|
| 46 | 1 | $this->entry->getCacheParameters(), |
|
| 47 | ]; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** {@inheritdoc} */ |
||
| 51 | 1 | public function isFactory(): bool |
|
| 52 | { |
||
| 53 | 1 | return true; |
|
| 54 | } |
||
| 55 | |||
| 56 | /** {@inheritdoc} */ |
||
| 57 | 1 | public function getValue(ContainerInterface $container) |
|
| 60 | } |
||
| 61 | } |
||
| 62 |