Add System service

This commit is contained in:
alphayax 2016-02-03 21:36:45 +01:00
parent 79d5f4c1f9
commit 52cb85786d
3 changed files with 59 additions and 1 deletions

22
freebox/api/v3/Model.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace alphayax\freebox\api\v3;
/**
* Class Model
* @package alphayax\freebox\api\v3
*/
abstract class Model {
/**
* Model constructor.
* @param array $properties_x mapping of properties
*/
public function __construct( $properties_x = []){
foreach( $properties_x as $property => $value){
if( property_exists( static::class, $property)){
$this->$property = $value;
}
}
}
}

View File

@ -1,5 +1,6 @@
<?php
namespace alphayax\freebox\api\v3\config;
use alphayax\freebox\api\v3\models\DhcpConfig;
use alphayax\freebox\api\v3\Service;
@ -19,7 +20,7 @@ class DHCP extends Service {
$rest = $this->getAuthService( self::API_DHCP_CONFIG);
$rest->GET();
return $rest->getCurlResponse();
return new DhcpConfig( $rest->getCurlResponse()['result']);
}
/**

View File

@ -0,0 +1,35 @@
<?php
namespace alphayax\freebox\api\v3\models;
use alphayax\freebox\api\v3\Model;
/**
* Class DhcpConfig
* @package alphayax\freebox\api\v3\models
*/
class DhcpConfig extends Model {
/** @var bool Enable/Disable the DHCP server */
protected $enabled;
/** @var bool Always assign the same IP to a given host */
protected $sticky_assign;
/** @var string (Read-only) Gateway IP address */
protected $gateway;
/** @var string (Read-only) Gateway subnet netmask */
protected $netmask;
/** @var string DHCP range start IP */
protected $ip_range_start;
/** @var string DHCP range end IP */
protected $ip_range_end;
/** @var bool Always broadcast DHCP responses */
protected $always_broadcast;
/** @var array of string List of dns servers to include in DHCP reply */
protected $dns = [];
}