ILIAS  release_7 Revision v7.30-3-g800a261c036
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
6
8
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}
An exception for terminatinating execution or to throw for unit testing.
A wrapper around an objective that attempts to achieve the wrapped objective but won't stop the proce...
Definition: Tentatively.php:14
achieve(Setup\Environment $environment)
@inheritdocs
Definition: Tentatively.php:68
isNotable()
Get to know if this is an interesting objective for a human.
Definition: Tentatively.php:41
getPreconditions(Setup\Environment $environment)
Definition: Tentatively.php:49
isApplicable(Setup\Environment $environment)
@inheritDoc
Definition: Tentatively.php:80
__construct(Setup\Objective $other)
Definition: Tentatively.php:20
getHash()
Get a hash for this objective.
Definition: Tentatively.php:25
getLabel()
Get a label that describes this objective.
Definition: Tentatively.php:33
Signals that some goal won't be achievable by actions of the system ever.
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...