ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
Tentatively.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2020 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 namespace ILIAS\Setup\Objective;
6 
7 use ILIAS\Setup;
8 
13 class Tentatively implements Setup\Objective
14 {
18  protected $other;
19 
20  public function __construct(Setup\Objective $other)
21  {
22  $this->other = $other;
23  }
24 
25  public function getHash() : string
26  {
27  if ($this->other instanceof Tentatively) {
28  return $this->other->getHash();
29  }
30  return "tentatively " . $this->other->getHash();
31  }
32 
33  public function getLabel() : string
34  {
35  if ($this->other instanceof Tentatively) {
36  return $this->other->getLabel();
37  }
38  return "Tentatively: " . $this->other->getLabel();
39  }
40 
41  public function isNotable() : bool
42  {
43  return $this->other->isNotable();
44  }
45 
46  /*
47  * @inheritdocs
48  */
49  public function getPreconditions(Setup\Environment $environment) : array
50  {
51  if ($this->other instanceof Tentatively) {
52  return $this->other->getPreconditions($environment);
53  }
54  return array_map(
55  function ($p) {
56  if ($p instanceof Tentatively) {
57  return $p;
58  }
59  return new Tentatively($p);
60  },
61  $this->other->getPreconditions($environment)
62  );
63  }
64 
68  public function achieve(Setup\Environment $environment) : Setup\Environment
69  {
70  try {
71  return $this->other->achieve($environment);
72  } catch (Setup\UnachievableException $e) {
73  }
74  return $environment;
75  }
76 
80  public function isApplicable(Setup\Environment $environment) : bool
81  {
82  return $this->other->isApplicable($environment);
83  }
84 }
getPreconditions(Setup\Environment $environment)
Definition: Tentatively.php:49
An objective is a desired state of the system that is supposed to be created by the setup...
Definition: Objective.php:14
isNotable()
Get to know if this is an interesting objective for a human.
Definition: Tentatively.php:41
getLabel()
Get a label that describes this objective.
Definition: Tentatively.php:33
Signals that some goal won&#39;t be achievable by actions of the system ever.
getHash()
Get a hash for this objective.
Definition: Tentatively.php:25
__construct(Setup\Objective $other)
Definition: Tentatively.php:20
isApplicable(Setup\Environment $environment)
Definition: Tentatively.php:80
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A wrapper around an objective that attempts to achieve the wrapped objective but won&#39;t stop the proce...
Definition: Tentatively.php:13
achieve(Setup\Environment $environment)
Definition: Tentatively.php:68
An environment holds resources to be used in the setup process.
Definition: Environment.php:11