ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ()
 @inheritdocs More...
 
 getLabel ()
 @inheritdocs More...
 
 isNotable ()
 @inheritdocs More...
 
 getPreconditions (Setup\Environment $environment)
 @inheritdocs More...
 
 achieve (Setup\Environment $environment)
 @inheritdocs More...
 
 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

 $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.

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 }

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

Member Function Documentation

◆ achieve()

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

@inheritdocs

Definition at line 84 of file ObjectiveWithPreconditions.php.

85 {
86 return $this->original->achieve($environment);
87 }
An environment holds resources to be used in the setup process.
Definition: Environment.php:12

◆ getHash()

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

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 41 of file ObjectiveWithPreconditions.php.

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 }

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

◆ getLabel()

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

@inheritdocs

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)

@inheritdocs

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)

@inheritDoc

Definition at line 92 of file ObjectiveWithPreconditions.php.

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

◆ isNotable()

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

@inheritdocs

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: