1 | <?php namespace Arcanedev\GeoLocation\Entities\Measures; |
||
14 | abstract class AbstractMeasure implements Arrayable, Jsonable, JsonSerializable |
||
15 | { |
||
16 | /* ----------------------------------------------------------------- |
||
17 | | Traits |
||
18 | | ----------------------------------------------------------------- |
||
19 | */ |
||
20 | |||
21 | use CanBeJsonable; |
||
22 | |||
23 | /* ----------------------------------------------------------------- |
||
24 | | Properties |
||
25 | | ----------------------------------------------------------------- |
||
26 | */ |
||
27 | |||
28 | /** |
||
29 | * The text value. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $text; |
||
34 | |||
35 | /** |
||
36 | * The numeric value. |
||
37 | * |
||
38 | * @var int |
||
39 | */ |
||
40 | protected $value; |
||
41 | |||
42 | /* ----------------------------------------------------------------- |
||
43 | | Main Methods |
||
44 | | ----------------------------------------------------------------- |
||
45 | */ |
||
46 | |||
47 | /** |
||
48 | * AbstractMeasure constructor. |
||
49 | * |
||
50 | * @param string $text |
||
51 | * @param int $value |
||
52 | */ |
||
53 | 81 | public function __construct($text, $value) |
|
58 | |||
59 | /* ----------------------------------------------------------------- |
||
60 | | Getters & Setters |
||
61 | | ----------------------------------------------------------------- |
||
62 | */ |
||
63 | |||
64 | /** |
||
65 | * Get the text (alias). |
||
66 | * |
||
67 | * @see getText |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | 45 | public function text() |
|
75 | |||
76 | /** |
||
77 | * Get the text. |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | 45 | public function getText() |
|
85 | |||
86 | /** |
||
87 | * Get the value (alias). |
||
88 | * |
||
89 | * @see getValue |
||
90 | * |
||
91 | * @return int |
||
92 | */ |
||
93 | 42 | public function value() |
|
97 | |||
98 | /** |
||
99 | * Get the value. |
||
100 | * |
||
101 | * @return int |
||
102 | */ |
||
103 | 42 | public function getValue() |
|
107 | |||
108 | /* ----------------------------------------------------------------- |
||
109 | | Main Methods |
||
110 | | ----------------------------------------------------------------- |
||
111 | */ |
||
112 | |||
113 | /** |
||
114 | * Make a distance instance. |
||
115 | * |
||
116 | * @param string $text |
||
117 | * @param int $value |
||
118 | * |
||
119 | * @return static |
||
120 | */ |
||
121 | 75 | public static function make($text, $value) |
|
125 | |||
126 | /** |
||
127 | * Make a distance instance from array. |
||
128 | * |
||
129 | * @param array $data |
||
130 | * |
||
131 | * @return static |
||
132 | */ |
||
133 | 57 | public static function makeFromArray(array $data) |
|
137 | |||
138 | /** |
||
139 | * Get the instance as an array. |
||
140 | * |
||
141 | * @return array |
||
142 | */ |
||
143 | 24 | public function toArray() |
|
150 | } |
||
151 |