forked from protonemedia/eddy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProvider.php
49 lines (42 loc) · 1.1 KB
/
Provider.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
<?php
namespace App;
enum Provider: string
{
case DigitalOcean = 'digital_ocean';
case Github = 'github';
case HetznerCloud = 'hetzner_cloud';
case Vagrant = 'vagrant';
case CustomServer = 'custom_server';
public function getDisplayName(): string
{
return match ($this) {
self::DigitalOcean => 'DigitalOcean',
self::Github => 'Github',
self::HetznerCloud => 'Hetzner Cloud',
self::Vagrant => 'Vagrant',
self::CustomServer => 'Custom',
};
}
/**
* Returns the providers that can be managed by the user (e.g. adding a token manually).
*/
public static function userManagable(): array
{
return [
self::DigitalOcean,
self::HetznerCloud,
];
}
public static function forServers(): array
{
$providers = [
self::DigitalOcean,
self::HetznerCloud,
self::CustomServer,
];
if (! app()->isProduction()) {
$providers[] = self::Vagrant;
}
return $providers;
}
}