-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathUpdateNameserversParams.php
46 lines (41 loc) · 1.33 KB
/
UpdateNameserversParams.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
<?php
declare(strict_types=1);
namespace Upmind\ProvisionProviders\DomainNames\Data;
use Illuminate\Support\Arr;
use Upmind\ProvisionBase\Provider\DataSet\DataSet;
use Upmind\ProvisionBase\Provider\DataSet\Rules;
/**
* Params for setting domain renewing.
*
* @property-read string $sld Domain SLD
* @property-read string $tld Domain TLD
* @property-read Nameserver $ns1 Nameserver data
* @property-read Nameserver $ns2 Nameserver data
* @property-read Nameserver|null $ns3 Nameserver data
* @property-read Nameserver|null $ns4 Nameserver data
* @property-read Nameserver|null $ns5 Nameserver data
*/
class UpdateNameserversParams extends DataSet
{
public static function rules(): Rules
{
return new Rules([
'sld' => ['required', 'alpha-dash'],
'tld' => ['required', 'alpha-dash-dot'],
'ns1' => ['required', Nameserver::class],
'ns2' => ['required', Nameserver::class],
'ns3' => ['nullable', Nameserver::class],
'ns4' => ['nullable', Nameserver::class],
'ns5' => ['nullable', Nameserver::class],
]);
}
/**
* Returns a flat array of nameserver hosts.
*
* @return string[]
*/
public function pluckHosts(): array
{
return array_values(array_filter(Arr::pluck($this->toArray(), 'host')));
}
}