ILIAS  release_7 Revision v7.30-3-g800a261c036
ILIAS\Setup\Condition\ExternalConditionObjective Class Reference

A condition that can't be met by ILIAS itself needs to be met by some external means. More...

+ Inheritance diagram for ILIAS\Setup\Condition\ExternalConditionObjective:
+ Collaboration diagram for ILIAS\Setup\Condition\ExternalConditionObjective:

Public Member Functions

 __construct (string $label, callable $condition, string $message=null)
 
 getHash ()
 Get a hash for this objective.The hash of two objectives must be the same, if they are the same objective, with the same config on the same environment, i.e. if the one is achieved the other is achieved as well because they are the same. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 

Protected Attributes

 $label
 
 $condition
 
 $message
 

Detailed Description

A condition that can't be met by ILIAS itself needs to be met by some external means.

ATTENTION: Two ExternalConditionObjectives are considered to be identical if the label is identical. I.e., getHash does not use the actual condition or the message.

Definition at line 16 of file ExternalConditionObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Setup\Condition\ExternalConditionObjective::__construct ( string  $label,
callable  $condition,
string  $message = null 
)

Member Function Documentation

◆ achieve()

ILIAS\Setup\Condition\ExternalConditionObjective::achieve ( Setup\Environment  $environment)

Definition at line 81 of file ExternalConditionObjective.php.

82 {
83 if (($this->condition)($environment)) {
84 return $environment;
85 }
86
87 if ($this->message) {
88 $admin_interaction = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
89 $admin_interaction->inform($this->message);
90 }
91
92 throw new Setup\UnachievableException(
93 "An external condition was not met: {$this->label}"
94 );
95 }
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.

References ILIAS\Setup\Environment\getResource(), and ILIAS\Setup\Environment\RESOURCE_ADMIN_INTERACTION.

+ Here is the call graph for this function:

◆ getHash()

ILIAS\Setup\Condition\ExternalConditionObjective::getHash ( )

Get a hash for this objective.The hash of two objectives must be the same, if they are the same objective, with the same config on the same environment, i.e. if the one is achieved the other is achieved as well because they are the same.

Implements ILIAS\Setup\Objective.

Definition at line 46 of file ExternalConditionObjective.php.

46 : string
47 {
48 return hash(
49 "sha256",
50 get_class($this) . "::" . $this->label
51 );
52 }

◆ getLabel()

ILIAS\Setup\Condition\ExternalConditionObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 57 of file ExternalConditionObjective.php.

57 : string
58 {
59 return $this->label;
60 }

References ILIAS\Setup\Condition\ExternalConditionObjective\$label.

◆ getPreconditions()

ILIAS\Setup\Condition\ExternalConditionObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 73 of file ExternalConditionObjective.php.

73 : array
74 {
75 return [];
76 }

◆ isApplicable()

ILIAS\Setup\Condition\ExternalConditionObjective::isApplicable ( Setup\Environment  $environment)

@inheritDoc

Definition at line 100 of file ExternalConditionObjective.php.

100 : bool
101 {
102 return true;
103 }

◆ isNotable()

ILIAS\Setup\Condition\ExternalConditionObjective::isNotable ( )

Get to know if this is an interesting objective for a human.

Implements ILIAS\Setup\Objective.

Definition at line 65 of file ExternalConditionObjective.php.

65 : bool
66 {
67 return true;
68 }

Field Documentation

◆ $condition

ILIAS\Setup\Condition\ExternalConditionObjective::$condition
protected

◆ $label

ILIAS\Setup\Condition\ExternalConditionObjective::$label
protected

◆ $message

ILIAS\Setup\Condition\ExternalConditionObjective::$message
protected

The documentation for this class was generated from the following file: