ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
Auth_Yadis_SessionLoader Class Reference
+ Inheritance diagram for Auth_Yadis_SessionLoader:
+ Collaboration diagram for Auth_Yadis_SessionLoader:

Public Member Functions

 check ($data)
 Override this. More...
 
 fromSession ($data)
 Given a session data value (an array), this creates an object (returned by $this->newObject()) whose attributes and values are those in $data. More...
 
 prepareForLoad ($data)
 Prepares the data array by making any necessary changes. More...
 
 newObject ($data)
 Returns a new instance of this loader's class, using the session data to construct it if necessary. More...
 
 toSession ($obj)
 Returns an array of keys and values built from the attributes of $obj. More...
 
 prepareForSave ($obj)
 Override this. More...
 

Detailed Description

Definition at line 76 of file Manager.php.

Member Function Documentation

◆ check()

Auth_Yadis_SessionLoader::check (   $data)

Override this.

private

Definition at line 82 of file Manager.php.

83  {
84  return true;
85  }

◆ fromSession()

Auth_Yadis_SessionLoader::fromSession (   $data)

Given a session data value (an array), this creates an object (returned by $this->newObject()) whose attributes and values are those in $data.

Returns null if $data lacks keys found in $this->requiredKeys(). Returns null if $this->check($data) evaluates to false. Returns null if $this->newObject() evaluates to false.

private

Definition at line 97 of file Manager.php.

References $data.

98  {
99  if (!$data) {
100  return null;
101  }
102 
103  $required = $this->requiredKeys();
104 
105  foreach ($required as $k) {
106  if (!array_key_exists($k, $data)) {
107  return null;
108  }
109  }
110 
111  if (!$this->check($data)) {
112  return null;
113  }
114 
115  $data = array_merge($data, $this->prepareForLoad($data));
116  $obj = $this->newObject($data);
117 
118  if (!$obj) {
119  return null;
120  }
121 
122  foreach ($required as $k) {
123  $obj->$k = $data[$k];
124  }
125 
126  return $obj;
127  }
newObject($data)
Returns a new instance of this loader's class, using the session data to construct it if necessary...
Definition: Manager.php:149
check($data)
Override this.
Definition: Manager.php:82
prepareForLoad($data)
Prepares the data array by making any necessary changes.
Definition: Manager.php:136

◆ newObject()

Auth_Yadis_SessionLoader::newObject (   $data)

Returns a new instance of this loader's class, using the session data to construct it if necessary.

The object need only be created; $this->fromSession() will take care of setting the object's attributes.

private

Definition at line 149 of file Manager.php.

150  {
151  return null;
152  }

◆ prepareForLoad()

Auth_Yadis_SessionLoader::prepareForLoad (   $data)

Prepares the data array by making any necessary changes.

Returns an array whose keys and values will be used to update the original data array before calling $this->newObject($data).

private

Definition at line 136 of file Manager.php.

137  {
138  return array();
139  }

◆ prepareForSave()

Auth_Yadis_SessionLoader::prepareForSave (   $obj)

Override this.

private

Definition at line 185 of file Manager.php.

186  {
187  return array();
188  }

◆ toSession()

Auth_Yadis_SessionLoader::toSession (   $obj)

Returns an array of keys and values built from the attributes of $obj.

If $this->prepareForSave($obj) returns an array, its keys and values are used to update the $data array of attributes from $obj.

private

Definition at line 162 of file Manager.php.

References $data.

163  {
164  $data = array();
165  foreach ($obj as $k => $v) {
166  $data[$k] = $v;
167  }
168 
169  $extra = $this->prepareForSave($obj);
170 
171  if ($extra && is_array($extra)) {
172  foreach ($extra as $k => $v) {
173  $data[$k] = $v;
174  }
175  }
176 
177  return $data;
178  }
prepareForSave($obj)
Override this.
Definition: Manager.php:185

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