/** * Add a service to the Service list indexed by priority. Assumes * a missing or invalid priority should be shuffled to the bottom * of the priority order. * * @param Services_Yadis_Service $service */ protected function _addService(Services_Yadis_Service $service) { $servicePriority = $service->getPriority(); if (is_null($servicePriority) || !is_numeric($servicePriority)) { $servicePriority = self::SERVICE_LOWEST_PRIORITY; } if (!array_key_exists($servicePriority, $this->_services)) { $this->_services[$servicePriority] = array(); } $this->_services[$servicePriority][] = $service; }
/** * Creates the service list using nodes from the XRDS XML * document. * * @access private */ function _parse() { $this->serviceList = array(); $services = $this->parser->evalXPath('xrd:Service', $this->xrdNode); foreach ($services as $node) { $s = new Services_Yadis_Service(); $s->element = $node; $s->parser =& $this->parser; $priority = $s->getPriority(); if ($priority === null) { $priority = SERVICES_YADIS_MAX_PRIORITY; } $this->_addService($priority, $s); } }