Server::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: sergio.rodenas
5
 * Date: 30/7/18
6
 * Time: 11:28
7
 */
8
9
namespace Whisper\HetznerCloud\Clients;
10
11
use LaravelWhisper\Whisper\ClientInterface;
12
13
class Server implements ClientInterface
14
{
15
	public static $uri = 'servers';
16
17
	public static function all(): array
18
	{
19
		return HetznerCloud::get(static::$uri)['servers'];
0 ignored issues
show
Bug introduced by
The method get() does not exist on Whisper\HetznerCloud\Clients\HetznerCloud. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
		return HetznerCloud::/** @scrutinizer ignore-call */ get(static::$uri)['servers'];
Loading history...
20
	}
21
22
	public static function find($identifier): array
23
	{
24
		return HetznerCloud::get(static::$uri.'/'.$identifier)['server'];
25
	}
26
27
	public static function create(array $data): array
28
	{
29
		return HetznerCloud::post(static::$uri, $data)['server'];
0 ignored issues
show
Bug introduced by
The method post() does not exist on Whisper\HetznerCloud\Clients\HetznerCloud. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
		return HetznerCloud::/** @scrutinizer ignore-call */ post(static::$uri, $data)['server'];
Loading history...
30
	}
31
32
	public static function update($identifier, array $data): void
33
	{
34
		HetznerCloud::put(static::$uri.'/'.$identifier, $data);
0 ignored issues
show
Bug introduced by
The method put() does not exist on Whisper\HetznerCloud\Clients\HetznerCloud. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
		HetznerCloud::/** @scrutinizer ignore-call */ 
35
                put(static::$uri.'/'.$identifier, $data);
Loading history...
35
	}
36
37
	public static function delete($identifier): ?bool
38
	{
39
		return ! isset(HetznerCloud::delete(static::$uri.'/'.$identifier)['error']);
0 ignored issues
show
Bug introduced by
The method delete() does not exist on Whisper\HetznerCloud\Clients\HetznerCloud. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
		return ! isset(HetznerCloud::/** @scrutinizer ignore-call */ delete(static::$uri.'/'.$identifier)['error']);
Loading history...
40
	}
41
}