ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAssQuestionSkillAssignmentRegistry Class Reference

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

+ Collaboration diagram for ilAssQuestionSkillAssignmentRegistry:

Public Member Functions

 __construct (\ilSetting $setting)
 ilAssQuestionSkillAssignmentRegistry constructor. More...
 
 getChunkSize ()
 
 setChunkSize ($chunkSize)
 
 getStringifiedImports ($key, $default=null)
 
 setStringifiedImports ($key, $value)
 
 deleteStringifiedImports ($key)
 

Data Fields

const DEFAULT_CHUNK_SIZE = 1000
 

Protected Member Functions

 getNumberOfChunksByKey ($key)
 

Protected Attributes

 $settings
 
 $chunkSize = self::DEFAULT_CHUNK_SIZE
 

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 Class ilAssQuestionSkillAssignmentRegistry

Definition at line 22 of file class.ilAssQuestionSkillAssignmentRegistry.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignmentRegistry::__construct ( \ilSetting  $setting)

ilAssQuestionSkillAssignmentRegistry constructor.

Parameters
\ilSetting$setting

Definition at line 40 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References ILIAS\Repository\settings().

41  {
42  $this->settings = $setting;
43  }
+ Here is the call graph for this function:

Member Function Documentation

◆ deleteStringifiedImports()

ilAssQuestionSkillAssignmentRegistry::deleteStringifiedImports (   $key)
Parameters
string$key

Definition at line 118 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References getNumberOfChunksByKey(), and ILIAS\Repository\settings().

118  : void
119  {
120  for ($i = 1, $numberOfChunks = $this->getNumberOfChunksByKey($key); $i <= $numberOfChunks; $i++) {
121  $this->settings->delete($key . '_' . $i);
122  }
123 
124  $this->settings->delete($key . '_num');
125  }
+ Here is the call graph for this function:

◆ getChunkSize()

ilAssQuestionSkillAssignmentRegistry::getChunkSize ( )
Returns
int

Definition at line 48 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References $chunkSize.

Referenced by setStringifiedImports().

+ Here is the caller graph for this function:

◆ getNumberOfChunksByKey()

ilAssQuestionSkillAssignmentRegistry::getNumberOfChunksByKey (   $key)
protected
Parameters
string$key
Returns
int

Definition at line 70 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References ILIAS\Repository\settings().

Referenced by deleteStringifiedImports(), and getStringifiedImports().

70  : int
71  {
72  return (int) $this->settings->get($key . '_num', '0');
73  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStringifiedImports()

ilAssQuestionSkillAssignmentRegistry::getStringifiedImports (   $key,
  $default = null 
)
Parameters
string$key
null$default
Returns
mixed

Definition at line 80 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References getNumberOfChunksByKey(), and ILIAS\Repository\settings().

81  {
82  $value = '';
83 
84  for ($i = 1, $numberOfChunks = $this->getNumberOfChunksByKey($key); $i <= $numberOfChunks; $i++) {
85  $value .= $this->settings->get($key . '_' . $i);
86  }
87 
88  return \ilStr::strLen($value) > 0 ? $value : $default;
89  }
+ Here is the call graph for this function:

◆ setChunkSize()

ilAssQuestionSkillAssignmentRegistry::setChunkSize (   $chunkSize)
Parameters
int$chunkSize
Exceptions

Definition at line 57 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References $chunkSize.

57  : void
58  {
59  if (!is_numeric($chunkSize) || $chunkSize <= 0) {
60  throw new \InvalidArgumentException(sprintf("The passed chunk size is not a valid/supported integer: %s", var_export($chunkSize, true)));
61  }
62 
63  $this->chunkSize = $chunkSize;
64  }

◆ setStringifiedImports()

ilAssQuestionSkillAssignmentRegistry::setStringifiedImports (   $key,
  $value 
)
Parameters
string$key
string$valueA serialized value

Definition at line 95 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References getChunkSize(), ILIAS\Repository\settings(), ilStr\strLen(), and ilStr\subStr().

95  : void
96  {
97  $i = 0;
98 
99  while (\ilStr::strLen($value) > 0) {
100  ++$i;
101 
102  $valueToStore = \ilStr::subStr($value, 0, $this->getChunkSize());
103  $this->settings->set($key . '_' . $i, $valueToStore);
104 
105  $truncatedValue = \ilStr::subStr($value, $this->getChunkSize(), \ilStr::strLen($value) - $this->getChunkSize());
106 
107  $value = $truncatedValue;
108  }
109 
110  if ($i > 0) {
111  $this->settings->set($key . '_num', $i);
112  }
113  }
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Definition: class.ilStr.php:24
static strLen(string $a_string)
Definition: class.ilStr.php:63
+ Here is the call graph for this function:

Field Documentation

◆ $chunkSize

ilAssQuestionSkillAssignmentRegistry::$chunkSize = self::DEFAULT_CHUNK_SIZE
protected

Definition at line 34 of file class.ilAssQuestionSkillAssignmentRegistry.php.

Referenced by getChunkSize(), and setChunkSize().

◆ $settings

ilAssQuestionSkillAssignmentRegistry::$settings
protected

◆ DEFAULT_CHUNK_SIZE

const ilAssQuestionSkillAssignmentRegistry::DEFAULT_CHUNK_SIZE = 1000

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