ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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

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.

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 }

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 97 of file ObjectiveWithPreconditions.php.

98 {
99 return $this->original->achieve($environment);
100 }
An environment holds resources to be used in the setup process.
Definition: Environment.php:28

◆ getHash()

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

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 54 of file ObjectiveWithPreconditions.php.

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(),
64 $this->preconditions
65 )
66 )
67 );
68 }

◆ getLabel()

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

@inheritdocs

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)

@inheritdocs

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)

@inheritDoc

Definition at line 105 of file ObjectiveWithPreconditions.php.

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

◆ isNotable()

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

@inheritdocs

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: