ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables 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 ()
 
 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

 $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\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 83 of file CallableObjective.php.

References $res.

83  : Setup\Environment
84  {
85  $res = call_user_func($this->callable, $environment);
86  if ($res instanceof Setup\Environment) {
87  return $res;
88  }
89  return $environment;
90  }
foreach($_POST as $key=> $value) $res

◆ getHash()

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

Implements ILIAS\Setup\Objective.

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\Objective\CallableObjective::getLabel ( )

Implements ILIAS\Setup\Objective.

Definition at line 59 of file CallableObjective.php.

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

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

◆ getPreconditions()

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

◆ isApplicable()

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

Definition at line 95 of file CallableObjective.php.

95  : bool
96  {
97  return true;
98  }

◆ isNotable()

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

Field Documentation

◆ $callable

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

◆ $is_notable

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

◆ $label

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

◆ $preconditions

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

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