1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Feed
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Feed Link class.
14 *
15 * @since 12.3
16 */
17 class JFeedLink
18 {
19 /**
20 * The URI to the linked resource.
21 *
22 * @var string
23 * @since 12.3
24 */
25 public $uri;
26
27 /**
28 * The relationship between the feed and the linked resource.
29 *
30 * @var string
31 * @since 12.3
32 */
33 public $relation;
34
35 /**
36 * The resource type.
37 *
38 * @var string
39 * @since 12.3
40 */
41 public $type;
42
43 /**
44 * The language of the resource found at the given URI.
45 *
46 * @var string
47 * @since 12.3
48 */
49 public $language;
50
51 /**
52 * The title of the resource.
53 *
54 * @var string
55 * @since 12.3
56 */
57 public $title;
58
59 /**
60 * The length of the resource in bytes.
61 *
62 * @var integer
63 * @since 12.3
64 */
65 public $length;
66
67 /**
68 * Constructor.
69 *
70 * @param string $uri The URI to the linked resource.
71 * @param string $relation The relationship between the feed and the linked resource.
72 * @param string $type The resource type.
73 * @param string $language The language of the resource found at the given URI.
74 * @param string $title The title of the resource.
75 * @param integer $length The length of the resource in bytes.
76 *
77 * @since 12.3
78 * @throws InvalidArgumentException
79 */
80 public function __construct($uri = null, $relation = null, $type = null, $language = null, $title = null, $length = null)
81 {
82 $this->uri = $uri;
83 $this->relation = $relation;
84 $this->type = $type;
85 $this->language = $language;
86 $this->title = $title;
87
88 // Validate the length input.
89 if (isset($length) && !is_numeric($length))
90 {
91 throw new InvalidArgumentException('Length must be numeric.');
92 }
93
94 $this->length = (int) $length;
95 }
96 }
97