/** * Init device by discovery response * * @access public * * @param \stdClass $response Discovery response */ public function initByDiscoveryReponse(\stdClass $response) { $this->date = $response->DATE; $this->location = $response->LOCATION; $this->server = $response->SERVER; $this->st = $response->ST; $this->usn = $response->USN; $this->root = new RootXMLParser($this->location); $services = $this->root->getServices(); foreach ($services as $data) { $service = new ServiceXMLParser($data); $type = $service->getType(); if (isset($this->typeMapping[$service->getType()])) { $type = $this->typeMapping[$service->getType()]; } $this->services[$type] = $service; } $this->id = $this->root->getId(); $this->name = $this->root->getName(); return true; }