forked from igorsimdyanov/php8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrainbow_interface.php
39 lines (36 loc) · 984 Bytes
/
rainbow_interface.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
<?php
require_once('translatable.php');
enum Rainbow implements Tranlatable
{
case Red;
case Оrange;
case Yellow;
case Green;
case Blue;
case Indigo;
case Violet;
public function russian() : string
{
return match($this) {
static::Red => 'Красный',
static::Оrange => 'Оранжевый',
static::Yellow => 'Желтый',
static::Green => 'Зеленый',
static::Blue => 'Голубой',
static::Indigo => 'Синий',
static::Violet => 'Фиолетовый'
};
}
public function english() : string
{
return match($this) {
static::Red => 'Red',
static::Оrange => 'Оrange',
static::Yellow => 'Yellow',
static::Green => 'Green',
static::Blue => 'Blue',
static::Indigo => 'Indigo',
static::Violet => 'Violet'
};
}
}