Version 1
[yaffs-website] / vendor / php-instagram-api / php-instagram-api / Instagram / Collection / MediaSearchCollection.php
1 <?php
2
3 /**
4 * Instagram PHP
5 * @author Galen Grover <galenjr@gmail.com>
6 * @license http://opensource.org/licenses/mit-license.php The MIT License
7 */
8
9 namespace Instagram\Collection;
10
11 /**
12  * Media Search Collection
13  *
14  * Holds a collection of searched media
15  */
16 class MediaSearchCollection extends \Instagram\Collection\CollectionAbstract {
17
18     /**
19      * Next max timestamp for use in pagination
20      *
21      * @var int
22      * @access protected
23      */
24     protected $next_max_timestamp;
25
26     /**
27      * Set the collection data
28      *
29      * @param StdClass $raw_data
30      * @access public
31      */
32     public function setData( $raw_data ) {
33         $this->data = $raw_data->data;
34         $this->convertData( '\Instagram\Media' );
35         $this->next_max_timestamp = count( $this->data ) ? $this->data[ count( $this->data )-1 ]->getCreatedTime() : null;
36     }
37
38     /**
39      * Get next max timestamp
40      *
41      * Get the next max timestamp for use in pagination
42      *
43      * @return string Returns the next max timestamp
44      * @access public
45      */
46     public function getNextMaxTimeStamp() {
47         return $this->next_max_timestamp;
48     }
49
50     /**
51      * Get next max timestamp
52      *
53      * Get the next max timestamp for use in pagination
54      *
55      * @return string Returns the next max timestamp
56      * @access public
57      */
58     public function getNext() {
59         return $this->getNextMaxTimeStamp();
60     }
61
62 }