ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\Setup\CallableObjective Class Reference

A callable objective wraps a callable into an objective. More...

+ Inheritance diagram for ILIAS\Setup\CallableObjective:
+ Collaboration diagram for ILIAS\Setup\CallableObjective:

Public Member Functions

 __construct (callable $callable, string $label, bool $is_notable, Objective ... $preconditions)
 
 getHash ()
 @inheritdocs More...
 
 getLabel ()
 @inheritdocs More...
 
 isNotable ()
 @inheritdocs More...
 
 getPreconditions (Environment $environment)
 @inheritdocs More...
 
 achieve (Environment $environment)
 @inheritdocs More...
 
 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...
 

Protected Attributes

 $callable
 
 $label
 
 $is_notable
 
 $preconditions
 

Detailed Description

A callable objective wraps a callable into an objective.

The callable receives the environment as parameter. It may return an updated version of the environment, other results will be discarded.

Definition at line 15 of file CallableObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Setup\CallableObjective::__construct ( callable  $callable,
string  $label,
bool  $is_notable,
Objective ...  $preconditions 
)

Member Function Documentation

◆ achieve()

ILIAS\Setup\CallableObjective::achieve ( Environment  $environment)

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 83 of file CallableObjective.php.

84 {
85 $res = call_user_func($this->callable, $environment);
86 if ($res instanceof Environment) {
87 return $res;
88 }
89 return $environment;
90 }
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
foreach($_POST as $key=> $value) $res

References $res.

◆ getHash()

ILIAS\Setup\CallableObjective::getHash ( )

@inheritdocs

Implements ILIAS\Setup\Objective.

Reimplemented in ilDatabaseUpdateStep.

Definition at line 48 of file CallableObjective.php.

48 : string
49 {
50 return hash(
51 "sha256",
52 spl_object_hash($this)
53 );
54 }

◆ getLabel()

ILIAS\Setup\CallableObjective::getLabel ( )

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 59 of file CallableObjective.php.

59 : string
60 {
61 return $this->label;
62 }

References ILIAS\Setup\CallableObjective\$label.

◆ getPreconditions()

ILIAS\Setup\CallableObjective::getPreconditions ( Environment  $environment)

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 75 of file CallableObjective.php.

75 : array
76 {
78 }

References ILIAS\Setup\CallableObjective\$preconditions.

◆ isNotable()

ILIAS\Setup\CallableObjective::isNotable ( )

@inheritdocs

Implements ILIAS\Setup\Objective.

Definition at line 67 of file CallableObjective.php.

67 : bool
68 {
69 return $this->is_notable;
70 }

References ILIAS\Setup\CallableObjective\$is_notable.

Field Documentation

◆ $callable

ILIAS\Setup\CallableObjective::$callable
protected

Definition at line 20 of file CallableObjective.php.

Referenced by ILIAS\Setup\CallableObjective\__construct().

◆ $is_notable

ILIAS\Setup\CallableObjective::$is_notable
protected

◆ $label

ILIAS\Setup\CallableObjective::$label
protected

◆ $preconditions

ILIAS\Setup\CallableObjective::$preconditions
protected

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