-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathLayerEndpoint.php
47 lines (37 loc) · 1.13 KB
/
LayerEndpoint.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
<?php
namespace GW2Treasures\GW2Api\V2\Endpoint\Emblem;
use GW2Treasures\GW2Api\GW2Api;
use GW2Treasures\GW2Api\V2\Bulk\BulkEndpoint;
use GW2Treasures\GW2Api\V2\Bulk\IBulkEndpoint;
use GW2Treasures\GW2Api\V2\Endpoint;
class LayerEndpoint extends Endpoint implements IBulkEndpoint {
use BulkEndpoint;
const TYPE_BACKGROUNDS = 'backgrounds';
const TYPE_FOREGROUNDS = 'foregrounds';
/**
* @var string[] $types valid types for this endpoint.
*/
protected static $types = [
self::TYPE_BACKGROUNDS,
self::TYPE_FOREGROUNDS
];
/** @var string Type of this endpoint (one of self::$types) */
protected $type;
/**
* @param GW2Api $api
* @param string $type Type of this endpoint.
*/
public function __construct(GW2Api $api, $type) {
parent::__construct($api);
if( !in_array($type, self::$types) ) {
throw new \InvalidArgumentException('$type has to be one of '.implode(', ', self::$types));
}
$this->type = $type;
}
/**
* {@inheritdoc}
*/
public function url() {
return 'v2/emblem/'.$this->type;
}
}