Initial commit
This commit is contained in:
50
src/SSDP/Service.php
Normal file
50
src/SSDP/Service.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\UPnP\SSDP;
|
||||
|
||||
/*
|
||||
<serviceType>urn:schemas-upnp-org:service:Layer3Forwarding:1</serviceType>
|
||||
<serviceId>urn:upnp-org:serviceId:L3Forwarding1</serviceId>
|
||||
<SCPDURL>/L3F.xml</SCPDURL>
|
||||
<controlURL>/ctl/L3F</controlURL>
|
||||
<eventSubURL>/evt/L3F</eventSubURL>
|
||||
*/
|
||||
|
||||
use SimpleXMLElement;
|
||||
|
||||
class Service
|
||||
{
|
||||
protected $serviceType;
|
||||
|
||||
protected $serviceId;
|
||||
|
||||
protected $scpdUrl;
|
||||
|
||||
protected $controlUrl;
|
||||
|
||||
protected $eventSubUrl;
|
||||
|
||||
public function __construct(SimpleXMLElement $spec)
|
||||
{
|
||||
|
||||
$this->serviceType = (string)$spec->serviceType;
|
||||
$this->serviceId = (string)$spec->serviceId;
|
||||
$this->scpdUrl = (string)$spec->SCPDURL;
|
||||
$this->controlUrl = (string)$spec->controlURL;
|
||||
$this->eventSubUrl = (string)$spec->eventSubURL;
|
||||
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return sprintf("Service: %s [%s]\nControl URL: %s\nEventSub URL: %s\nSCPD URL: %s\n",
|
||||
$this->serviceId,
|
||||
$this->serviceType,
|
||||
$this->controlUrl,
|
||||
$this->eventSubUrl,
|
||||
$this->scpdUrl
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user