ILIAS  release_7 Revision v7.30-3-g800a261c036
AdminConfirmedObjective.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
6
8
13{
17 protected $message;
18
19 public function __construct(string $message)
20 {
21 $this->message = $message;
22 }
23
27 public function getHash() : string
28 {
29 return hash(
30 "sha256",
31 get_class($this) . "::" . $this->message
32 );
33 }
34
38 public function getLabel() : string
39 {
40 return "Get a confirmation from admin.";
41 }
42
46 public function isNotable() : bool
47 {
48 return false;
49 }
50
54 public function getPreconditions(Setup\Environment $environment) : array
55 {
56 return [];
57 }
58
62 public function achieve(Setup\Environment $environment) : Setup\Environment
63 {
64 $admin_interaction = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
65
66 if (!$admin_interaction->confirmOrDeny($this->message)) {
68 $this->message
69 );
70 }
71
72 return $environment;
73 }
74
78 public function isApplicable(Setup\Environment $environment) : bool
79 {
80 return true;
81 }
82}
An exception for terminatinating execution or to throw for unit testing.
Signals that a necessary confirmation from the admin is missing.
An admin needs to confirm something to achieve this objective.
getLabel()
Get a label that describes this objective.
isApplicable(Setup\Environment $environment)
@inheritDoc
getHash()
Get a hash for this objective.The hash of two objectives must be the same, if they are the same objec...
isNotable()
Get to know if this is an interesting objective for a human.
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
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...