ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\Setup\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\ExternalConditionObjective:
+ Collaboration diagram for ILIAS\Setup\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 (Environment $environment)
 Objectives might depend on other objectives.
Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]
More...
 
 achieve (Environment $environment)
 Objectives can be achieved.They might add resources to the environment when they have been achieved.This method needs to be idempotent for a given environment. That means: if this is executed a second time, nothing new should happen. Or the other way round: if the environment already looks like desired, the objective should not take any further actions when this is called.
Exceptions
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\ExternalConditionObjective::__construct ( string  $label,
callable  $condition,
string  $message = null 
)

Member Function Documentation

◆ achieve()

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

Objectives can be achieved.They might add resources to the environment when they have been achieved.This method needs to be idempotent for a given environment. That means: if this is executed a second time, nothing new should happen. Or the other way round: if the environment already looks like desired, the objective should not take any further actions when this is called.

Exceptions

Implements ILIAS\Setup\Objective.

Definition at line 81 of file ExternalConditionObjective.php.

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

81  : Environment
82  {
83  if (($this->condition)($environment)) {
84  return $environment;
85  }
86 
87  if ($this->message) {
88  $admin_interaction = $environment->getResource(Environment::RESOURCE_ADMIN_INTERACTION);
89  $admin_interaction->inform($this->message);
90  }
91 
92  throw new UnachievableException(
93  "An external condition was not met: {$this->label}"
94  );
95  }
+ Here is the call graph for this function:

◆ getHash()

ILIAS\Setup\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\ExternalConditionObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 57 of file ExternalConditionObjective.php.

References ILIAS\Setup\ExternalConditionObjective\$label.

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

◆ getPreconditions()

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

Objectives might depend on other objectives.

Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]

Implements ILIAS\Setup\Objective.

Definition at line 73 of file ExternalConditionObjective.php.

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

◆ isNotable()

ILIAS\Setup\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\ExternalConditionObjective::$condition
protected

◆ $label

ILIAS\Setup\ExternalConditionObjective::$label
protected

◆ $message

ILIAS\Setup\ExternalConditionObjective::$message
protected

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