| 1 | <?php namespace Arcanedev\Currencies\Entities; |
||
| 11 | class Rate implements Arrayable, Jsonable |
||
| 12 | { |
||
| 13 | /* ------------------------------------------------------------------------------------------------ |
||
| 14 | | Properties |
||
| 15 | | ------------------------------------------------------------------------------------------------ |
||
| 16 | */ |
||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | public $from; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | public $to; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var double |
||
| 29 | */ |
||
| 30 | public $ratio; |
||
| 31 | |||
| 32 | /* ------------------------------------------------------------------------------------------------ |
||
| 33 | | Constructor |
||
| 34 | | ------------------------------------------------------------------------------------------------ |
||
| 35 | */ |
||
| 36 | /** |
||
| 37 | * Rate constructor. |
||
| 38 | * |
||
| 39 | * @param string $from |
||
| 40 | * @param string $to |
||
| 41 | * @param double $ratio |
||
| 42 | */ |
||
| 43 | 12 | public function __construct($from, $to, $ratio) |
|
| 49 | |||
| 50 | /* ------------------------------------------------------------------------------------------------ |
||
| 51 | | Main Functions |
||
| 52 | | ------------------------------------------------------------------------------------------------ |
||
| 53 | */ |
||
| 54 | /** |
||
| 55 | * Make a rate instance. |
||
| 56 | * |
||
| 57 | * @param string $from |
||
| 58 | * @param string $to |
||
| 59 | * @param double $ratio |
||
| 60 | * |
||
| 61 | * @return self |
||
| 62 | */ |
||
| 63 | 12 | public static function make($from, $to, $ratio) |
|
| 67 | |||
| 68 | /** |
||
| 69 | * Get the instance as an array. |
||
| 70 | * |
||
| 71 | * @return array |
||
| 72 | */ |
||
| 73 | public function toArray() |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Convert the object to its JSON representation. |
||
| 84 | * |
||
| 85 | * @param int $options |
||
| 86 | * @return string |
||
| 87 | */ |
||
| 88 | public function toJson($options = 0) |
||
| 92 | } |
||
| 93 |