ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
Tentatively.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 namespace ILIAS\Setup\Objective;
22 
23 use ILIAS\Setup;
24 
29 class Tentatively implements Setup\Objective
30 {
32 
33  public function __construct(Setup\Objective $other)
34  {
35  $this->other = $other;
36  }
37 
38  public function getHash(): string
39  {
40  if ($this->other instanceof Tentatively) {
41  return $this->other->getHash();
42  }
43  return "tentatively " . $this->other->getHash();
44  }
45 
46  public function getLabel(): string
47  {
48  if ($this->other instanceof Tentatively) {
49  return $this->other->getLabel();
50  }
51  return "Tentatively: " . $this->other->getLabel();
52  }
53 
54  public function isNotable(): bool
55  {
56  return $this->other->isNotable();
57  }
58 
59  /*
60  * @inheritdocs
61  */
62  public function getPreconditions(Setup\Environment $environment): array
63  {
64  if ($this->other instanceof Tentatively) {
65  return $this->other->getPreconditions($environment);
66  }
67  return array_map(
68  function ($p): \ILIAS\Setup\Objective\Tentatively {
69  if ($p instanceof Tentatively) {
70  return $p;
71  }
72  return new Tentatively($p);
73  },
74  $this->other->getPreconditions($environment)
75  );
76  }
77 
81  public function achieve(Setup\Environment $environment): Setup\Environment
82  {
83  try {
84  return $this->other->achieve($environment);
85  } catch (Setup\UnachievableException $e) {
86  }
87  return $environment;
88  }
89 
93  public function isApplicable(Setup\Environment $environment): bool
94  {
95  return $this->other->isApplicable($environment);
96  }
97 }
getPreconditions(Setup\Environment $environment)
Definition: Tentatively.php:62
An objective is a desired state of the system that is supposed to be created by the setup...
Definition: Objective.php:30
isNotable()
Get to know if this is an interesting objective for a human.
Definition: Tentatively.php:54
Class ChatMainBarProvider .
getLabel()
Get a label that describes this objective.
Definition: Tentatively.php:46
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:38
__construct(Setup\Objective $other)
Definition: Tentatively.php:33
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isApplicable(Setup\Environment $environment)
Definition: Tentatively.php:93
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:29
achieve(Setup\Environment $environment)
Definition: Tentatively.php:81
An environment holds resources to be used in the setup process.
Definition: Environment.php:27