ILIAS  release_7 Revision v7.30-3-g800a261c036
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

 $original
 
 $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 15 of file ObjectiveWithPreconditions.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 27 of file ObjectiveWithPreconditions.php.

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

28  {
29  if (count($preconditions) === 0) {
30  throw new \InvalidArgumentException(
31  "Expected at least one precondition."
32  );
33  }
34  $this->original = $original;
35  $this->preconditions = $preconditions;
36  }

Member Function Documentation

◆ achieve()

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

Definition at line 84 of file ObjectiveWithPreconditions.php.

84  : Setup\Environment
85  {
86  return $this->original->achieve($environment);
87  }

◆ getHash()

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

Implements ILIAS\Setup\Objective.

Definition at line 41 of file ObjectiveWithPreconditions.php.

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

41  : string
42  {
43  return hash(
44  "sha256",
45  self::class
46  . $this->original->getHash()
47  . implode(
48  "",
49  array_map(
50  function ($o) { return $o->getHash(); },
52  )
53  )
54  );
55  }

◆ getLabel()

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

Implements ILIAS\Setup\Objective.

Definition at line 60 of file ObjectiveWithPreconditions.php.

60  : string
61  {
62  return $this->original->getLabel();
63  }

◆ getPreconditions()

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

Definition at line 76 of file ObjectiveWithPreconditions.php.

76  : array
77  {
78  return array_merge($this->preconditions, $this->original->getPreconditions($environment));
79  }

◆ isApplicable()

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

Definition at line 92 of file ObjectiveWithPreconditions.php.

92  : bool
93  {
94  return $this->original->isApplicable($environment);
95  }

◆ isNotable()

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

Implements ILIAS\Setup\Objective.

Definition at line 68 of file ObjectiveWithPreconditions.php.

68  : bool
69  {
70  return $this->original->isNotable();
71  }

Field Documentation

◆ $original

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

◆ $preconditions

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

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