GraphRegistry
The graphs an app declares — the list a reader can see in a diff. Registration is by CLASS, and compilation is lazy: a graph is compiled the first time somebody asks for it, so a malformed declaration fails when it is used and names itself, instead of taking the whole app down at boot for a graph nobody ran. The compiled result is kept, because compiling is reflection and a process may be advanced many times.
GraphRegistry::__construct()
public function __construct(?Closure $resolve = null):Parameters
| Name | Type | Description |
|---|---|---|
| $resolve | (\Closure | null) | `fn (string $type): object` — how every node's collaborators are found |
GraphRegistry::register()
public function register(string $class): selfDeclares a graph class. The name is the one its own `#[Graph]` carries.
Parameters
| Name | Type | Description |
|---|---|---|
| $class | class-string |
Throws
GraphDeclarationException when the class is not a declared graph, or the name is taken
GraphRegistry::names()
public function names(): arrayThe names of every graph this app declared.
GraphRegistry::has()
public function has(string $name): boolIs a graph declared under this name?
Parameters
| Name | Type | Description |
|---|---|---|
| $name | string |
GraphRegistry::get()
public function get(string $name): Milpa\Orchestrator\Declaration\CompiledGraphThe compiled graph carrying this name, compiled on first use and kept afterwards.
Parameters
| Name | Type | Description |
|---|---|---|
| $name | string |
Throws
CallRefused when no graph carries that name
GraphDeclarationException when the graph that does cannot be compiled