ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
5namespace ILIAS\Setup;
6
7use 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 exception for terminatinating execution or to throw for unit testing.
A wrapper around an objective that adds some preconditions.
__construct(Objective $original, Objective ... $preconditions)
achieve(Environment $environment)
@inheritdocs
getPreconditions(Environment $environment)
@inheritdocs
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15