]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - lib/activitystreamslink.php
2c91deda0eabc111264e0f2edb8029dac3d604f7
[quix0rs-gnu-social.git] / lib / activitystreamslink.php
1 <?php
2
3 /**
4  * A class for representing links in JSON Activities
5  *
6  * @category Feed
7  * @package  StatusNet
8  * @author   Zach Copley <zach@status.net>
9  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
10  * @link     http://status.net/
11  */
12
13 class ActivityStreamsLink
14 {
15     private $linkDict;
16
17     function __construct($url = null, $rel = null, $mediaType = null)
18     {
19         // links MUST have a URL
20         if (empty($url)) {
21             throw new Exception('Links must have a URL.');
22         }
23
24         $this->linkDict = array(
25             'url'   => $url,
26             'rel'   => $rel,      // extension
27             'type'  => $mediaType // extension
28         );
29     }
30
31     function asArray()
32     {
33         return array_filter($this->linkDict);
34     }
35 }