1: <?php
2:
3: namespace Charcoal\Config;
4:
5: use ArrayAccess;
6: use JsonSerializable;
7: use Serializable;
8:
9: /**
10: * Describes a conceptual data model.
11: */
12: interface EntityInterface extends
13: ArrayAccess,
14: JsonSerializable,
15: Serializable
16: {
17: /**
18: * Gets the data keys on this entity.
19: *
20: * @return array
21: */
22: public function keys();
23:
24: /**
25: * Gets all data, or a subset, from this entity.
26: *
27: * @param string[] $keys Optional. Extracts only the requested data.
28: * @return array An associative array.
29: */
30: public function data(array $keys = null);
31:
32: /**
33: * Sets data on this entity.
34: *
35: * @param array $data An associative array.
36: * @return EntityInterface Chainable
37: */
38: public function setData(array $data);
39:
40: /**
41: * Determines if this entity contains the specified key and if its value is not NULL.
42: *
43: * @param string $key The data key to check.
44: * @return boolean TRUE if $key exists and has a value other than NULL, FALSE otherwise.
45: */
46: public function has($key);
47:
48: /**
49: * Find an entry of the configuration by its key and retrieve it.
50: *
51: * @param string $key The data key to retrieve.
52: * @return mixed Value of the requested $key on success, NULL if the $key is not set.
53: */
54: public function get($key);
55:
56: /**
57: * Assign a value to the specified key on this entity.
58: *
59: * @param string $key The data key to assign $value to.
60: * @param mixed $value The data value to assign to $key.
61: * @return EntityInterface Chainable
62: */
63: public function set($key, $value);
64: }
65: