Completed
Push — master ( 69b9f8...e13247 )
by Timur
02:07 queued 10s
created

Custom::memoryAvailable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Laravel\Forge\Servers\Providers;
4
5
use InvalidArgumentException;
6
7
class Custom extends Provider
8
{
9
    /**
10
     * @{inheritdoc}
11
     */
12
    public function provider()
13
    {
14
        return 'custom';
15
    }
16
17
    /**
18
     * @{inheritdoc}
19
     */
20
    public function regionAvailable(string $region)
21
    {
22
        throw new InvalidArgumentException('Custom provider does not support any region.');
23
    }
24
25
    /**
26
     * @{inheritdoc}
27
     */
28
    public function validate()
29
    {
30
        $errors = [];
31
32
        if (empty($this->payload['ip_address'])) {
33
            $errors[] = 'ip_address';
34
        }
35
36
        if (empty($this->payload['private_ip_address'])) {
37
            $errors[] = 'private_ip_address';
38
        }
39
40
        return count($errors) > 0 ? $errors : true;
41
    }
42
}
43