1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Clarkeash\Converter\Metrics; |
4
|
|
|
|
5
|
|
|
use Clarkeash\Converter\Contracts\Metric; |
6
|
|
|
|
7
|
|
|
class Size implements Metric |
8
|
|
|
{ |
9
|
1 |
|
public function bits() |
10
|
|
|
{ |
11
|
1 |
|
return pow(2, 0); |
12
|
|
|
} |
13
|
|
|
|
14
|
1 |
|
public function nibbles() |
15
|
|
|
{ |
16
|
1 |
|
return pow(2, 2); |
17
|
|
|
} |
18
|
|
|
|
19
|
2 |
|
public function bytes() |
20
|
|
|
{ |
21
|
2 |
|
return pow(2, 3); |
22
|
|
|
} |
23
|
|
|
|
24
|
1 |
|
public function kilobits() |
25
|
|
|
{ |
26
|
1 |
|
return pow(1000, 1); |
27
|
|
|
} |
28
|
|
|
|
29
|
1 |
|
public function kibibits() |
30
|
|
|
{ |
31
|
1 |
|
return pow(1024, 1); |
32
|
|
|
} |
33
|
|
|
|
34
|
1 |
|
public function kilobytes() |
35
|
|
|
{ |
36
|
1 |
|
return $this->bytes() * $this->kilobits(); |
37
|
|
|
} |
38
|
|
|
|
39
|
1 |
|
public function kibibytes() |
40
|
|
|
{ |
41
|
1 |
|
return $this->bytes() * $this->kibibits(); |
42
|
|
|
} |
43
|
|
|
|
44
|
2 |
|
public function megabits() |
45
|
|
|
{ |
46
|
2 |
|
return pow(1000, 2); |
47
|
|
|
} |
48
|
|
|
|
49
|
2 |
|
public function mebibits() |
50
|
|
|
{ |
51
|
2 |
|
return pow(1024, 2); |
52
|
|
|
} |
53
|
|
|
|
54
|
2 |
|
public function megabytes() |
55
|
|
|
{ |
56
|
2 |
|
return $this->bytes() * $this->megabits(); |
57
|
|
|
} |
58
|
|
|
|
59
|
2 |
|
public function mebibytes() |
60
|
|
|
{ |
61
|
2 |
|
return $this->bytes() * $this->mebibits(); |
62
|
|
|
} |
63
|
|
|
|
64
|
2 |
|
public function gigabits() |
65
|
|
|
{ |
66
|
2 |
|
return pow(1000, 3); |
67
|
|
|
} |
68
|
|
|
|
69
|
1 |
|
public function gibibits() |
70
|
|
|
{ |
71
|
1 |
|
return pow(1024, 3); |
72
|
|
|
} |
73
|
|
|
|
74
|
2 |
|
public function gigabytes() |
75
|
|
|
{ |
76
|
2 |
|
return $this->bytes() * $this->gigabits(); |
77
|
|
|
} |
78
|
|
|
|
79
|
1 |
|
public function gibibytes() |
80
|
|
|
{ |
81
|
1 |
|
return $this->bytes() * $this->gibibits(); |
82
|
|
|
} |
83
|
|
|
|
84
|
1 |
|
public function terabits() |
85
|
|
|
{ |
86
|
1 |
|
return pow(1000, 4); |
87
|
|
|
} |
88
|
|
|
|
89
|
1 |
|
public function tebibits() |
90
|
|
|
{ |
91
|
1 |
|
return pow(1024, 4); |
92
|
|
|
} |
93
|
|
|
|
94
|
1 |
|
public function terabytes() |
95
|
|
|
{ |
96
|
1 |
|
return $this->bytes() * $this->terabits(); |
97
|
|
|
} |
98
|
|
|
|
99
|
1 |
|
public function tebibytes() |
100
|
|
|
{ |
101
|
1 |
|
return $this->bytes() * $this->tebibits(); |
102
|
|
|
} |
103
|
|
|
|
104
|
1 |
|
public function petabits() |
105
|
|
|
{ |
106
|
1 |
|
return pow(1000, 5); |
107
|
|
|
} |
108
|
|
|
|
109
|
1 |
|
public function pebibits() |
110
|
|
|
{ |
111
|
1 |
|
return pow(1024, 5); |
112
|
|
|
} |
113
|
|
|
|
114
|
1 |
|
public function petabytes() |
115
|
|
|
{ |
116
|
1 |
|
return $this->bytes() * $this->petabits(); |
117
|
|
|
} |
118
|
|
|
|
119
|
1 |
|
public function pebibytes() |
120
|
|
|
{ |
121
|
1 |
|
return $this->bytes() * $this->pebibits(); |
122
|
|
|
} |
123
|
|
|
|
124
|
1 |
|
public function exabits() |
125
|
|
|
{ |
126
|
1 |
|
return pow(1000, 6); |
127
|
|
|
} |
128
|
|
|
|
129
|
1 |
|
public function exbibits() |
130
|
|
|
{ |
131
|
1 |
|
return pow(1024, 6); |
132
|
|
|
} |
133
|
|
|
|
134
|
1 |
|
public function exabytes() |
135
|
|
|
{ |
136
|
1 |
|
return $this->bytes() * $this->exabits(); |
137
|
|
|
} |
138
|
|
|
|
139
|
1 |
|
public function exbibytes() |
140
|
|
|
{ |
141
|
1 |
|
return $this->bytes() * $this->exbibits(); |
142
|
|
|
} |
143
|
|
|
|
144
|
1 |
|
public function zettabits() |
145
|
|
|
{ |
146
|
1 |
|
return pow(1000, 7); |
147
|
|
|
} |
148
|
|
|
|
149
|
1 |
|
public function zebibits() |
150
|
|
|
{ |
151
|
1 |
|
return pow(1024, 7); |
152
|
|
|
} |
153
|
|
|
|
154
|
1 |
|
public function zettabytes() |
155
|
|
|
{ |
156
|
1 |
|
return $this->bytes() * $this->zettabits(); |
157
|
|
|
} |
158
|
|
|
|
159
|
1 |
|
public function zebibytes() |
160
|
|
|
{ |
161
|
1 |
|
return $this->bytes() * $this->zebibits(); |
162
|
|
|
} |
163
|
|
|
|
164
|
1 |
|
public function yottabits() |
165
|
|
|
{ |
166
|
1 |
|
return pow(1000, 8); |
167
|
|
|
} |
168
|
|
|
|
169
|
1 |
|
public function yobibits() |
170
|
|
|
{ |
171
|
1 |
|
return pow(1024, 8); |
172
|
|
|
} |
173
|
|
|
|
174
|
1 |
|
public function yottabytes() |
175
|
|
|
{ |
176
|
1 |
|
return $this->bytes() * $this->yottabits(); |
177
|
|
|
} |
178
|
|
|
|
179
|
1 |
|
public function yobibytes() |
180
|
|
|
{ |
181
|
1 |
|
return $this->bytes() * $this->yobibits(); |
182
|
|
|
} |
183
|
|
|
} |
184
|
|
|
|