-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathSearchResults.php
47 lines (41 loc) · 975 Bytes
/
SearchResults.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 Kunnu\Dropbox\Models;
class SearchResults extends MetadataCollection
{
/**
* Collection Items Key
*
* @const string
*/
const COLLECTION_ITEMS_KEY = 'matches';
/**
* Collection Cursor Key
*
* @const string
*/
const COLLECTION_CURSOR_KEY = 'start';
/**
* Collection has-more-items Key
*
* @const string
*/
const COLLECTION_HAS_MORE_ITEMS_KEY = 'more';
/**
* Process items and cast them
* to their respective Models
*
* @param array $items Unprocessed Items
*
* @return void
*/
protected function processItems(array $items)
{
$processedItems = [];
foreach ($items as $entry) {
if (isset($entry['metadata']) && is_array($entry['metadata'])) {
$processedItems[] = new SearchResult($entry);
}
}
$this->items = new ModelCollection($processedItems);
}
}