Completed
Push — master ( 414fb3...f23df8 )
by Gareth
03:44
created

API::getNextPage()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3.072

Importance

Changes 3
Bugs 0 Features 2
Metric Value
c 3
b 0
f 2
dl 0
loc 18
ccs 8
cts 10
cp 0.8
rs 9.4285
cc 3
eloc 10
nc 3
nop 1
crap 3.072
1
<?php
2
3
namespace garethp\ews;
4
5
use garethp\ews\API\Enumeration\DisposalType;
6
use garethp\ews\API\Enumeration\IndexBasePointType;
7
use garethp\ews\API\ExchangeWebServices;
8
use garethp\ews\API\ItemUpdateBuilder;
9
use garethp\ews\API\Message\GetServerTimeZonesType;
10
use garethp\ews\API\Message\SyncFolderItemsResponseMessageType;
11
use garethp\ews\API\Message\UpdateItemResponseMessageType;
12
use garethp\ews\API\Type;
13
use garethp\ews\CalendarAPI;
14
use garethp\ews\MailAPI;
15
16
/**
17
 * A base class for APIs
18
 *
19
 * Class BaseAPI
20
 * @package garethp\ews
21
 */
22
class API
23
{
24
    protected static $defaultClientOptions = array(
25
        'version' => ExchangeWebServices::VERSION_2010
26
    );
27
28 33
    public function __construct(ExchangeWebServices $client = null)
29
    {
30 33
        if ($client) {
31 33
            $this->setClient($client);
32 33
        }
33 33
    }
34
35
    /**
36
     * @return Type\EmailAddressType
37
     */
38 25
    public function getPrimarySmtpMailbox()
39
    {
40 25
        return $this->getClient()->getPrimarySmtpMailbox();
41
    }
42
43
    /**
44
     * Storing the API client
45
     * @var ExchangeWebServices
46
     */
47
    private $client;
48
49
    /**
50
     * Get a calendar item
51
     *
52
     * @param string $name
53
     * @return CalendarAPI
54
     */
55 6
    public function getCalendar($name = null)
56
    {
57 6
        $calendar = new CalendarAPI();
58 6
        $calendar->setClient($this->getClient());
59 6
        $calendar->pickCalendar($name);
60
61 6
        return $calendar;
62
    }
63
64
    /**
65
     * @param string $folderName
66
     * @return MailAPI
67
     */
68 6
    public function getMailbox($folderName = null)
69
    {
70 6
        $mailApi = new MailAPI();
71 6
        $mailApi->setClient($this->getClient());
72 6
        $mailApi->pickMailFolder($folderName);
73
74 6
        return $mailApi;
75
    }
76
77
    /**
78
     * Set the API client
79
     *
80
     * @param ExchangeWebServices $client
81
     * @return $this
82
     */
83 33
    public function setClient($client)
84
    {
85 33
        $this->client = $client;
86
87 33
        return $this;
88
    }
89
90
    /**
91
     * Get the API client
92
     *
93
     * @return ExchangeWebServices
94
     */
95 32
    public function getClient()
96
    {
97 32
        return $this->client;
98
    }
99
100 32
    public static function withUsernameAndPassword($server, $username, $password, $options = [])
101
    {
102 32
        return new static(ExchangeWebServices::fromUsernameAndPassword(
103 32
            $server,
104 32
            $username,
105 32
            $password,
106 32
            array_replace_recursive(self::$defaultClientOptions, $options)
107 32
        ));
108
    }
109
110 1
    public static function withCallbackToken($server, $token, $options = [])
111
    {
112 1
        return new static(ExchangeWebServices::fromCallbackToken(
113 1
            $server,
114 1
            $token,
115 1
            array_replace_recursive(self::$defaultClientOptions, $options)
116 1
        ));
117
    }
118
119 1
    public function getPrimarySmptEmailAddress()
120
    {
121 1
        if ($this->getPrimarySmtpMailbox() == null) {
122 1
            return null;
123
        }
124
125 1
        return $this->getPrimarySmtpMailbox()->getEmailAddress();
126
    }
127
128 1
    public function setPrimarySmtpEmailAddress($emailAddress)
129
    {
130 1
        $this->getClient()->setPrimarySmtpEmailAddress($emailAddress);
131
132 1
        return $this;
133
    }
134
135
    /**
136
     * Create items through the API client
137
     *
138
     * @param $items
139
     * @param array $options
140
     * @return Type
141
     */
142 16
    public function createItems($items, $options = array())
143
    {
144 16
        if (!is_array($items)) {
145 1
            $items = array($items);
146
        }
147
148
        $request = array(
149
            'Items' => $items
150 16
        );
151
152 16
        $request = array_replace_recursive($request, $options);
153 16
        $request = Type::buildFromArray($request);
154
155 16
        $response = $this->getClient()->CreateItem($request);
156
157 16
        return $response;
158
    }
159
160 4
    public function updateItems($items, $options = array())
161
    {
162
        $request = array(
163 4
            'ItemChanges' => $items,
164 4
            'MessageDisposition' => 'SaveOnly',
165
            'ConflictResolution' => 'AlwaysOverwrite'
166 4
        );
167
168 4
        $request = array_replace_recursive($request, $options);
169
170 4
        $request = Type::buildFromArray($request);
171
172 4
        $response = $this->getClient()->UpdateItem($request);
173 4
        if ($response instanceof UpdateItemResponseMessageType) {
0 ignored issues
show
Bug introduced by
The class garethp\ews\API\Message\...ItemResponseMessageType does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
174 4
            return $response->getItems();
175
        }
176
177
        if (!is_array($response)) {
178
            $response = array($response);
179
        }
180
181
        return $response;
182
    }
183
184 1
    public function createCalendars($names, Type\FolderIdType $parentFolder = null, $options = array())
185
    {
186 1
        if ($parentFolder == null) {
187 1
            $parentFolder = $this->getFolderByDistinguishedId('calendar')->getFolderId();
0 ignored issues
show
Documentation Bug introduced by
The method getFolderId does not exist on object<garethp\ews\API\Type>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
188 1
        }
189
190 1
        if (!is_array($names)) {
191 1
            $names = array($names);
192 1
        }
193
194
        $names = array_map(function ($name) {
195
            return array(
196 1
                'DisplayName' => $name,
197
                'FolderClass' => 'IPF.Appointment'
198 1
            );
199 1
        }, $names);
200
201
        $request = [
202 1
            'Folders' => ['Folder' => $names],
203 1
            'ParentFolderId' => ['FolderId' => $parentFolder->toArray()]
204 1
        ];
205
206 1
        $request = array_merge_recursive($request, $options);
207
208 1
        $this->client->CreateFolder($request);
209 1
        return true;
210
    }
211
212 2
    public function createFolders($names, Type\FolderIdType $parentFolder, $options = array())
213
    {
214 2
        if (!is_array($names)) {
215 2
            $names = array($names);
216 2
        }
217
218
        $names = array_map(function ($name) {
219 2
            return ['DisplayName' => $name];
220 2
        }, $names);
221
222
        $request = [
223 2
            'Folders' => ['Folder' => $names]
224 2
        ];
225
226 2
        if (!empty($parentFolder)) {
227 2
            $request['ParentFolderId'] = array('FolderId' => $parentFolder->toArray());
228 2
        }
229
230 2
        $request = array_merge_recursive($request, $options);
231
232 2
        $this->client->CreateFolder($request);
233
234 2
        return true;
235
    }
236
237 3 View Code Duplication
    public function deleteFolder(Type\FolderIdType $folderId, $options = array())
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
238
    {
239
        $request = array(
240 3
            'DeleteType' => 'HardDelete',
241
            'FolderIds' => array(
242 3
                'FolderId' => $folderId->toArray()
243 3
            )
244 3
        );
245
246 3
        $request = array_merge_recursive($request, $options);
247
248 3
        return $this->client->DeleteFolder($request);
249
    }
250
251 View Code Duplication
    public function moveItem(Type\ItemIdType $itemId, Type\FolderIdType $folderId, $options = array())
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
252
    {
253
        $request = array(
254
            'ToFolderId' => array('FolderId' => $folderId->toArray()),
255
            'ItemIds' => array('ItemId' => $itemId->toArray())
256
        );
257
258
        $request = array_merge_recursive($request, $options);
259
260
        return $this->client->MoveItem($request);
261
    }
262
263
    /**
264
     * @param        $items Type\ItemIdType|Type\ItemIdType[]
265
     * @param array  $options
266
     * @return bool
267
     */
268 16
    public function deleteItems($items, $options = array())
269
    {
270 16
        if (!is_array($items) || Type::arrayIsAssoc($items)) {
271 15
            $items = array($items);
272 15
        }
273
274 16
        $items = array_map(function ($item) {
275 16
            $item = Type\ItemIdType::buildFromArray($item);
276
277 16
            return $item->toArray();
278 16
        }, $items);
279
280
        $request = array(
281 16
            'ItemIds' => array('ItemId' => $items),
282
            'DeleteType' => 'MoveToDeletedItems'
283 16
        );
284
285 16
        $request = array_replace_recursive($request, $options);
286 16
        $request = Type::buildFromArray($request);
287 16
        $this->getClient()->DeleteItem($request);
288
289
        //If the delete fails, an Exception will be thrown in processResponse before it gets here
290 16
        return true;
291
    }
292
293
    /**
294
     * @param $identifier
295
     * @return Type\BaseFolderType
296
     */
297 24
    public function getFolder($identifier)
298
    {
299
        $request = array(
300
            'FolderShape' => array(
301 24
                'BaseShape' => array('_' => 'Default')
302 24
            ),
303
            'FolderIds' => $identifier
304 24
        );
305 24
        $request = Type::buildFromArray($request);
306
307 24
        $response = $this->getClient()->GetFolder($request);
308
309 24
        return $response;
310
    }
311
312
    /**
313
     * Get a folder by it's distinguishedId
314
     *
315
     * @param string $distinguishedId
316
     * @return Type\BaseFolderType
317
     */
318 24
    public function getFolderByDistinguishedId($distinguishedId)
319
    {
320 24
        return $this->getFolder(array(
321
            'DistinguishedFolderId' => array(
322 24
                'Id' => $distinguishedId,
323 24
                'Mailbox' => $this->getPrimarySmtpMailbox()
324 24
            )
325 24
        ));
326
    }
327
328
    /**
329
     * @param $folderId
330
     * @return Type\BaseFolderType
331
     */
332 4
    public function getFolderByFolderId($folderId)
333
    {
334 4
        return $this->getFolder(array(
335 4
            'FolderId' => array('Id' => $folderId, 'Mailbox' => $this->getPrimarySmtpMailbox())
336 4
        ));
337
    }
338
339
    /**
340
     * @param string|Type\FolderIdType $parentFolderId
341
     * @param array $options
342
     * @return bool|Type\BaseFolderType
343
     */
344 23
    public function getChildrenFolders($parentFolderId = 'root', $options = array())
345
    {
346 23
        if (is_string($parentFolderId)) {
347 15
            $parentFolderId = $this->getFolderByDistinguishedId($parentFolderId)->getFolderId();
0 ignored issues
show
Documentation Bug introduced by
The method getFolderId does not exist on object<garethp\ews\API\Type>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
348 15
        }
349
350
        $request = array(
351 23
            'Traversal' => 'Shallow',
352
            'FolderShape' => array(
353
                'BaseShape' => 'AllProperties'
354 23
            ),
355
            'ParentFolderIds' => array(
356 23
                'FolderId' => $parentFolderId->toArray()
357 23
            )
358 23
        );
359
360 23
        $request = array_replace_recursive($request, $options);
361
362 23
        $request = Type::buildFromArray($request);
363
364
        /** @var \garethp\ews\API\Message\FindFolderResponseMessageType $folders */
365 23
        return $this->getClient()->FindFolder($request);
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->getClient()->FindFolder($request); (garethp\ews\API\Type) is incompatible with the return type documented by garethp\ews\API::getChildrenFolders of type boolean|garethp\ews\API\Type\BaseFolderType.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
366
367
        return $folders->getFolders();
0 ignored issues
show
Unused Code introduced by
return $folders->getFolders(); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
368
    }
369
370
    /**
371
     * @param string $folderName
372
     * @param string|Type\FolderIdType $parentFolderId
373
     * @param array $options
374
     * @return bool|Type\BaseFolderType
375
     */
376 23
    public function getFolderByDisplayName($folderName, $parentFolderId = 'root', $options = array())
377
    {
378 23
        $folders = $this->getChildrenFolders($parentFolderId, $options);
379
380 23
        foreach ($folders as $folder) {
0 ignored issues
show
Bug introduced by
The expression $folders of type boolean|object<garethp\e...PI\Type\BaseFolderType> is not guaranteed to be traversable. How about adding an additional type check?

There are different options of fixing this problem.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
381 23
            if ($folder->getDisplayName() == $folderName) {
382 22
                return $folder;
383
            }
384 17
        }
385
386 4
        return false;
387
    }
388
389
    /**
390
     * @param $itemId array|Type\ItemIdType
391
     * @param array $options
392
     * @return Type
393
     */
394 5 View Code Duplication
    public function getItem($itemId, $options = array())
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
395
    {
396 5
        if ($itemId instanceof Type\ItemIdType) {
0 ignored issues
show
Bug introduced by
The class garethp\ews\API\Type\ItemIdType does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
397 4
            $itemId = $itemId->toArray();
398 4
        }
399
400
        $request = array(
401 5
            'ItemShape' => array('BaseShape' => 'AllProperties'),
402 5
            'ItemIds' => array('ItemId' => $itemId)
403 5
        );
404
405 5
        $request = array_replace_recursive($request, $options);
406
407 5
        return $this->getClient()->GetItem($request);
408
    }
409
410
    /**
411
     * Get a list of sync changes on a folder
412
     *
413
     * @param Type\FolderIdType $folderId
414
     * @param null $syncState
415
     * @param array $options
416
     * @return SyncFolderItemsResponseMessageType
417
     */
418 2
    public function listItemChanges($folderId, $syncState = null, $options = array())
419
    {
420
        $request = array(
421 2
            'ItemShape' => array('BaseShape' => 'IdOnly'),
422 2
            'SyncFolderId' => array('FolderId' => $folderId->toXmlObject()),
423 2
            'SyncScope' => 'NormalItems',
424
            'MaxChangesReturned' => '100'
425 2
        );
426
427 2
        if ($syncState != null) {
428 1
            $request['SyncState'] = $syncState;
429 1
            $request['ItemShape']['BaseShape'] = 'AllProperties';
430 1
        }
431
432 2
        $request = array_replace_recursive($request, $options);
433
434 2
        $request = Type::buildFromArray($request);
435 2
        $response = $this->getClient()->SyncFolderItems($request);
436
437 2
        return $response;
438
    }
439
440
    public function getServerTimezones($timezoneIDs = array(), $fullTimezoneData = false)
441
    {
442
        $request = GetServerTimeZonesType::buildFromArray(array(
443
            'returnFullTimeZoneData' => $fullTimezoneData
444
        ));
445
446
        if (!empty($timezoneIDs)) {
447
            $request->setIds($timezoneIDs);
448
        }
449
450
        $timezones = $this->getClient()->GetServerTimeZones($request);
451
        $timezones = $timezones->TimeZoneDefinition;
0 ignored issues
show
Documentation introduced by
The property TimeZoneDefinition does not exist on object<garethp\ews\API\Type>. 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...
452
453
        if (!is_array($timezones)) {
454
            $timezones = array($timezones);
455
        }
456
457
        return $timezones;
458
    }
459
460
    /**
461
     * @param Type\ItemIdType $itemId
462
     * @param $fromType
463
     * @param $destinationType
464
     * @param $mailbox
465
     *
466
     * @return Type\ItemIdType
467
     */
468
    public function convertIdFormat(Type\ItemIdType $itemId, $fromType, $destinationType, $mailbox)
469
    {
470
        $result = $this->getClient()->ConvertId(array(
471
            'DestinationFormat' => $destinationType,
472
            'SourceIds' => array(
473
                'AlternateId' => array(
474
                    'Format' => $fromType,
475
                    'Id' => $itemId->getId(),
476
                    'Mailbox' => $mailbox
477
                )
478
            )
479
        ));
480
481
        $itemId->setId($result->getId());
0 ignored issues
show
Documentation Bug introduced by
The method getId does not exist on object<garethp\ews\API\Type>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
482
483
        return $itemId;
484
    }
485
486
    /**
487
     * @param Type\FindItemParentType|Type\FindFolderParentType $result
488
     *
489
     * @return Type\FindItemParentType|Type\FindFolderParentType
490
     */
491 1
    public function getNextPage($result)
492
    {
493 1
        if ($result->isIncludesLastItemInRange()) {
494
            return $result;
495
        }
496
497 1
        $currentPage = $result->getCurrentPage();
498 1
        $currentPage->setOffset($currentPage->getOffset() + 1);
499
500 1
        $lastRequest = $result->getLastRequest();
501 1
        $lastRequest->setIndexedPage($currentPage);
502
503 1
        if ($result instanceof Type\FindFolderParentType) {
0 ignored issues
show
Bug introduced by
The class garethp\ews\API\Type\FindFolderParentType does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
504
            return $this->getClient()->FindFolder($lastRequest);
505
        }
506
507 1
        return $this->getClient()->FindItem($lastRequest);
508
    }
509
}
510