/
LiquidVolume.php
114 lines (105 loc) · 3.26 KB
/
LiquidVolume.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php namespace Arcanedev\Units\Contracts;
/**
* Interface LiquidVolume
*
* @package Arcanedev\Units\Contracts
* @author ARCANEDEV <arcanedev.maroc@gmail.com>
*/
interface LiquidVolume extends UnitMeasure, Calculatable
{
/* ------------------------------------------------------------------------------------------------
| Constants
| ------------------------------------------------------------------------------------------------
*/
const KL = 'kl';
const HL = 'hl';
const DAL = 'dal';
const L = 'l';
const DL = 'dl';
const CL = 'cl';
const ML = 'ml';
/* ------------------------------------------------------------------------------------------------
| Getters & Setters
| ------------------------------------------------------------------------------------------------
*/
/**
* Get the symbol's names.
*
* @return array
*/
public static function names();
/**
* Get the symbol name.
*
* @param string $unit
*
* @return string
*/
public static function getSymbolName($unit);
/* ------------------------------------------------------------------------------------------------
| Main Functions
| ------------------------------------------------------------------------------------------------
*/
/**
* Make a volume instance.
*
* @param double|float|integer $value
* @param string $unit
* @param array $options
*
* @return \Arcanedev\Units\Contracts\LiquidVolume
*/
public static function make($value = 0, $unit = self::L, array $options = []);
/**
* Convert the volume.
*
* @param string $from
* @param string $to
* @param double|float|integer $value
*
* @return double|float|integer
*/
public static function convert($from, $to, $value);
/**
* Format the volume with symbol.
*
* @param int|null $decimals
* @param string|null $decimalSeparator
* @param string|null $thousandsSeparator
*
* @return string
*/
public function formatWithSymbol($decimals = null, $decimalSeparator = null, $thousandsSeparator = null);
/**
* Format the volume.
*
* @param int|null $decimals
* @param string|null $decimalSeparator
* @param string|null $thousandsSeparator
*
* @return string
*/
public function format($decimals = null, $decimalSeparator = null, $thousandsSeparator = null);
/* ------------------------------------------------------------------------------------------------
| Calculation Functions
| ------------------------------------------------------------------------------------------------
*/
/**
* Add the volume.
*
* @param float|int $value
* @param string $unit
*
* @return \Arcanedev\Units\Contracts\LiquidVolume
*/
public function addVolume($value, $unit = self::L);
/**
* Sub the volume.
*
* @param float|int $value
* @param string $unit
*
* @return \Arcanedev\Units\Contracts\LiquidVolume
*/
public function subVolume($value, $unit = self::L);
}