37 return $this->agents[$key] ?? null;
43 unset($clone->agents[$key]);
49 if (isset($this->agents[$key])) {
50 throw new \LogicException(
"An agent with the name '$key' already exists.");
53 $clone->agents[$key] = $agent;
62 foreach ($this->agents as
$c) {
63 if ($c->hasConfig()) {
75 return $this->refinery->in()->series([
76 $this->refinery->custom()->transformation(
function (
$in) {
78 foreach ($this->agents as $key => $agent) {
79 if (!$agent->hasConfig()) {
82 $val =
$in[$key] ?? null;
83 $transformation = $agent->getArrayToConfigTransformation();
84 $out[$key] = $transformation($val);
88 $this->refinery->custom()->transformation(
function ($v) {
91 $this->refinery->to()->toNew(ConfigCollection::class)
105 "Collected Install Objectives",
107 ...array_values(array_map(
115 array_keys($this->agents),
116 array_values($this->agents)
131 "Collected Update Objectives",
133 ...array_values(array_map(
140 array_keys($this->agents),
141 array_values($this->agents)
152 "Collected Build Artifact Objectives",
154 ...array_values(array_map(
155 function (
Agent $v) {
169 "Collected Status Objectives",
171 ...array_values(array_map(
172 function (
string $k,
Agent $v) use ($storage) {
174 new Metrics\StorageOnPathWrapper($k, $storage)
177 array_keys($this->agents),
178 array_values($this->agents)
189 foreach ($this->agents as $agent_key => $agent) {
190 foreach ($agent->getMigrations() as $migration) {
194 $key = (new \ReflectionClass($migration))->getShortName();
195 $migrations[$agent_key .
"." . $key] = $migration;
207 $names = explode(
".", $name);
208 $front = array_shift($names);
209 if (!isset($this->agents[$front])) {
210 throw new \InvalidArgumentException(
211 "Can't find named objective '$name'." 221 return $this->agents[$front]->getNamedObjective(implode(
".", $names),
$config);
223 throw new \InvalidArgumentException(
224 "Can't find named objective '$name'.",
233 $names = explode(
"\\", get_class($migration));
234 return array_pop($names);
240 throw new \InvalidArgumentException(
241 "Expected ConfigCollection for configuration."
A objective collection is a objective that is achieved once all subobjectives are achieved...
getStatusObjective(Metrics\Storage $storage)
Get the objective to be achieved when status is requested.
getNamedObjective(string $name, Config $config=null)
getInstallObjective(Config $config=null)
An objective is a desired state of the system that is supposed to be created by the setup...
A migration is a potentially long lasting operation that can be broken into discrete steps...
getUpdateObjective(Config $config=null)
Get the goal the agent wants to achieve on update.
withAdditionalAgent(string $key, Agent $agent)
An agent that is just a collection of some other agents.
getBuildArtifactObjective()
Get the goal the agent wants to achieve to build artifacts.
getInstallObjective(Config $config=null)
Get the goals the agent wants to achieve on setup.
A agent is some component that performs part of the setup process.
getArrayToConfigTransformation()
withRemovedAgent(string $key)
hasConfig()
Does this agent require a configuration?
__construct(Refinery $refinery, array $agents)
getMigrations()
Get a named map of migrations available for this Agent.
checkConfig(Config $config)
getBuildArtifactObjective()
getKey(Setup\Migration $migration)
getUpdateObjective(Config $config=null)
if(php_sapi_name() !='cli') $in
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A configuration for the setup.
A collection of some configurations.
getStatusObjective(Metrics\Storage $storage)