2016-02-03 21:36:45 +01:00
|
|
|
<?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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-06 17:01:16 +01:00
|
|
|
/**
|
2016-05-14 13:40:37 +02:00
|
|
|
* Return an array representation of the model properties
|
|
|
|
* @return array
|
2016-02-06 17:01:16 +01:00
|
|
|
*/
|
|
|
|
public function toArray(){
|
2016-05-14 13:40:37 +02:00
|
|
|
return get_object_vars( $this);
|
2016-02-06 17:01:16 +01:00
|
|
|
}
|
|
|
|
|
2016-02-03 21:36:45 +01:00
|
|
|
}
|