1: <?php
2: /**
3: * A parser for a release information response from a PEAR server.
4: *
5: * PHP version 5
6: *
7: * @category Horde
8: * @package Pear
9: * @author Gunnar Wrobel <wrobel@pardus.de>
10: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
11: * @link http://pear.horde.org/index.php?package=Pear
12: */
13:
14: /**
15: * A parser for a release information response from a PEAR server.
16: *
17: * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
18: *
19: * See the enclosed file COPYING for license information (LGPL). If you
20: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21: *
22: * @category Horde
23: * @package Pear
24: * @author Gunnar Wrobel <wrobel@pardus.de>
25: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
26: * @link http://pear.horde.org/index.php?package=Pear
27: */
28: class Horde_Pear_Rest_Release extends Horde_Xml_Element
29: {
30: /**
31: * Constructor.
32: *
33: * @param resource|string $xml The XML document received from the server.
34: */
35: public function __construct($xml)
36: {
37: if (is_resource($xml)) {
38: rewind($xml);
39: $xml = stream_get_contents($xml);
40: }
41: parent::registerNamespace('xlink', 'http://www.w3.org/1999/xlink');
42: parent::__construct($xml);
43: }
44:
45: /**
46: * Return the package name.
47: *
48: * @return string The package name.
49: */
50: public function getName()
51: {
52: return (string)$this->p;
53: }
54:
55: /**
56: * Return the package channel.
57: *
58: * @return string The package channel.
59: */
60: public function getChannel()
61: {
62: return (string)$this->c;
63: }
64:
65: /**
66: * Return the release version.
67: *
68: * @return string The release version.
69: */
70: public function getVersion()
71: {
72: return (string)$this->v;
73: }
74:
75: /**
76: * Return the package license.
77: *
78: * @return string The package license.
79: */
80: public function getLicense()
81: {
82: return (string)$this->l;
83: }
84:
85: /**
86: * Return the package summary.
87: *
88: * @return string The package summary.
89: */
90: public function getSummary()
91: {
92: return (string)$this->s;
93: }
94:
95: /**
96: * Return the package description.
97: *
98: * @return string The package description.
99: */
100: public function getDescription()
101: {
102: return (string)$this->d;
103: }
104:
105: /**
106: * Return the release notes.
107: *
108: * @return string The release notes.
109: */
110: public function getNotes()
111: {
112: return (string)$this->n;
113: }
114:
115: /**
116: * Return the uri for downloading the package.
117: *
118: * @return string The URI.
119: */
120: public function getDownloadUri()
121: {
122: return $this->g . '.tgz';
123: }
124: }