-
-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
294 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace DI\Definition\Resolver; | ||
|
||
use DI\Definition\Definition; | ||
use DI\Definition\SelfResolvingDefinition; | ||
use Interop\Container\ContainerInterface; | ||
|
||
/** | ||
* Resolves self-resolving definitions. | ||
* | ||
* @since 5.3 | ||
* @author Matthieu Napoli <matthieu@mnapoli.fr> | ||
*/ | ||
class SelfResolver implements DefinitionResolver | ||
{ | ||
/** | ||
* @var ContainerInterface | ||
*/ | ||
private $container; | ||
|
||
public function __construct(ContainerInterface $container) | ||
{ | ||
$this->container = $container; | ||
} | ||
|
||
/** | ||
* @param SelfResolvingDefinition $definition | ||
* | ||
* {@inheritdoc} | ||
*/ | ||
public function resolve(Definition $definition, array $parameters = []) | ||
{ | ||
return $definition->resolve($this->container); | ||
} | ||
|
||
/** | ||
* @param SelfResolvingDefinition $definition | ||
* | ||
* {@inheritdoc} | ||
*/ | ||
public function isResolvable(Definition $definition, array $parameters = []) | ||
{ | ||
return $definition->isResolvable($this->container); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace DI\Definition; | ||
|
||
use Interop\Container\ContainerInterface; | ||
|
||
/** | ||
* Describes a definition that can resolve itself. | ||
* | ||
* @author Matthieu Napoli <matthieu@mnapoli.fr> | ||
*/ | ||
interface SelfResolvingDefinition | ||
{ | ||
/** | ||
* Resolve the definition and return the resulting value. | ||
* | ||
* @return mixed | ||
*/ | ||
public function resolve(ContainerInterface $container); | ||
|
||
/** | ||
* Check if a definition can be resolved. | ||
* | ||
* @return bool | ||
*/ | ||
public function isResolvable(ContainerInterface $container); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.