Elgg  Version 3.0
PhpDiResolver.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Di;
4 
8 use DI\Scope;
9 
17 class PhpDiResolver implements SelfResolvingDefinition, CacheableDefinition {
18 
22  private $name;
23 
27  private $elgg_dic_key;
28 
35  public function __construct($name, $elgg_dic_key) {
36  $this->name = $name;
37  $this->elgg_dic_key = $elgg_dic_key;
38  }
39 
43  public function getName() {
44  return $this->name;
45  }
46 
50  public function getScope() {
51  return Scope::SINGLETON;
52  }
53 
54 
58  public function resolve(ContainerInterface $container) {
59  return _elgg_services()->{$this->elgg_dic_key};
60  }
61 
65  public function isResolvable(ContainerInterface $container) {
66  return true;
67  }
68 }
__construct($name, $elgg_dic_key)
Constructor.
resolve(ContainerInterface $container)
{}
Cacheable PHP-DI definition that pulls from Elgg&#39;s DIC.
$container
Definition: delete.php:23
$site name
_elgg_services()
Get the global service provider.
Definition: elgglib.php:1292
isResolvable(ContainerInterface $container)
{}