ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Setup\Objective\CallableObjective Class Reference

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

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

Public Member Functions

 __construct (callable $callable, string $label, bool $is_notable, Setup\Objective ... $preconditions)
 
 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 (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

 $callable
 
string $label
 
bool $is_notable
 
array $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 31 of file CallableObjective.php.

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ achieve()

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

Definition at line 78 of file CallableObjective.php.

References $res.

78  : Setup\Environment
79  {
80  $res = call_user_func($this->callable, $environment);
81  if ($res instanceof Setup\Environment) {
82  return $res;
83  }
84  return $environment;
85  }
$res
Definition: ltiservices.php:66

◆ getHash()

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

Get a hash for this objective.

The hash of two objectives must be the same, if they are the same objective, with the same config on the same environment, i.e. if the one is achieved the other is achieved as well because they are the same.

Implements ILIAS\Setup\Objective.

Definition at line 55 of file CallableObjective.php.

55  : string
56  {
57  return hash(
58  "sha256",
59  spl_object_hash($this)
60  );
61  }

◆ getLabel()

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

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 63 of file CallableObjective.php.

References ILIAS\Setup\Objective\CallableObjective\$label.

63  : string
64  {
65  return $this->label;
66  }

◆ getPreconditions()

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

Definition at line 73 of file CallableObjective.php.

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

73  : array
74  {
75  return $this->preconditions;
76  }

◆ isApplicable()

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

Definition at line 87 of file CallableObjective.php.

87  : bool
88  {
89  return true;
90  }

◆ isNotable()

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

Get to know if this is an interesting objective for a human.

Implements ILIAS\Setup\Objective.

Definition at line 68 of file CallableObjective.php.

References ILIAS\Setup\Objective\CallableObjective\$is_notable.

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

Field Documentation

◆ $callable

ILIAS\Setup\Objective\CallableObjective::$callable
protected

◆ $is_notable

bool ILIAS\Setup\Objective\CallableObjective::$is_notable
protected

◆ $label

string ILIAS\Setup\Objective\CallableObjective::$label
protected

◆ $preconditions

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

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