1 | <?php namespace Arcanedev\GeoLocation\Entities; |
||
15 | class Duration implements Arrayable, Jsonable, JsonSerializable |
||
16 | { |
||
17 | /* ----------------------------------------------------------------- |
||
18 | | Properties |
||
19 | | ----------------------------------------------------------------- |
||
20 | */ |
||
21 | |||
22 | /** |
||
23 | * The text value. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $text; |
||
28 | |||
29 | /** |
||
30 | * The numeric value. |
||
31 | * |
||
32 | * @var int |
||
33 | */ |
||
34 | protected $value; |
||
35 | |||
36 | /* ----------------------------------------------------------------- |
||
37 | | Main Methods |
||
38 | | ----------------------------------------------------------------- |
||
39 | */ |
||
40 | |||
41 | /** |
||
42 | * Distance constructor. |
||
43 | * |
||
44 | * @param string $text |
||
45 | * @param int $value |
||
46 | */ |
||
47 | public function __construct($text, $value) |
||
52 | |||
53 | /* ----------------------------------------------------------------- |
||
54 | | Getters & Setters |
||
55 | | ----------------------------------------------------------------- |
||
56 | */ |
||
57 | |||
58 | /** |
||
59 | * Get the text (alias). |
||
60 | * |
||
61 | * @see getText |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | public function text() |
||
69 | |||
70 | /** |
||
71 | * Get the text. |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getText() |
||
79 | |||
80 | /** |
||
81 | * Get the value (alias). |
||
82 | * |
||
83 | * @see getValue |
||
84 | * |
||
85 | * @return int |
||
86 | */ |
||
87 | public function value() |
||
91 | |||
92 | /** |
||
93 | * Get the value. |
||
94 | * |
||
95 | * @return int |
||
96 | */ |
||
97 | public function getValue() |
||
101 | |||
102 | /* ----------------------------------------------------------------- |
||
103 | | Main Methods |
||
104 | | ----------------------------------------------------------------- |
||
105 | */ |
||
106 | |||
107 | /** |
||
108 | * Make a distance instance. |
||
109 | * |
||
110 | * @param string $text |
||
111 | * @param int $value |
||
112 | * |
||
113 | * @return self |
||
114 | */ |
||
115 | public static function make($text, $value) |
||
119 | |||
120 | /** |
||
121 | * Make a distance instance from array. |
||
122 | * |
||
123 | * @param array $data |
||
124 | * |
||
125 | * @return self |
||
126 | */ |
||
127 | public static function makeFromArray(array $data) |
||
131 | |||
132 | /** |
||
133 | * Get the instance as an array. |
||
134 | * |
||
135 | * @return array |
||
136 | */ |
||
137 | public function toArray() |
||
141 | |||
142 | /** |
||
143 | * Convert the object to its JSON representation. |
||
144 | * |
||
145 | * @param int $options |
||
146 | * @return string |
||
147 | */ |
||
148 | public function toJson($options = 0) |
||
152 | |||
153 | /** |
||
154 | * Specify data which should be serialized to JSON |
||
155 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
156 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
157 | * which is a value of any type other than a resource. |
||
158 | * @since 5.4.0 |
||
159 | */ |
||
160 | function jsonSerialize() |
||
164 | } |
||
165 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.