ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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, \Closure $condition, string $message=null, bool $block_setup=false)
 
 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)
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 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

string $label
 
Closure $condition
 
string $message
 
bool $block_setup
 

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 32 of file ExternalConditionObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Setup\Condition\ExternalConditionObjective::__construct ( string  $label,
\Closure  $condition,
string  $message = null,
bool  $block_setup = false 
)

Member Function Documentation

◆ achieve()

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

Definition at line 92 of file ExternalConditionObjective.php.

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

92  : Setup\Environment
93  {
94  if (($this->condition)($environment)) {
95  return $environment;
96  }
97 
98  if ($this->message) {
99  $admin_interaction = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
100  $admin_interaction->inform($this->message);
101  }
102  if ($this->block_setup) {
103  throw new Setup\NotExecutableException("An external condition was not met: $this->label");
104  }
105 
106  throw new Setup\UnachievableException("An external condition was not met: $this->label");
107  }
+ 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 57 of file ExternalConditionObjective.php.

57  : string
58  {
59  return hash(
60  "sha256",
61  get_class($this) . "::" . $this->label
62  );
63  }

◆ getLabel()

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

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 68 of file ExternalConditionObjective.php.

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

68  : string
69  {
70  return $this->label;
71  }

◆ getPreconditions()

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

Definition at line 84 of file ExternalConditionObjective.php.

84  : array
85  {
86  return [];
87  }

◆ isApplicable()

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

Definition at line 112 of file ExternalConditionObjective.php.

112  : bool
113  {
114  return true;
115  }

◆ 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 76 of file ExternalConditionObjective.php.

76  : bool
77  {
78  return true;
79  }

Field Documentation

◆ $block_setup

bool ILIAS\Setup\Condition\ExternalConditionObjective::$block_setup
protected

◆ $condition

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

◆ $label

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

◆ $message

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

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