1: <?php
2: /**
3: * A parser for a package 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 package 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_Package 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->n;
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 package license.
67: *
68: * @return string The package license.
69: */
70: public function getLicense()
71: {
72: return (string)$this->l;
73: }
74:
75: /**
76: * Return the package summary.
77: *
78: * @return string The package summary.
79: */
80: public function getSummary()
81: {
82: return (string)$this->s;
83: }
84:
85: /**
86: * Return the package description.
87: *
88: * @return string The package description.
89: */
90: public function getDescription()
91: {
92: return (string)$this->d;
93: }
94: }