ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDBStepReader Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilDBStepReader:
+ Collaboration diagram for ilDBStepReader:

Public Member Functions

 getLatestStepNumber (string $step_class_name, string $step_prefix)
 Get the number of the latest database step in this class. More...
 
 readStepNumbers (string $step_class_name, string $step_prefix)
 Get a list of all steps in this class. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 21 of file class.ilDBStepReader.php.

Member Function Documentation

◆ getLatestStepNumber()

ilDBStepReader::getLatestStepNumber ( string  $step_class_name,
string  $step_prefix 
)

Get the number of the latest database step in this class.

Definition at line 26 of file class.ilDBStepReader.php.

References $steps, and readStepNumbers().

26  : int
27  {
28  $steps = $this->readStepNumbers($step_class_name, $step_prefix);
29  return $steps[count($steps) - 1];
30  }
$steps
Definition: latex.php:3
readStepNumbers(string $step_class_name, string $step_prefix)
Get a list of all steps in this class.
+ Here is the call graph for this function:

◆ readStepNumbers()

ilDBStepReader::readStepNumbers ( string  $step_class_name,
string  $step_prefix 
)

Get a list of all steps in this class.

Definition at line 35 of file class.ilDBStepReader.php.

References ILIAS\Repository\int().

Referenced by getLatestStepNumber().

35  : array
36  {
37  $step_numbers = [];
38  foreach (get_class_methods($step_class_name) as $method) {
39  if (stripos($method, $step_prefix) !== 0) {
40  continue;
41  }
42 
43  $number = substr($method, strlen($step_prefix));
44 
45  if (!preg_match("/^[1-9]\d*$/", $number)) {
46  throw new LogicException("Method $method seems to be a step but has an odd looking number");
47  }
48 
49  $step_numbers[] = (int) $number;
50  }
51 
52  sort($step_numbers);
53  return $step_numbers;
54  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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