ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAssQuestionSkillAssignmentRegistry Class Reference

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignmentRegistry::__construct ( \ilSetting  $setting)

ilAssQuestionSkillAssignmentRegistry constructor.

Parameters
\ilSetting$setting

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

References settings().

28  {
29  $this->settings = $setting;
30  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ deleteStringifiedImports()

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

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

References $i, $key, getNumberOfChunksByKey(), and settings().

106  {
107  for ($i = 1, $numberOfChunks = $this->getNumberOfChunksByKey($key); $i <= $numberOfChunks; $i++) {
108  $this->settings->delete($key . '_' . $i);
109  }
110 
111  $this->settings->delete($key . '_num');
112  }
settings()
Definition: settings.php:2
$i
Definition: disco.tpl.php:19
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ getChunkSize()

ilAssQuestionSkillAssignmentRegistry::getChunkSize ( )
Returns
int

Definition at line 35 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 57 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References $key, and settings().

Referenced by deleteStringifiedImports(), and getStringifiedImports().

58  {
59  return (int) $this->settings->get($key . '_num', 0);
60  }
settings()
Definition: settings.php:2
$key
Definition: croninfo.php:18
+ 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 67 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References $i, $key, getNumberOfChunksByKey(), and settings().

68  {
69  $value = '';
70 
71  for ($i = 1, $numberOfChunks = $this->getNumberOfChunksByKey($key); $i <= $numberOfChunks; $i++) {
72  $value .= $this->settings->get($key . '_' . $i);
73  }
74 
75  return \ilStr::strLen($value) > 0 ? $value : $default;
76  }
settings()
Definition: settings.php:2
$i
Definition: disco.tpl.php:19
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ setChunkSize()

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

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

References $chunkSize.

45  {
46  if (!is_numeric($chunkSize) || $chunkSize <= 0) {
47  throw new \InvalidArgumentException(sprintf("The passed chunk size is not a valid/supported integer: %s", var_export($chunkSize, true)));
48  }
49 
50  $this->chunkSize = $chunkSize;
51  }

◆ setStringifiedImports()

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

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

References $i, $key, getChunkSize(), settings(), ilStr\strLen(), and ilStr\subStr().

83  {
84  $i = 0;
85 
86  while (\ilStr::strLen($value) > 0) {
87  ++$i;
88 
89  $valueToStore = \ilStr::subStr($value, 0, $this->getChunkSize());
90  $this->settings->set($key . '_' . $i, $valueToStore);
91 
92  $truncatedValue = \ilStr::subStr($value, $this->getChunkSize(), \ilStr::strLen($value) - $this->getChunkSize());
93 
94  $value = $truncatedValue;
95  }
96 
97  if ($i > 0) {
98  $this->settings->set($key . '_num', $i);
99  }
100  }
static strLen($a_string)
Definition: class.ilStr.php:78
static subStr($a_str, $a_start, $a_length=null)
Definition: class.ilStr.php:15
settings()
Definition: settings.php:2
$i
Definition: disco.tpl.php:19
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

Field Documentation

◆ $chunkSize

ilAssQuestionSkillAssignmentRegistry::$chunkSize = self::DEFAULT_CHUNK_SIZE
protected

Definition at line 21 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: