add wp-rocket
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace WP_Rocket\Engine\Container\Definition;
|
||||
|
||||
use WP_Rocket\Engine\Container\ImmutableContainerAwareTrait;
|
||||
|
||||
class DefinitionFactory implements DefinitionFactoryInterface
|
||||
{
|
||||
use ImmutableContainerAwareTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDefinition($alias, $concrete)
|
||||
{
|
||||
if (is_callable($concrete)) {
|
||||
return (new CallableDefinition($alias, $concrete))->setContainer($this->getContainer());
|
||||
}
|
||||
|
||||
if (is_string($concrete) && class_exists($concrete)) {
|
||||
return (new ClassDefinition($alias, $concrete))->setContainer($this->getContainer());
|
||||
}
|
||||
|
||||
// if the item is not definable we just return the value to be stored
|
||||
// in the container as an arbitrary value/instance
|
||||
return $concrete;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user