-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSIPowerUnit.php
More file actions
58 lines (50 loc) · 1.32 KB
/
SIPowerUnit.php
File metadata and controls
58 lines (50 loc) · 1.32 KB
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
<?php
declare(strict_types=1);
namespace Andante\Measurement\Unit\Power;
use Andante\Measurement\Contract\DimensionInterface;
use Andante\Measurement\Contract\UnitInterface;
use Andante\Measurement\Dimension\Power;
use Andante\Measurement\Unit\SymbolNotation;
use Andante\Measurement\Unit\UnitSystem;
/**
* SI power units.
*
* Base unit is watt (W), the SI unit for power.
* 1 W = 1 J/s = 1 kg⋅m²/s³
*/
enum SIPowerUnit implements UnitInterface
{
case Watt;
case Milliwatt;
case Kilowatt;
case Megawatt;
case Gigawatt;
public function symbol(SymbolNotation $notation = SymbolNotation::Default): string
{
return match ($this) {
self::Watt => 'W',
self::Milliwatt => 'mW',
self::Kilowatt => 'kW',
self::Megawatt => 'MW',
self::Gigawatt => 'GW',
};
}
public function name(): string
{
return match ($this) {
self::Watt => 'watt',
self::Milliwatt => 'milliwatt',
self::Kilowatt => 'kilowatt',
self::Megawatt => 'megawatt',
self::Gigawatt => 'gigawatt',
};
}
public function dimension(): DimensionInterface
{
return Power::instance();
}
public function system(): UnitSystem
{
return UnitSystem::Metric;
}
}