]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/jsonactivitycollection.php
Merge remote-tracking branch 'upstream/master'
[quix0rs-gnu-social.git] / lib / jsonactivitycollection.php
1 <?php
2
3 /*
4  * Collection primarily as the root of an Activity Streams doc but can be used as the value
5  * of extension properties in a variety of situations.
6  *
7  * A valid Collection object serialization MUST contain at least the url or items properties.
8  */
9 class JSONActivityCollection {
10
11     /* Non-negative integer specifying the total number of activities within the stream */
12     protected $totalItems;
13
14     /* An array containing a listing of Objects of any object type */
15     protected $items;
16
17     /* IRI referencing a JSON document containing the full listing of objects in the collection */
18     protected $url;
19
20     /**
21      * Constructor
22      *
23      * @param array  $items       array of activity items
24      * @param string $url         url of a doc list all the objs in the collection
25      * @param int    $totalItems  total number of items in the collection
26      */
27     function __construct($items = null, $url = null)
28     {
29         $this->items      = empty($items) ? array() : $items;
30         $this->totalItems = count($items);
31         $this->url        = $url;
32     }
33
34     /**
35      * Get the total number of items in the collection
36      *
37      * @return int total the total
38      */
39     public function getTotalItems()
40     {
41         $this->totalItems = count($items);
42         return $this->totalItems;
43     }
44 }