-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.php
43 lines (38 loc) · 944 Bytes
/
helpers.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
<?php
function getPokemonType(array $data): array
{
$temp = $data['temp'];
if ($temp < 5) {
$type = 'ice';
$theme = 'yeti';
} else if ($temp >= 5 && $temp < 10) {
$type = 'water';
$theme = 'cerulean';
} else if ($temp > 12 && $temp < 15) {
$type = 'grass';
$theme = 'lumen';
} else if ($temp > 15 && $temp < 21) {
$type = 'ground';
$theme = 'slate';
} else if ($temp > 23 && $temp < 27) {
$type = 'bug';
$theme = 'minty';
} else if ($temp > 27 && $temp < 33) {
$type = 'rock';
$theme = 'sandstone';
} else if ($temp > 33) {
$type = 'fire';
$theme = 'journal';
} else {
$type = 'normal';
$theme = 'cosmo';
}
if ($data['raining']) {
$type = 'electric';
$theme = 'superhero';
}
return [
'type' => $type,
'theme' => $theme
];
}