forked from quaderno/quaderno-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquaderno_class.php
More file actions
executable file
·51 lines (44 loc) · 960 Bytes
/
Copy pathquaderno_class.php
File metadata and controls
executable file
·51 lines (44 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* Quaderno Class
*
* @package Quaderno PHP
* @author Quaderno <hello@quaderno.io>
* @copyright Copyright (c) 2017, Quaderno
* @license https://opensource.org/licenses/MIT The MIT License
*/
/* Interface that implements every single class */
abstract class QuadernoClass implements \JsonSerializable
{
protected $data = array();
public function __construct($newdata)
{
if (is_array($newdata)) $this->data = $newdata;
}
public function __set($name, $value)
{
$this->data[$name] = $value;
}
public function __get($name)
{
return array_key_exists($name, $this->data) ? $this->data[$name] : null;
}
public function __isset($name)
{
return array_key_exists($name, $this->data);
}
protected function getArray()
{
return $this->data;
}
/**
* Specify data which should be serialized to JSON.
*
* @return array
*/
public function jsonSerialize()
{
return $this->data;
}
}
?>