1 | <?php |
||
7 | trait HasAttributesTrait |
||
8 | { |
||
9 | protected $attributes = []; |
||
10 | |||
11 | /** |
||
12 | * Set a given log value. |
||
13 | * |
||
14 | * @param array|string $key |
||
15 | * @param mixed $value |
||
16 | * |
||
17 | * @return bool |
||
18 | */ |
||
19 | public function setAttribute($key, $value = null) |
||
28 | |||
29 | /** |
||
30 | * Get the specified log value. |
||
31 | * |
||
32 | * @param null|string $key |
||
33 | * @param mixed $default |
||
34 | * |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public function getAttribute($key = null, $default = null) |
||
41 | |||
42 | /** |
||
43 | * Determine if the given key exists in the attributes. |
||
44 | * |
||
45 | * @param string|int $key |
||
46 | * |
||
47 | * @return bool |
||
48 | */ |
||
49 | public function existsAttribute($key) |
||
53 | |||
54 | /** |
||
55 | * Check if an key or keys exist in the attributes using "dot" notation. |
||
56 | * |
||
57 | * @param string|array $keys |
||
58 | * |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function hasAttribute($keys) |
||
65 | |||
66 | /** |
||
67 | * Convert the Object instance to an array. |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | public function toArray() |
||
75 | |||
76 | /** |
||
77 | * Convert the object into something JSON serializable. |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | public function jsonSerialize() |
||
85 | |||
86 | /** |
||
87 | * Convert the Object instance to JSON. |
||
88 | * |
||
89 | * @param int $options |
||
90 | * @return string |
||
91 | */ |
||
92 | public function toJson($options = 0) |
||
96 | } |
||
97 |