ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ObjectiveWithPreconditions.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 namespace ILIAS\Setup;
6 
7 use ILIAS\UI;
8 
16 {
20  protected $original;
21 
25  protected $preconditions;
26 
28  {
29  if (count($preconditions) === 0) {
30  throw new \InvalidArgumentException(
31  "Expected at least one precondition."
32  );
33  }
34  $this->original = $original;
35  $this->preconditions = $preconditions;
36  }
37 
41  public function getHash() : string
42  {
43  return $this->original->getHash();
44  }
45 
49  public function getLabel() : string
50  {
51  return $this->original->getLabel();
52  }
53 
57  public function isNotable() : bool
58  {
59  return $this->original->isNotable();
60  }
61 
65  public function getPreconditions(Environment $environment) : array
66  {
67  return array_merge($this->preconditions, $this->original->getPreconditions($environment));
68  }
69 
73  public function achieve(Environment $environment) : Environment
74  {
75  return $this->original->achieve($environment);
76  }
77 }
An objective is a desired state of the system that is supposed to be created by the setup...
Definition: Objective.php:14
__construct(Objective $original, Objective ... $preconditions)
A wrapper around an objective that adds some preconditions.
An environment holds resources to be used in the setup process.
Definition: Environment.php:11