Completed
Push — master ( 735830...ddc755 )
by Mr
06:26
created

Bookings   A

Complexity

Total Complexity 33

Size/Duplication

Total Lines 242
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 33
lcom 1
cbo 1
dl 0
loc 242
ccs 0
cts 146
cp 0
rs 9.76
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
F all() 0 55 12
A __invoke() 0 18 3
B create() 0 37 7
A update() 0 22 4
B delete() 0 34 7
1
<?php
2
3
namespace Bookeo\Endpoints;
4
5
use Bookeo\Client;
6
use Bookeo\Interfaces\QueryInterface;
7
use Bookeo\Models\Booking;
8
use Bookeo\Models\BookingsList;
9
use Bookeo\Models\Hold;
10
use Bookeo\Models\HoldCreate;
11
12
/**
13
 * Operations to manage bookings
14
 *
15
 * @package Bookeo\Endpoints
16
 */
17
class Bookings extends Client
18
{
19
    /**
20
     * Retrieve a booking
21
     *
22
     * Retrieve a booking by its booking number
23
     *
24
     * @param int         $itemsPerPage         maximum: 100
25
     * @param string|null $pageNavigationToken
26
     * @param int         $pageNumber
27
     * @param string|null $startTime            if specified, only include bookings that start on or after this time. If specified, endTime must be specified as well.
28
     * @param string|null $endTime              if specified, only include bookings that start on or before this time. If specified, startTime must be specified as well. The maximum allowed interval is 31 days.
29
     * @param string|null $lastUpdatedStartTime if specified, only include bookings that were last changed (or created) on or after this time. If specified, lastUpdatedEndTime must be specified as well.
30
     * @param string|null $lastUpdatedEndTime   if specified, only include bookings that were last changed (or created) on or before this time. If specified, lastUpdatedStartTime must be specified as well. The maximum allowed interval is 31 days.
31
     * @param string|null $productId            if not specified, include bookings for all products. If specified, include only bookings for this product
32
     * @param bool        $includeCanceled      if true, canceled bookings are included. If false, only bookings that are not canceled are included
33
     * @param bool        $expandCustomer       if true, the full details of the customer are included (provided the application has read permission over the customer)
34
     * @param bool        $expandParticipants   if true, full details of the participants are included (provided the application has read permission over the participant)
35
     *
36
     * @return \Bookeo\Interfaces\QueryInterface
37
     */
38
    public function all(
39
        int $itemsPerPage = 50,
40
        string $pageNavigationToken = null,
41
        int $pageNumber = 1,
42
        string $startTime = null,
43
        string $endTime = null,
44
        string $lastUpdatedStartTime = null,
45
        string $lastUpdatedEndTime = null,
46
        string $productId = null,
47
        bool $includeCanceled = false,
48
        bool $expandCustomer = false,
49
        bool $expandParticipants = false
50
    ): QueryInterface {
51
52
        if (!empty($itemsPerPage)) {
53
            $this->appendToQuery('itemsPerPage', $itemsPerPage);
54
        }
55
        if (!empty($pageNavigationToken)) {
56
            $this->appendToQuery('pageNavigationToken', $pageNavigationToken);
57
        }
58
        if (!empty($pageNumber)) {
59
            $this->appendToQuery('pageNumber', $pageNumber);
60
        }
61
        if (!empty($startTime)) {
62
            $this->appendToQuery('startTime', $startTime);
63
        }
64
        if (!empty($endTime)) {
65
            $this->appendToQuery('endTime', $endTime);
66
        }
67
        if (!empty($lastUpdatedStartTime)) {
68
            $this->appendToQuery('lastUpdatedStartTime', $lastUpdatedStartTime);
69
        }
70
        if (!empty($lastUpdatedEndTime)) {
71
            $this->appendToQuery('lastUpdatedEndTime', $lastUpdatedEndTime);
72
        }
73
        if (!empty($productId)) {
74
            $this->appendToQuery('productId', $productId);
75
        }
76
        if (!empty($includeCanceled)) {
77
            $this->appendToQuery('includeCanceled', $includeCanceled);
0 ignored issues
show
Documentation introduced by
$includeCanceled is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
78
        }
79
        if (!empty($expandCustomer)) {
80
            $this->appendToQuery('expandCustomer', $expandCustomer);
0 ignored issues
show
Documentation introduced by
$expandCustomer is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
81
        }
82
        if (!empty($expandParticipants)) {
83
            $this->appendToQuery('expandParticipants', $expandParticipants);
0 ignored issues
show
Documentation introduced by
$expandParticipants is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
84
        }
85
86
        // Set HTTP params
87
        $this->type     = 'get';
88
        $this->endpoint = '/bookings?' . $this->getQuery();
89
        $this->response = BookingsList::class;
0 ignored issues
show
Documentation introduced by
The property response does not exist on object<Bookeo\Endpoints\Bookings>. Since you implemented __set, maybe consider adding a @property annotation.

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.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

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.

Loading history...
90
91
        return $this;
92
    }
93
94
    /**
95
     * Retrieve a booking
96
     *
97
     * Retrieve a booking by its booking number
98
     *
99
     * @param string $booking_id
100
     * @param bool   $expandCustomer     if true, the full details of the customer are included (provided the application has read permission over the customer)
101
     * @param bool   $expandParticipants if true, full details of the participants are included (provided the application has read permission over the participant)
102
     *
103
     * @return $this
104
     */
105
    public function __invoke(string $booking_id, bool $expandCustomer = false, bool $expandParticipants = false)
106
    {
107
        if (!empty($expandCustomer)) {
108
            $this->appendToQuery('expandCustomer', $expandCustomer);
0 ignored issues
show
Documentation introduced by
$expandCustomer is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
109
        }
110
        if (!empty($expandParticipants)) {
111
            $this->appendToQuery('expandParticipants', $expandParticipants);
0 ignored issues
show
Documentation introduced by
$expandParticipants is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
112
        }
113
114
        $this->booking_id = $booking_id;
0 ignored issues
show
Documentation introduced by
The property booking_id does not exist on object<Bookeo\Endpoints\Bookings>. Since you implemented __set, maybe consider adding a @property annotation.

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.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

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.

Loading history...
115
116
        // Set HTTP params
117
        $this->type     = 'get';
118
        $this->endpoint = '/bookings/' . $booking_id . '?' . $this->getQuery();
119
        $this->response = Booking::class;
0 ignored issues
show
Documentation introduced by
The property response does not exist on object<Bookeo\Endpoints\Bookings>. Since you implemented __set, maybe consider adding a @property annotation.

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.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

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.

Loading history...
120
121
        return $this;
122
    }
123
124
    /**
125
     * Create a new booking
126
     *
127
     * When creating a booking for a product of type "fixed" or "fixedCourse", the eventId is required. eventIds are obtained by calling /availability/slots or /availability/matchingSlots .
128
     * When creating a booking for a product of type "flexibleTime", you can either specify the eventId or the startTime (in which case you can optionally specify the endTime. If no endTime is specified, Bookeo will automatically calculate the duration based on the options chosen)
129
     *
130
     * @param \Bookeo\Models\Booking $create         if specified, deletes the hold with the given id
131
     * @param string|null            $previousHoldId whether to send a notification email (and possibly SMS, depending on settings) to eligible users
132
     * @param bool|null              $notifyUsers    whether to send a confirmation email to the customer
133
     * @param bool|null              $notifyCustomer
134
     * @param bool|null              $sendCustomerReminders
135
     * @param bool|null              $sendCustomerThankyou
136
     * @param string|null            $mode           if present and set to "backend", treats the operation as if it was done by a manager. This relaxes some constraints such as when is it possible to change a booking, participants limits for the booking, booking limits (time in advance), and so on.
137
     *
138
     * @return \Bookeo\Interfaces\QueryInterface
139
     */
140
    public function create(
141
        Booking $create,
142
        string $previousHoldId = null,
143
        bool $notifyUsers = null,
144
        bool $notifyCustomer = null,
145
        bool $sendCustomerReminders = null,
146
        bool $sendCustomerThankyou = null,
147
        string $mode = null
148
    ): QueryInterface {
149
150
        if (!empty($previousHoldId)) {
151
            $this->appendToQuery('previousHoldId', $previousHoldId);
152
        }
153
        if (null !== $notifyUsers) {
154
            $this->appendToQuery('notifyUsers', $notifyUsers);
0 ignored issues
show
Documentation introduced by
$notifyUsers is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
155
        }
156
        if (null !== $notifyCustomer) {
157
            $this->appendToQuery('notifyCustomer', $notifyCustomer);
0 ignored issues
show
Documentation introduced by
$notifyCustomer is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
158
        }
159
        if (null !== $sendCustomerReminders) {
160
            $this->appendToQuery('sendCustomerReminders', $sendCustomerReminders);
0 ignored issues
show
Documentation introduced by
$sendCustomerReminders is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
161
        }
162
        if (null !== $sendCustomerThankyou) {
163
            $this->appendToQuery('sendCustomerThankyou', $sendCustomerThankyou);
0 ignored issues
show
Documentation introduced by
$sendCustomerThankyou is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
164
        }
165
        if (null !== $mode) {
166
            $this->appendToQuery('mode', $mode);
167
        }
168
169
        // Set HTTP params
170
        $this->type     = 'post';
171
        $this->endpoint = '/bookings?' . $this->getQuery();
172
        $this->params   = $create;
173
        $this->response = Booking::class;
0 ignored issues
show
Documentation introduced by
The property response does not exist on object<Bookeo\Endpoints\Bookings>. Since you implemented __set, maybe consider adding a @property annotation.

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.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

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.

Loading history...
174
175
        return $this;
176
    }
177
178
    /**
179
     * Update an existing booking
180
     *
181
     * @param bool|null   $notifyUsers    if true, notification emails and SMS are sent to authorized users
182
     * @param bool|null   $notifyCustomer if true, a notification email is sent to the customer
183
     * @param string|null $mode           if present and set to "backend", treats the operation as if it was done by a manager. This relaxes some constraints such as when is it possible to change a booking, participants limits for the booking, booking limits (time in advance), and so on.
184
     *
185
     * @return \Bookeo\Interfaces\QueryInterface
186
     */
187
    public function update(
188
        bool $notifyUsers = null,
189
        bool $notifyCustomer = null,
190
        string $mode = null
191
    ): QueryInterface {
192
193
        if (null !== $notifyUsers) {
194
            $this->appendToQuery('notifyUsers', $notifyUsers);
0 ignored issues
show
Documentation introduced by
$notifyUsers is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
195
        }
196
        if (null !== $notifyCustomer) {
197
            $this->appendToQuery('notifyCustomer', $notifyCustomer);
0 ignored issues
show
Documentation introduced by
$notifyCustomer is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
198
        }
199
        if (!empty($mode)) {
200
            $this->appendToQuery('mode', $mode);
201
        }
202
203
        // Set HTTP params
204
        $this->type     = 'put';
205
        $this->endpoint = '/bookings/' . $this->booking_id . '?' . $this->getQuery();
0 ignored issues
show
Documentation introduced by
The property booking_id does not exist on object<Bookeo\Endpoints\Bookings>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read 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.

Loading history...
206
207
        return $this;
208
    }
209
210
    /**
211
     * Delete a temporary hold
212
     *
213
     * Cancel a booking. Cancelled bookings remain in the system, but no longer show up in the calendar or take up seats.
214
     *
215
     * @param bool|null   $notifyUsers             if true, notification emails and SMS are sent to authorized users
216
     * @param bool|null   $notifyCustomer          if true, a notification email is sent to the customer
217
     * @param bool|null   $applyCancellationPolicy if true, the default cancellation policy is applied. This may cause a charge on the credit card on file, if a cancellation fee is due
218
     * @param bool|null   $trackInCustomerHistory  if true, the cancellation will be tracked in the customer's stats
219
     * @param bool|null   $cancelRemainingSeries   if true, and this booking is part of a recurring series, all following bookings will be cancelled as well
220
     * @param string|null $reason                  an optional reason that explains why the booking was cancelled
221
     *
222
     * @return \Bookeo\Interfaces\QueryInterface
223
     */
224
    public function delete(
225
        bool $notifyUsers = null,
226
        bool $notifyCustomer = null,
227
        bool $applyCancellationPolicy = null,
228
        bool $trackInCustomerHistory = null,
229
        bool $cancelRemainingSeries = null,
230
        string $reason = null
231
    ): QueryInterface {
232
233
        if (null !== $notifyUsers) {
234
            $this->appendToQuery('notifyUsers', $notifyUsers);
0 ignored issues
show
Documentation introduced by
$notifyUsers is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
235
        }
236
        if (null !== $notifyCustomer) {
237
            $this->appendToQuery('notifyCustomer', $notifyCustomer);
0 ignored issues
show
Documentation introduced by
$notifyCustomer is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
238
        }
239
        if (null !== $applyCancellationPolicy) {
240
            $this->appendToQuery('applyCancellationPolicy', $applyCancellationPolicy);
0 ignored issues
show
Documentation introduced by
$applyCancellationPolicy is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
241
        }
242
        if (null !== $trackInCustomerHistory) {
243
            $this->appendToQuery('trackInCustomerHistory', $trackInCustomerHistory);
0 ignored issues
show
Documentation introduced by
$trackInCustomerHistory is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
244
        }
245
        if (null !== $cancelRemainingSeries) {
246
            $this->appendToQuery('cancelRemainingSeries', $cancelRemainingSeries);
0 ignored issues
show
Documentation introduced by
$cancelRemainingSeries is of type boolean, but the function expects a string|integer.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
247
        }
248
        if (!empty($reason)) {
249
            $this->appendToQuery('reason', $reason);
250
        }
251
252
        // Set HTTP params
253
        $this->type     = 'delete';
254
        $this->endpoint = '/bookings/' . $this->booking_id . '?' . $this->getQuery();
0 ignored issues
show
Documentation introduced by
The property booking_id does not exist on object<Bookeo\Endpoints\Bookings>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read 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.

Loading history...
255
256
        return $this;
257
    }
258
}
259