ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 109 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References getNumberOfChunksByKey(), and settings().

110  {
111  for($i = 1, $numberOfChunks = $this->getNumberOfChunksByKey($key); $i <= $numberOfChunks; $i++)
112  {
113  $this->settings->delete($key . '_' . $i);
114  }
115 
116  $this->settings->delete($key . '_num');
117  }
settings()
Definition: settings.php:2
+ 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 58 of file class.ilAssQuestionSkillAssignmentRegistry.php.

References settings().

Referenced by deleteStringifiedImports(), and getStringifiedImports().

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

References getNumberOfChunksByKey(), and settings().

69  {
70  $value = '';
71 
72  for($i = 1, $numberOfChunks = $this->getNumberOfChunksByKey($key); $i <= $numberOfChunks; $i++)
73  {
74  $value .= $this->settings->get($key . '_' . $i);
75  }
76 
77  return \ilStr::strLen($value) > 0 ? $value : $default;
78  }
settings()
Definition: settings.php:2
+ 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  {
48  throw new \InvalidArgumentException(sprintf("The passed chunk size is not a valid/supported integer: %s", var_export($chunkSize, true)));
49  }
50 
51  $this->chunkSize = $chunkSize;
52  }

◆ setStringifiedImports()

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

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

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

85  {
86  $i = 0;
87 
88  while(\ilStr::strLen($value) > 0)
89  {
90  ++$i;
91 
92  $valueToStore = \ilStr::subStr($value, 0, $this->getChunkSize());
93  $this->settings->set($key . '_' . $i, $valueToStore);
94 
95  $truncatedValue = \ilStr::subStr($value, $this->getChunkSize(), \ilStr::strLen($value) - $this->getChunkSize());
96 
97  $value = $truncatedValue;
98  }
99 
100  if($i > 0)
101  {
102  $this->settings->set($key . '_num', $i);
103  }
104  }
static strLen($a_string)
Definition: class.ilStr.php:91
settings()
Definition: settings.php:2
static subStr($a_str, $a_start, $a_length=NULL)
Definition: class.ilStr.php:15
+ 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: