38 function get(
$name, $default=null)
103 $required = $this->requiredKeys();
105 foreach ($required as $k) {
106 if (!array_key_exists($k,
$data)) {
122 foreach ($required as $k) {
123 $obj->$k =
$data[$k];
165 foreach ($obj as $k => $v) {
171 if ($extra && is_array($extra)) {
172 foreach ($extra as $k => $v) {
206 foreach ($obj as $k => $v) {
214 return is_array(
$data[
'type_uris']);
226 return array(
'starting_url',
239 $data[
'session_key']);
244 return is_array(
$data[
'services']);
251 foreach (
$data[
'services'] as $s) {
252 $services[] =
$loader->fromSession($s);
254 return array(
'services' => $services);
261 foreach ($obj->services as $s) {
262 $services[] =
$loader->toSession($s);
264 return array(
'services' => $services);
284 $services, $session_key)
287 $this->starting_url = $starting_url;
290 $this->yadis_url = $yadis_url;
293 $this->services = $services;
295 $this->session_key = $session_key;
298 $this->_current = null;
301 $this->stale =
false;
310 return count($this->services);
322 if ($this->services) {
323 $this->_current = array_shift($this->services);
325 $this->_current = null;
328 return $this->_current;
338 return $this->_current;
346 return in_array($url, array($this->starting_url, $this->yadis_url));
355 return $this->_current !== null;
391 $session_key_suffix = null)
394 $this->session = $session;
396 if ($session_key_suffix === null) {
400 $this->session_key_suffix = $session_key_suffix;
401 $this->session_key = $this->PREFIX . $this->session_key_suffix;
411 if (!$manager || (!$manager->services)) {
414 list($yadis_url, $services) = call_user_func($discover_cb,
423 $service = $manager->nextService();
424 $this->session->set($this->session_key,
425 serialize(
$loader->toSession($manager)));
445 $service = $manager->current();
460 return $this->PREFIX . $this->session_key_suffix;
477 if ($manager_str !== null) {
479 $manager =
$loader->fromSession(unserialize($manager_str));
482 if ($manager && ($manager->forURL($this->url) || $force)) {
501 $this->session->set($this->session_key,
502 serialize(
$loader->toSession($manager)));
517 $this->session->del($key);