1 <?php
2 /**
3 * Part of the Joomla Framework Uri Package
4 *
5 * @copyright Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved.
6 * @license GNU General Public License version 2 or later; see LICENSE
7 */
8
9 namespace Joomla\Uri;
10
11 /**
12 * Uri Interface
13 *
14 * Interface for read-only access to Uris.
15 *
16 * @since 1.0
17 */
18 interface UriInterface
19 {
20 /**
21 * Magic method to get the string representation of the URI object.
22 *
23 * @return string
24 *
25 * @since 1.0
26 */
27 public function __toString();
28
29 /**
30 * Returns full uri string.
31 *
32 * @param array $parts An array specifying the parts to render.
33 *
34 * @return string The rendered URI string.
35 *
36 * @since 1.0
37 */
38 public function toString(array $parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'));
39
40 /**
41 * Checks if variable exists.
42 *
43 * @param string $name Name of the query variable to check.
44 *
45 * @return boolean True if the variable exists.
46 *
47 * @since 1.0
48 */
49 public function hasVar($name);
50
51 /**
52 * Returns a query variable by name.
53 *
54 * @param string $name Name of the query variable to get.
55 * @param string $default Default value to return if the variable is not set.
56 *
57 * @return array Query variables.
58 *
59 * @since 1.0
60 */
61 public function getVar($name, $default = null);
62
63 /**
64 * Returns flat query string.
65 *
66 * @param boolean $toArray True to return the query as a key => value pair array.
67 *
68 * @return string Query string.
69 *
70 * @since 1.0
71 */
72 public function getQuery($toArray = false);
73
74 /**
75 * Get URI scheme (protocol)
76 * ie. http, https, ftp, etc...
77 *
78 * @return string The URI scheme.
79 *
80 * @since 1.0
81 */
82 public function getScheme();
83
84 /**
85 * Get URI username
86 * Returns the username, or null if no username was specified.
87 *
88 * @return string The URI username.
89 *
90 * @since 1.0
91 */
92 public function getUser();
93
94 /**
95 * Get URI password
96 * Returns the password, or null if no password was specified.
97 *
98 * @return string The URI password.
99 *
100 * @since 1.0
101 */
102 public function getPass();
103
104 /**
105 * Get URI host
106 * Returns the hostname/ip or null if no hostname/ip was specified.
107 *
108 * @return string The URI host.
109 *
110 * @since 1.0
111 */
112 public function getHost();
113
114 /**
115 * Get URI port
116 * Returns the port number, or null if no port was specified.
117 *
118 * @return integer The URI port number.
119 *
120 * @since 1.0
121 */
122 public function getPort();
123
124 /**
125 * Gets the URI path string.
126 *
127 * @return string The URI path string.
128 *
129 * @since 1.0
130 */
131 public function getPath();
132
133 /**
134 * Get the URI archor string
135 * Everything after the "#".
136 *
137 * @return string The URI anchor string.
138 *
139 * @since 1.0
140 */
141 public function getFragment();
142
143 /**
144 * Checks whether the current URI is using HTTPS.
145 *
146 * @return boolean True if using SSL via HTTPS.
147 *
148 * @since 1.0
149 */
150 public function isSSL();
151 }
152