Permalink
Browse files

Strict pear coding standard applied.

  • Loading branch information...
1 parent ae2f0df commit a91e7dfff70f4a1ec32725442990b83e71655e61 Anton Lindqvist committed Mar 16, 2011
Showing with 59 additions and 50 deletions.
  1. +59 −50 Uri.php
View
@@ -1,85 +1,87 @@
<?php
/**
- * URI constructor.
+ * URI constructor
*
- * @package Uri
- * @author Anton Lindqvist <anton@qvister.se>
+ * @category Tools_And_Utilities
+ * @package Uri
+ * @author Anton Lindqvist <anton@qvister.se>
* @copyright 2011 Anton Lindqvist <anton@qvister.se>
- * @license http://www.opensource.org/licenses/mit-license.php MIT
- * @link http://github.com/mptre/php-uri
+ * @license http://www.opensource.org/licenses/mit-license.php MIT
+ * @link http://github.com/mptre/php-uri
*/
-class Uri {
+class Uri
+{
/**
- * URI protocol.
- *
- * @access public
+ * URI protocol
*
* @var string
+ *
+ * @access public
*/
public $protocol;
/**
- * URI username.
- *
- * @access public
+ * URI username
*
* @var string
+ *
+ * @access public
*/
public $username;
/**
- * URI password.
- *
- * @access public
+ * URI password
*
* @var string
+ *
+ * @access public
*/
public $password;
/**
- * URI hostname.
- *
- * @access public
+ * URI hostname
*
* @var string
+ *
+ * @access public
*/
public $host;
/**
- * URI path.
- *
- * @access public
+ * URI path
*
* @var array
+ *
+ * @access public
*/
public $path;
/**
- * URI parameters.
- *
- * @access public
+ * URI parameters
*
* @var array
+ *
+ * @access public
*/
public $parameters;
/**
- * URI hash.
- *
- * @access public
+ * URI hash
*
* @var array
+ *
+ * @access public
*/
public $hash;
/**
- * Default options.
+ * Default options
+ *
+ * @var array
*
* @access private
* @static
- *
- * @var array
*/
private static $_defaultOptions = array(
'encode' => false,
@@ -94,26 +96,27 @@ class Uri {
);
/**
- * Options.
- *
- * @access private
+ * Options
*
* @var array
+ *
+ * @access private
*/
private $_options;
/**
- * Class constructor.
+ * Class constructor
*
- * @access public
- *
- * @param string $host Hostname
- * @param string|array $path Optional path to request either as a string or array
- * @param array $options Optional options
+ * @param string $host Hostname
+ * @param string|array $path Optional path to request as a string or array
+ * @param array $options Optional options
*
* @return void
+ *
+ * @access public
*/
- public function __construct($host, $path = null, $options = array()) {
+ public function __construct($host, $path = null, $options = array())
+ {
$this->host = $host;
$this->path = $path;
$this->_options = array_merge(self::$_defaultOptions, $options);
@@ -122,13 +125,14 @@ public function __construct($host, $path = null, $options = array()) {
}
/**
- * Construct public variables.
- *
- * @access public
+ * Construct public variables
*
* @return void
+ *
+ * @access public
*/
- public function initialize() {
+ public function initialize()
+ {
$this->protocol = $this->_options['protocol'];
$this->protocol .= ($this->_options['ssl']) ? 's' : '';
@@ -141,21 +145,22 @@ public function initialize() {
: '';
$this->path = (is_array($this->path)) ? $this->path : array($this->path);
- $this->path = '/' . implode('/' , array_filter($this->path));
+ $this->path = '/' . implode('/', array_filter($this->path));
$this->parameters = $this->_options['parameters'];
$this->hash = $this->_options['hash'];
}
/**
- * Magic method used for constructing the URI.
- *
- * @access public
+ * Magic method used for constructing the URI
*
* @return string $uri
+ *
+ * @access public
*/
- public function __toString() {
+ public function __toString()
+ {
$uri = $this->protocol;
$uri .= '://';
$uri .= ($this->username) ?: '';
@@ -164,7 +169,11 @@ public function __toString() {
$uri .= $this->host;
$uri .= $this->path;
$uri .= ($this->parameters)
- ? '?' . http_build_query($this->parameters, '', $this->_options['separator'])
+ ? '?' . http_build_query(
+ $this->parameters,
+ '',
+ $this->_options['separator']
+ )
: '';
$uri .= ($this->hash)
? '#' . http_build_query($this->hash, '', $this->_options['separator'])

0 comments on commit a91e7df

Please sign in to comment.