2017-03-22 18:31:53 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: Lukas
|
|
|
|
* Date: 22. Mär. 2017
|
|
|
|
* Time: 18:26
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace ManiaControl\Callbacks\Structures;
|
|
|
|
|
|
|
|
|
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
|
|
|
|
abstract class BaseStructure {
|
|
|
|
/** @var ManiaControl $maniaControl */
|
|
|
|
protected $maniaControl;
|
2017-03-23 20:39:32 +01:00
|
|
|
private $plainJson;
|
2017-03-22 18:31:53 +01:00
|
|
|
|
2017-03-23 21:01:44 +01:00
|
|
|
protected function __construct(ManiaControl $maniaControl, $data) {
|
2017-03-23 20:39:32 +01:00
|
|
|
$this->maniaControl = $maniaControl;
|
2017-03-23 21:01:44 +01:00
|
|
|
$this->setJson($data);
|
2017-03-23 20:39:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decodes the Data and Sets the Json
|
|
|
|
*
|
|
|
|
* @param array $data
|
|
|
|
*/
|
|
|
|
protected function setJson($data) {
|
|
|
|
$this->plainJson = json_decode($data[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the Plain Json
|
|
|
|
*/
|
|
|
|
public function getJson() {
|
|
|
|
return $this->plainJson;
|
|
|
|
}
|
2017-03-23 20:43:23 +01:00
|
|
|
|
2017-03-22 18:31:53 +01:00
|
|
|
/**
|
|
|
|
* Var_Dump the Structure
|
|
|
|
*/
|
|
|
|
public function dump() {
|
|
|
|
var_dump(json_decode(json_encode($this)));
|
2017-03-23 21:01:44 +01:00
|
|
|
var_dump("Class Name including Namespace: " . get_class($this));
|
2017-03-22 18:31:53 +01:00
|
|
|
}
|
|
|
|
}
|