ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\Setup\Objective\ObjectiveWithPreconditions Class Reference

A wrapper around an objective that adds some preconditions. More...

+ Inheritance diagram for ILIAS\Setup\Objective\ObjectiveWithPreconditions:
+ Collaboration diagram for ILIAS\Setup\Objective\ObjectiveWithPreconditions:

Public Member Functions

 __construct (Setup\Objective $original, Setup\Objective ... $preconditions)
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 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

Setup Objective $original
 
array $preconditions
 

Detailed Description

A wrapper around an objective that adds some preconditions.

ATTENTION: This will use the same hash then the original objective and will therefore be indistinguishable.

Definition at line 31 of file ObjectiveWithPreconditions.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Setup\Objective\ObjectiveWithPreconditions::__construct ( Setup\Objective  $original,
Setup\Objective ...  $preconditions 
)

Definition at line 40 of file ObjectiveWithPreconditions.php.

References ILIAS\Setup\Objective\ObjectiveWithPreconditions\$original, and ILIAS\Setup\Objective\ObjectiveWithPreconditions\$preconditions.

41  {
42  if ($preconditions === []) {
43  throw new \InvalidArgumentException(
44  "Expected at least one precondition."
45  );
46  }
47  $this->original = $original;
48  $this->preconditions = $preconditions;
49  }

Member Function Documentation

◆ achieve()

ILIAS\Setup\Objective\ObjectiveWithPreconditions::achieve ( Setup\Environment  $environment)

Definition at line 97 of file ObjectiveWithPreconditions.php.

97  : Setup\Environment
98  {
99  return $this->original->achieve($environment);
100  }

◆ getHash()

ILIAS\Setup\Objective\ObjectiveWithPreconditions::getHash ( )

Implements ILIAS\Setup\Objective.

Definition at line 54 of file ObjectiveWithPreconditions.php.

References ILIAS\Setup\Objective\ObjectiveWithPreconditions\$preconditions.

54  : string
55  {
56  return hash(
57  "sha256",
58  self::class
59  . $this->original->getHash()
60  . implode(
61  "",
62  array_map(
63  fn ($o) => $o->getHash(),
65  )
66  )
67  );
68  }

◆ getLabel()

ILIAS\Setup\Objective\ObjectiveWithPreconditions::getLabel ( )

Implements ILIAS\Setup\Objective.

Definition at line 73 of file ObjectiveWithPreconditions.php.

73  : string
74  {
75  return $this->original->getLabel();
76  }

◆ getPreconditions()

ILIAS\Setup\Objective\ObjectiveWithPreconditions::getPreconditions ( Setup\Environment  $environment)

Definition at line 89 of file ObjectiveWithPreconditions.php.

89  : array
90  {
91  return array_merge($this->preconditions, $this->original->getPreconditions($environment));
92  }

◆ isApplicable()

ILIAS\Setup\Objective\ObjectiveWithPreconditions::isApplicable ( Setup\Environment  $environment)

Definition at line 105 of file ObjectiveWithPreconditions.php.

105  : bool
106  {
107  return $this->original->isApplicable($environment);
108  }

◆ isNotable()

ILIAS\Setup\Objective\ObjectiveWithPreconditions::isNotable ( )

Implements ILIAS\Setup\Objective.

Definition at line 81 of file ObjectiveWithPreconditions.php.

81  : bool
82  {
83  return $this->original->isNotable();
84  }

Field Documentation

◆ $original

Setup Objective ILIAS\Setup\Objective\ObjectiveWithPreconditions::$original
protected

◆ $preconditions

array ILIAS\Setup\Objective\ObjectiveWithPreconditions::$preconditions
protected

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