TrackManiaControl/core/Callbacks/Structures/Common/BaseStructure.php

46 lines
1.1 KiB
PHP
Raw Permalink Normal View History

<?php
namespace ManiaControl\Callbacks\Structures\Common;
use ManiaControl\General\JsonSerializable;
use ManiaControl\General\JsonSerializeTrait;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl;
2017-03-24 16:49:54 +01:00
/**
* Base Structure of all Callback Structures
*
2017-04-07 23:26:35 +02:00
* @api
2017-03-24 16:49:54 +01:00
* @author ManiaControl Team <mail@maniacontrol.com>
2020-01-22 10:39:35 +01:00
* @copyright 2014-2020 ManiaControl Team
2017-03-24 16:49:54 +01:00
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
abstract class BaseStructure implements UsageInformationAble, JsonSerializable {
use UsageInformationTrait, JsonSerializeTrait;
/** @var ManiaControl $maniaControl */
protected $maniaControl;
2017-03-23 21:04:05 +01:00
private $plainJsonObject;
2017-04-07 23:26:35 +02:00
/**
* BaseStructure constructor.
*
* @param \ManiaControl\ManiaControl $maniaControl
* @param $data
*/
2017-03-23 21:01:44 +01:00
protected function __construct(ManiaControl $maniaControl, $data) {
2017-03-23 21:04:05 +01:00
$this->maniaControl = $maniaControl;
$this->plainJsonObject = json_decode($data[0]);
2017-03-23 20:39:32 +01:00
}
2017-03-23 21:19:03 +01:00
2017-03-23 20:39:32 +01:00
/**
* Gets the Plain Json
2017-04-07 23:26:35 +02:00
*
* @api
2017-03-23 20:39:32 +01:00
*/
2017-03-23 21:04:05 +01:00
public function getPlainJsonObject() {
return $this->plainJsonObject;
2017-03-23 20:39:32 +01:00
}
}