19 declare(strict_types=1);
35 if (!isset($this->dependencies[(
string) $d])) {
36 $this->dependencies[(string) $d] = [];
38 $this->dependencies[(string) $d][] = $d;
39 if ($d instanceof
Out) {
40 $d->setComponent($this);
57 foreach ($this->dependencies as
$d) {
59 if ($i instanceof
In) {
68 foreach ($this->dependencies as
$d) {
70 if ($i instanceof
In && $i->
getType() === $type) {
79 foreach ($this->dependencies as
$d) {
81 if ($o instanceof
Out && $o->
getType() === $type) {
90 foreach ($this->dependencies as
$d) {
92 $o->resetResolutions();
101 return array_key_exists($dependency_description, $this->dependencies);
104 public function offsetGet($dependency_description): ?array
106 return $this->dependencies[$dependency_description];
111 throw new \LogicException(
112 "Cannot modify dependencies of component." 118 throw new \LogicException(
119 "Cannot modify dependencies of component."
offsetGet($dependency_description)
offsetExists($dependency_description)
__construct(Component $component, Dependency ... $ds)
A dependency where the component needs something from the world.
getOutDependenciesOf(OutType $type)
A dependency where the component gives something to the world.
offsetSet($offset, $value)
getInDependenciesOf(InType $type)