1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Bookeo\Endpoints\Availability; |
4
|
|
|
|
5
|
|
|
use Bookeo\Endpoints\Availability; |
6
|
|
|
use Bookeo\Models\SlotList; |
7
|
|
|
|
8
|
|
|
class Slots extends Availability |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Navigate results of a matching slots search |
12
|
|
|
* |
13
|
|
|
* @param string $productId the product id (see /settings/products). If not provided, all products of type "fixed" or "fixedCourse" will be included in the result. If no productId is provided, products that are not bookable by customers wil not be included in the result. If productId is provided, the product must be of type "fixed" or "fixedCourse". For products of type "flexibleTime", use /availability/matchingslots instead. |
14
|
|
|
* @param string $startTime the start time to search from. Required unless pageNavigationToken is used. |
15
|
|
|
* @param string $endTime the end time to search to. Required unless pageNavigationToken is used. The maximum date range in a single call is 31 days. |
16
|
|
|
* @param string $pageNavigationToken |
17
|
|
|
* @param int $itemsPerPage maximum: 300 |
18
|
|
|
* @param int $pageNumber |
19
|
|
|
* |
20
|
|
|
* @return $this |
21
|
|
|
*/ |
22
|
|
|
public function __invoke(string $productId = null, string $startTime = null, string $endTime = null, int $itemsPerPage = 50, string $pageNavigationToken = null, int $pageNumber = 1) |
23
|
|
|
{ |
24
|
|
|
if (null !== $productId) { |
25
|
|
|
$this->appendToQuery('productId', $productId); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
if (null !== $startTime && null === $pageNavigationToken) { |
29
|
|
|
$this->appendToQuery('startTime', $startTime); |
30
|
|
|
} elseif (null === $startTime && null !== $pageNavigationToken) { |
31
|
|
|
$this->appendToQuery('pageNavigationToken', $pageNavigationToken); |
32
|
|
|
} else { |
33
|
|
|
throw new \InvalidArgumentException('At least "startTime" or "pageNavigationToken" must be set'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
if (null !== $startTime) { |
37
|
|
|
$this->appendToQuery('endTime', $endTime); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
if (null !== $startTime) { |
41
|
|
|
$this->appendToQuery('itemsPerPage', $itemsPerPage); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
if (null !== $pageNavigationToken) { |
45
|
|
|
$this->appendToQuery('pageNumber', $pageNumber); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
// Set HTTP params |
49
|
|
|
$this->type = 'get'; |
50
|
|
|
$this->endpoint = '/availability/slots' . '?' . $this->getQuery(); |
51
|
|
|
$this->response = SlotList::class; |
|
|
|
|
52
|
|
|
|
53
|
|
|
return $this; |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.