From 7fb12ddbbc4b9ed70f73f79d065baa74bfe0db47 Mon Sep 17 00:00:00 2001 From: ThomasW Date: Tue, 26 Jul 2011 08:51:44 +0200 Subject: [PATCH] [hotfix/ZF-11122] Documentation - fixed year within copyright headers --- .../Gdata/3LeggedOAuth/Gdata_OAuth_Helper.php | 2 +- library/Zend/Config/Json.php | 8 +- library/Zend/Config/Writer/Json.php | 4 +- library/Zend/Config/Writer/Yaml.php | 4 +- library/Zend/GData/Spreadsheets.php | 32 +- .../Uri/Exception/InvalidUriException.php | 10 +- .../Uri/Exception/InvalidUriTypeException.php | 10 +- library/Zend/Uri/File.php | 30 +- library/Zend/Uri/Http.php | 38 +- library/Zend/Uri/Mailto.php | 32 +- library/Zend/Uri/Uri.php | 592 +++++++++--------- library/Zend/Uri/UriFactory.php | 40 +- tests/Zend/Config/YamlTest.php | 4 +- tests/Zend/Uri/FileTest.php | 20 +- tests/Zend/Uri/HttpTest.php | 28 +- tests/Zend/Uri/MailtoTest.php | 22 +- tests/Zend/Uri/UriTest.php | 394 ++++++------ 17 files changed, 635 insertions(+), 635 deletions(-) mode change 100755 => 100644 demos/Zend/Gdata/3LeggedOAuth/Gdata_OAuth_Helper.php mode change 100755 => 100644 library/Zend/Config/Json.php mode change 100755 => 100644 library/Zend/Config/Writer/Json.php mode change 100755 => 100644 library/Zend/Config/Writer/Yaml.php mode change 100755 => 100644 tests/Zend/Config/YamlTest.php diff --git a/demos/Zend/Gdata/3LeggedOAuth/Gdata_OAuth_Helper.php b/demos/Zend/Gdata/3LeggedOAuth/Gdata_OAuth_Helper.php old mode 100755 new mode 100644 index afcbda317d8..c0209955d30 --- a/demos/Zend/Gdata/3LeggedOAuth/Gdata_OAuth_Helper.php +++ b/demos/Zend/Gdata/3LeggedOAuth/Gdata_OAuth_Helper.php @@ -10,7 +10,7 @@ * @category Zend * @package Zend_Gdata * @subpackage Demos - * @copyright Copyright (c) 2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Config/Json.php b/library/Zend/Config/Json.php old mode 100755 new mode 100644 index 97a61d30bd4..5be2506014e --- a/library/Zend/Config/Json.php +++ b/library/Zend/Config/Json.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -27,7 +27,7 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Json extends Config @@ -229,8 +229,8 @@ protected function _getConstants() /** * Flatten JSON object structure to associative array - * - * @param object|array $config + * + * @param object|array $config * @return array */ protected function flattenObjects($config) diff --git a/library/Zend/Config/Writer/Json.php b/library/Zend/Config/Writer/Json.php old mode 100755 new mode 100644 index aafbc0907bf..4cdd4dcfb2e --- a/library/Zend/Config/Writer/Json.php +++ b/library/Zend/Config/Writer/Json.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -26,7 +26,7 @@ /** * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Json extends AbstractFileWriter diff --git a/library/Zend/Config/Writer/Yaml.php b/library/Zend/Config/Writer/Yaml.php old mode 100755 new mode 100644 index 438fefcd8b6..1e2e9ff0253 --- a/library/Zend/Config/Writer/Yaml.php +++ b/library/Zend/Config/Writer/Yaml.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -27,7 +27,7 @@ /** * @category Zend * @package Zend_Config - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Yaml extends AbstractFileWriter diff --git a/library/Zend/GData/Spreadsheets.php b/library/Zend/GData/Spreadsheets.php index a130a1b92db..6746dcc30f0 100644 --- a/library/Zend/GData/Spreadsheets.php +++ b/library/Zend/GData/Spreadsheets.php @@ -29,22 +29,22 @@ * * @link http://code.google.com/apis/gdata/spreadsheets.html * - * @uses \Zend\GData\GData - * @uses \Zend\GData\Spreadsheets\CellEntry - * @uses \Zend\GData\Spreadsheets\CellFeed - * @uses \Zend\GData\Spreadsheets\CellQuery - * @uses \Zend\GData\Spreadsheets\DocumentQuery - * @uses \Zend\GData\Spreadsheets\ListEntry - * @uses \Zend\GData\Spreadsheets\ListFeed - * @uses \Zend\GData\Spreadsheets\ListQuery - * @uses \Zend\GData\Spreadsheets\SpreadsheetEntry - * @uses \Zend\GData\Spreadsheets\SpreadsheetFeed - * @uses \Zend\GData\Spreadsheets\WorksheetEntry - * @category Zend - * @package Zend_Gdata - * @subpackage Spreadsheets - * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License + * @uses \Zend\GData\GData + * @uses \Zend\GData\Spreadsheets\CellEntry + * @uses \Zend\GData\Spreadsheets\CellFeed + * @uses \Zend\GData\Spreadsheets\CellQuery + * @uses \Zend\GData\Spreadsheets\DocumentQuery + * @uses \Zend\GData\Spreadsheets\ListEntry + * @uses \Zend\GData\Spreadsheets\ListFeed + * @uses \Zend\GData\Spreadsheets\ListQuery + * @uses \Zend\GData\Spreadsheets\SpreadsheetEntry + * @uses \Zend\GData\Spreadsheets\SpreadsheetFeed + * @uses \Zend\GData\Spreadsheets\WorksheetEntry + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License */ class Spreadsheets extends GData { diff --git a/library/Zend/Uri/Exception/InvalidUriException.php b/library/Zend/Uri/Exception/InvalidUriException.php index 0f2f7fabba6..6ab230ca3f2 100644 --- a/library/Zend/Uri/Exception/InvalidUriException.php +++ b/library/Zend/Uri/Exception/InvalidUriException.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -31,12 +31,12 @@ * @uses \Zend\URI\Exception * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class InvalidUriException - extends \InvalidArgumentException +class InvalidUriException + extends \InvalidArgumentException implements \Zend\Uri\Exception { - + } diff --git a/library/Zend/Uri/Exception/InvalidUriTypeException.php b/library/Zend/Uri/Exception/InvalidUriTypeException.php index 5111d727b28..4943eb243e2 100644 --- a/library/Zend/Uri/Exception/InvalidUriTypeException.php +++ b/library/Zend/Uri/Exception/InvalidUriTypeException.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -31,12 +31,12 @@ * @uses \Zend\URI\Exception * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class InvalidUriTypeException - extends \InvalidArgumentException +class InvalidUriTypeException + extends \InvalidArgumentException implements \Zend\Uri\Exception { - + } diff --git a/library/Zend/Uri/File.php b/library/Zend/Uri/File.php index 3f4389401db..5d884dff6df 100644 --- a/library/Zend/Uri/File.php +++ b/library/Zend/Uri/File.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -27,10 +27,10 @@ * File URI handler * * The 'file:...' scheme is loosly defined in RFC-1738 - * + * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class File extends Uri @@ -39,10 +39,10 @@ class File extends Uri /** * Check if the URI is a valid File URI - * - * This applies additional specific validation rules beyond the ones + * + * This applies additional specific validation rules beyond the ones * required by the generic URI syntax. - * + * * @return boolean * @see Uri::isValid() */ @@ -54,10 +54,10 @@ public function isValid() return parent::isValid(); } - + /** * User Info part is not used in file URIs - * + * * @see Uri::setUserInfo() * @throws Exception\InvalidUriPartException */ @@ -65,10 +65,10 @@ public function setUserInfo($userInfo) { return $this; } - + /** * Fragment part is not used in file URIs - * + * * @see Uri::setFragment() * @throws Exception\InvalidUriPartException */ @@ -76,10 +76,10 @@ public function setFragment($fragment) { return $this; } - + /** * Convert a UNIX file path to a valid file:// URL - * + * * @param string $path * @return File */ @@ -93,10 +93,10 @@ public static function fromUnixPath($path) $url->setPath($path); return $url; } - + /** * Convert a Windows file path to a valid file:// URL - * + * * @param string $path * @return File */ @@ -106,7 +106,7 @@ public static function fromWindowsPath($path) // Convert directory separators $path = str_replace(array('/', '\\'), array('%2F', '/'), $path); - + // Is this an absolute path? if (preg_match('|^([a-zA-Z]:)?/|', $path)) { $url->setHost(''); diff --git a/library/Zend/Uri/Http.php b/library/Zend/Uri/Http.php index 1007876584d..08087c8edc0 100644 --- a/library/Zend/Uri/Http.php +++ b/library/Zend/Uri/Http.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -28,7 +28,7 @@ * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Http extends Uri @@ -37,7 +37,7 @@ class Http extends Uri * @see Uri::$validSchemes */ protected static $validSchemes = array('http', 'https'); - + /** * @see Uri::$defaultPorts */ @@ -45,7 +45,7 @@ class Http extends Uri 'http' => 80, 'https' => 443, ); - + /** * @see Uri::$validHostTypes */ @@ -62,13 +62,13 @@ class Http extends Uri * @var null|string */ protected $password; - + /** * Check if the URI is a valid HTTP URI - * - * This applys additional HTTP specific validation rules beyond the ones + * + * This applys additional HTTP specific validation rules beyond the ones * required by the generic URI syntax - * + * * @return boolean * @see Uri::isValid() */ @@ -79,7 +79,7 @@ public function isValid() /** * Get the username part (before the ':') of the userInfo URI part - * + * * @return null|string */ public function getUser() @@ -91,10 +91,10 @@ public function getUser() $this->parseUserInfo(); return $this->user; } - + /** * Get the password part (after the ':') of the userInfo URI part - * + * * @return string */ public function getPassword() @@ -109,7 +109,7 @@ public function getPassword() /** * Set the username part (before the ':') of the userInfo URI part - * + * * @param string $user * @return Http */ @@ -118,10 +118,10 @@ public function setUser($user) $this->user = $user; return $this; } - + /** * Set the password part (after the ':') of the userInfo URI part - * + * * @param string $password * @return Http */ @@ -130,13 +130,13 @@ public function setPassword($password) $this->password = $password; return $this; } - + /** * Validate the host part of an HTTP URI - * + * * This overrides the common URI validation method with a DNS or IPv4 only * default. Users may still enforce allowing other host types. - * + * * @param string $host * @param integer $allowed * @return boolean @@ -149,9 +149,9 @@ public static function validateHost($host, $allowed = self::HOST_DNSORIPV4) /** * Parse the user info into username and password segments * - * Parses the user information into username and password segments, and + * Parses the user information into username and password segments, and * then sets the appropriate values. - * + * * @return void */ protected function parseUserInfo() diff --git a/library/Zend/Uri/Mailto.php b/library/Zend/Uri/Mailto.php index 10b558e1d24..18d5a54b4df 100644 --- a/library/Zend/Uri/Mailto.php +++ b/library/Zend/Uri/Mailto.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -30,10 +30,10 @@ * "Mailto" URI handler * * The 'mailto:...' scheme is loosly defined in RFC-1738 - * + * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Mailto extends Uri @@ -45,13 +45,13 @@ class Mailto extends Uri * @var Validator */ protected $emailValidator; - + /** * Check if the URI is a valid Mailto URI - * - * This applys additional specific validation rules beyond the ones + * + * This applys additional specific validation rules beyond the ones * required by the generic URI syntax - * + * * @return boolean * @see Uri::isValid() */ @@ -72,12 +72,12 @@ public function isValid() $validator = $this->getValidator(); return $validator->isValid($this->path); } - + /** * Set the email address - * + * * This is infact equivalent to setPath() - but provides a more clear interface - * + * * @param string $email * @return Mailto */ @@ -85,12 +85,12 @@ public function setEmail($email) { return $this->setPath($email); } - + /** * Get the email address - * + * * This is infact equivalent to getPath() - but provides a more clear interface - * + * * @return string */ public function getEmail() @@ -100,8 +100,8 @@ public function getEmail() /** * Set validator to use when validating email address - * - * @param Validator $validator + * + * @param Validator $validator * @return Mailto */ public function setValidator(Validator $validator) @@ -115,7 +115,7 @@ public function setValidator(Validator $validator) * * If none is currently set, an EmailValidator instance with default options * will be used. - * + * * @return Validator */ public function getValidator() diff --git a/library/Zend/Uri/Uri.php b/library/Zend/Uri/Uri.php index 9f866cd78f3..e1efa67c104 100644 --- a/library/Zend/Uri/Uri.php +++ b/library/Zend/Uri/Uri.php @@ -14,7 +14,7 @@ * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -31,7 +31,7 @@ * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Uri @@ -43,64 +43,64 @@ class Uri const CHAR_GEN_DELIMS = ':\/\?#\[\]@'; const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='; const CHAR_RESERVED = ':\/\?#\[\]@!\$&\'\(\)\*\+,;='; - + /** * Host part types */ const HOST_IPV4 = 1; const HOST_IPV6 = 2; const HOST_IPVF = 4; - const HOST_IPVANY = 7; + const HOST_IPVANY = 7; const HOST_DNSNAME = 8; - const HOST_DNSORIPV4 = 9; + const HOST_DNSORIPV4 = 9; const HOST_REGNAME = 16; const HOST_ALL = 31; - + /** - * URI scheme - * + * URI scheme + * * @var string */ protected $scheme; - + /** * URI userInfo part (usually user:password in HTTP URLs) - * + * * @var string */ protected $userInfo; - + /** * URI hostname - * + * * @var string */ protected $host; - + /** * URI port - * + * * @var integer */ protected $port; - + /** * URI path - * + * * @var string */ protected $path; - + /** * URI query string - * + * * @var string */ protected $query; - + /** * URI fragment - * + * * @var string */ protected $fragment; @@ -111,36 +111,36 @@ class Uri * @var integer */ protected $validHostTypes = self::HOST_ALL; - + /** * Array of valid schemes. - * + * * Subclasses of this class that only accept specific schemes may set the * list of accepted schemes here. If not empty, when setScheme() is called - * it will only accept the schemes listed here. + * it will only accept the schemes listed here. * * @var array */ protected static $validSchemes = array(); - + /** * List of default ports per scheme - * + * * Inheriting URI classes may set this, and the normalization methods will * automatically remove the port if it is equal to the default port for the * current scheme - * + * * @var array */ protected static $defaultPorts = array(); - + /** * Create a new URI object - * + * * @param \Zend\Uri\Uri|string|null $uri * @throws Exception\InvalidArgumentException */ - public function __construct($uri = null) + public function __construct($uri = null) { if (is_string($uri)) { $this->parse($uri); @@ -163,16 +163,16 @@ public function __construct($uri = null) /** * Check if the URI is valid - * + * * Note that a relative URI may still be valid - * + * * @return boolean */ public function isValid() { if ($this->host) { if (strlen($this->path) > 0 && substr($this->path, 0, 1) != '/') { - return false; + return false; } return true; } @@ -180,33 +180,33 @@ public function isValid() if ($this->userInfo || $this->port) { return false; } - - if ($this->path) { + + if ($this->path) { // Check path-only (no host) URI if (substr($this->path, 0, 2) == '//') { - return false; + return false; } return true; - } + } if (! ($this->query || $this->fragment)) { - // No host, path, query or fragment - this is not a valid URI + // No host, path, query or fragment - this is not a valid URI return false; } - + return true; } - + /** * Check if the URI is an absolute or relative URI - * + * * @return boolean */ public function isAbsolute() { return ($this->scheme !== null); } - + /** * Parse a URI string * @@ -216,16 +216,16 @@ public function isAbsolute() public function parse($uri) { // Capture scheme - if (($scheme = self::parseScheme($uri)) !== null) { + if (($scheme = self::parseScheme($uri)) !== null) { $this->setScheme($scheme); $uri = substr($uri, strlen($scheme) + 1); } - + // Capture authority part if (preg_match('|^//([^/\?#]*)|', $uri, $match)) { $authority = $match[1]; $uri = substr($uri, strlen($match[0])); - + // Split authority into userInfo and host if (strpos($authority, '@') !== false) { // The userInfo can also contain '@' symbols; split $authority @@ -236,7 +236,7 @@ public function parse($uri) unset($segments); $this->setUserInfo($userInfo); } - + $colonPos = strrpos($authority, ':'); if ($colonPos !== false) { $port = substr($authority, $colonPos + 1); @@ -245,14 +245,14 @@ public function parse($uri) } $authority = substr($authority, 0, $colonPos); } - + $this->setHost($authority); } if (!$uri) { return $this; } - + // Capture the path if (preg_match('|^[^\?#]*|', $uri, $match)) { $this->setPath($match[0]); @@ -261,7 +261,7 @@ public function parse($uri) if (!$uri) { return $this; } - + // Capture the query if (preg_match('|^\?([^#]*)|', $uri, $match)) { $this->setQuery($match[1]); @@ -270,18 +270,18 @@ public function parse($uri) if (!$uri) { return $this; } - + // All that's left is the fragment if ($uri && substr($uri, 0, 1) == '#') { $this->setFragment(substr($uri, 1)); } - + return $this; } /** * Compose the URI into a string - * + * * @return string */ public function toString() @@ -289,13 +289,13 @@ public function toString() if (!$this->isValid()) { throw new Exception\InvalidUriException('URI is not valid and cannot be converted into a string'); } - + $uri = ''; if ($this->scheme) { - $uri .= $this->scheme . ':'; + $uri .= $this->scheme . ':'; } - + if ($this->host !== null) { $uri .= '//'; if ($this->userInfo) { @@ -312,7 +312,7 @@ public function toString() } elseif ($this->host && ($this->query || $this->fragment)) { $uri .= '/'; } - + if ($this->query) { $uri .= "?" . self::encodeQueryFragment($this->query); } @@ -323,64 +323,64 @@ public function toString() return $uri; } - + /** * Normalize the URI - * - * Normalizing a URI includes removing any redundant parent directory or + * + * Normalizing a URI includes removing any redundant parent directory or * current directory references from the path (e.g. foo/bar/../baz becomes - * foo/baz), normalizing the scheme case, decoding any over-encoded - * characters etc. - * - * Eventually, two normalized URLs pointing to the same resource should be - * equal even if they were originally represented by two different strings - * + * foo/baz), normalizing the scheme case, decoding any over-encoded + * characters etc. + * + * Eventually, two normalized URLs pointing to the same resource should be + * equal even if they were originally represented by two different strings + * * @return Uri */ public function normalize() { - if ($this->scheme) { + if ($this->scheme) { $this->scheme = static::normalizeScheme($this->scheme); } - - if ($this->host) { + + if ($this->host) { $this->host = static::normalizeHost($this->host); } - - if ($this->port) { + + if ($this->port) { $this->port = static::normalizePort($this->port, $this->scheme); } - - if ($this->path) { + + if ($this->path) { $this->path = static::normalizePath($this->path); } - - if ($this->query) { + + if ($this->query) { $this->query = static::normalizeQuery($this->query); } - - if ($this->fragment) { + + if ($this->fragment) { $this->fragment = static::normalizeFragment($this->fragment); } - + // If path is empty (and we have a host), path should be '/' - if ($this->host && empty($this->path)) { + if ($this->host && empty($this->path)) { $this->path = '/'; } - + return $this; } - + /** - * Convert a relative URI into an absolute URI using a base absolute URI as + * Convert a relative URI into an absolute URI using a base absolute URI as * a reference. - * - * This is similar to merge() - only it uses the supplied URI as the + * + * This is similar to merge() - only it uses the supplied URI as the * base reference instead of using the current URI as the base reference. - * - * Merging algorithm is adapted from RFC-3986 section 5.2 + * + * Merging algorithm is adapted from RFC-3986 section 5.2 * (@link http://tools.ietf.org/html/rfc3986#section-5.2) - * + * * @param Uri|string $baseUri * @return Uri */ @@ -390,22 +390,22 @@ public function resolve($baseUri) if ($this->isAbsolute()) { return $this; } - + if (is_string($baseUri)) { $baseUri = new static($baseUri); } - + if (!$baseUri instanceof static) { throw new Exception\InvalidUriTypeException(sprintf( 'Provided base URL is not an instance of "%s"', get_class($this) )); } - + // Merging starts here... if ($this->getHost()) { $this->setPath(static::removePathDotSegments($this->getPath())); - } else { + } else { $basePath = $baseUri->getPath(); $relPath = $this->getPath(); if (!$relPath) { @@ -425,80 +425,80 @@ public function resolve($baseUri) $this->setPath(static::removePathDotSegments($mergedPath . $relPath)); } } - + // Set the authority part $this->setUserInfo($baseUri->getUserInfo()); $this->setHost($baseUri->getHost()); $this->setPort($baseUri->getPort()); } - + $this->setScheme($baseUri->getScheme()); return $this; - } - + } + /** * Convert the link to a relative link by substracting a base URI - * - * This is the opposite of resolving a relative link - i.e. creating a - * relative reference link from an original URI and a base URI. - * + * + * This is the opposite of resolving a relative link - i.e. creating a + * relative reference link from an original URI and a base URI. + * * If the two URIs do not intersect (e.g. the original URI is not in any - * way related to the base URI) the URI will not be modified. - * - * @param Uri|string $baseUri + * way related to the base URI) the URI will not be modified. + * + * @param Uri|string $baseUri * @return Uri */ public function makeRelative($baseUri) { // Copy base URI, we should not modify it $baseUri = new static($baseUri); - + $this->normalize(); $baseUri->normalize(); - + $host = $this->getHost(); $baseHost = $baseUri->getHost(); if ($host && $baseHost && ($host != $baseHost)) { - // Not the same hostname - return $this; + // Not the same hostname + return $this; } - + $port = $this->getPort(); $basePort = $baseUri->getPort(); if ($port && $basePort && ($port != $basePort)) { // Not the same port return $this; } - + $scheme = $this->getScheme(); $baseScheme = $baseUri->getScheme(); if ($scheme && $baseScheme && ($scheme != $baseScheme)) { - // Not the same scheme (e.g. HTTP vs. HTTPS) + // Not the same scheme (e.g. HTTP vs. HTTPS) return $this; } - + // Remove host, port and scheme $this->setHost(null) ->setPort(null) ->setScheme(null); - - // Is path the same? - if ($this->getPath() == $baseUri->getPath()) { + + // Is path the same? + if ($this->getPath() == $baseUri->getPath()) { $this->setPath(''); return $this; } - + $pathParts = preg_split('|(/)|', $this->getPath(), null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $baseParts = preg_split('|(/)|', $baseUri->getPath(), null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); - - // Get the intersection of existing path parts and those from the + + // Get the intersection of existing path parts and those from the // provided URI $matchingParts = array_intersect_assoc($pathParts, $baseParts); // Loop through the matches foreach ($matchingParts as $index => $segment) { - // If we skip an index at any point, we have parent traversal, and + // If we skip an index at any point, we have parent traversal, and // need to prepend the path accordingly if ($index && !isset($matchingParts[$index - 1])) { array_unshift($pathParts, '../'); @@ -514,10 +514,10 @@ public function makeRelative($baseUri) return $this; } - + /** - * Get the scheme part of the URI - * + * Get the scheme part of the URI + * * @return string|null */ public function getScheme() @@ -527,7 +527,7 @@ public function getScheme() /** * Get the User-info (usually user:password) part - * + * * @return string|null */ public function getUserInfo() @@ -537,7 +537,7 @@ public function getUserInfo() /** * Get the URI host - * + * * @return string|null */ public function getHost() @@ -547,7 +547,7 @@ public function getHost() /** * Get the URI port - * + * * @return integer|null */ public function getPort() @@ -557,7 +557,7 @@ public function getPort() /** * Get the URI path - * + * * @return string|null */ public function getPath() @@ -567,20 +567,20 @@ public function getPath() /** * Get the URI query - * + * * @return string|null */ public function getQuery() { return $this->query; } - + /** * Return the query string as an associative array of key => value pairs * * This is an extension to RFC-3986 but is quite useful when working with * most common URI types - * + * * @return array */ public function getQueryAsArray() @@ -589,13 +589,13 @@ public function getQueryAsArray() if ($this->query) { parse_str($this->query, $query); } - + return $query; } /** * Get the URI fragment - * + * * @return string|null */ public function getFragment() @@ -603,17 +603,17 @@ public function getFragment() return $this->fragment; } - /** - * Set the URI scheme - * - * If the scheme is not valid according to the generic scheme syntax or - * is not acceptable by the specific URI class (e.g. 'http' or 'https' are - * the only acceptable schemes for the Zend\Uri\Http class) an exception - * will be thrown. - * - * You can check if a scheme is valid before setting it using the - * validateScheme() method. - * + /** + * Set the URI scheme + * + * If the scheme is not valid according to the generic scheme syntax or + * is not acceptable by the specific URI class (e.g. 'http' or 'https' are + * the only acceptable schemes for the Zend\Uri\Http class) an exception + * will be thrown. + * + * You can check if a scheme is valid before setting it using the + * validateScheme() method. + * * @param string $scheme * @throws Exception\InvalidUriPartException * @return Uri @@ -622,19 +622,19 @@ public function setScheme($scheme) { if (($scheme !== null) && (!self::validateScheme($scheme))) { throw new Exception\InvalidUriPartException(sprintf( - 'Scheme "%s" is not valid or is not accepted by %s', + 'Scheme "%s" is not valid or is not accepted by %s', $scheme, get_class($this) ), Exception\InvalidUriPartException::INVALID_SCHEME); } - + $this->scheme = $scheme; return $this; } /** * Set the URI User-info part (usually user:password) - * + * * @param string $userInfo * @return Uri */ @@ -646,25 +646,25 @@ public function setUserInfo($userInfo) /** * Set the URI host - * + * * Note that the generic syntax for URIs allows using host names which - * are not neceserily IPv4 addresses or valid DNS host names. For example, + * are not neceserily IPv4 addresses or valid DNS host names. For example, * IPv6 addresses are allowed as well, and also an abstract "registered name" - * which may be any name composed of a valid set of characters, including, + * which may be any name composed of a valid set of characters, including, * for example, tilda (~) and underscore (_) which are not allowed in DNS - * names. - * - * Subclasses of Uri may impose more strict validation of host names - for - * example the HTTP RFC clearly states that only IPv4 and valid DNS names - * are allowed in HTTP URIs. - * + * names. + * + * Subclasses of Uri may impose more strict validation of host names - for + * example the HTTP RFC clearly states that only IPv4 and valid DNS names + * are allowed in HTTP URIs. + * * @param string $host * @return Uri */ public function setHost($host) { - if (($host !== '') - && ($host !== null) + if (($host !== '') + && ($host !== null) && !self::validateHost($host, $this->validHostTypes) ) { throw new Exception\InvalidUriPartException(sprintf( @@ -673,14 +673,14 @@ public function setHost($host) get_class($this) ), Exception\InvalidUriPartException::INVALID_HOSTNAME); } - + $this->host = $host; return $this; } /** * Set the port part of the URI - * + * * @param integer $port * @return Uri */ @@ -692,7 +692,7 @@ public function setPort($port) /** * Set the path - * + * * @param string $path * @return Uri */ @@ -704,29 +704,29 @@ public function setPath($path) /** * Set the query string - * - * If an array is provided, will encode this array of parameters into a + * + * If an array is provided, will encode this array of parameters into a * query string. Array values will be represented in the query string using - * PHP's common square bracket notation. - * + * PHP's common square bracket notation. + * * @param string|array $query * @return Uri */ public function setQuery($query) { if (is_array($query)) { - // We replace the + used for spaces by http_build_query with the - // more standard %20. + // We replace the + used for spaces by http_build_query with the + // more standard %20. $query = str_replace('+', '%20', http_build_query($query)); } - + $this->query = $query; return $this; } /** * Set the URI fragment part - * + * * @param string $fragment * @return Uri */ @@ -738,46 +738,46 @@ public function setFragment($fragment) /** * Magic method to convert the URI to a string - * + * * @return string */ - public function __toString() + public function __toString() { try { return $this->toString(); - } catch (\Exception $e) { + } catch (\Exception $e) { return ''; } } - + /** * Encoding and Validation Methods */ /** * Check if a scheme is valid or not - * + * * Will check $scheme to be valid against the generic scheme syntax defined * in RFC-3986. If the class also defines specific acceptable schemes, will * also check that $scheme is one of them. - * + * * @param string $scheme * @return boolean */ public static function validateScheme($scheme) { - if (!empty(static::$validSchemes) + if (!empty(static::$validSchemes) && !in_array(strtolower($scheme), static::$validSchemes) ) { return false; } - + return (bool) preg_match('/^[A-Za-z][A-Za-z0-9\-\.+]*$/', $scheme); } - + /** * Check that the userInfo part of a URI is valid - * + * * @param string $userInfo * @return boolean */ @@ -786,74 +786,74 @@ public static function validateUserInfo($userInfo) $regex = '/^(?:[' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ':]+|%[A-Fa-f0-9]{2})*$/'; return (boolean) preg_match($regex, $userInfo); } - + /** * Validate the host part - * + * * Users may control which host types to allow by passing a second parameter * with a bitmask of HOST_* constants which are allowed. If not specified, - * all address types will be allowed. - * - * Note that the generic URI syntax allows different host representations, - * including IPv4 addresses, IPv6 addresses and future IP address formats - * enclosed in square brackets, and registered names which may be DNS names - * or even more complex names. This is different (and is much more loose) + * all address types will be allowed. + * + * Note that the generic URI syntax allows different host representations, + * including IPv4 addresses, IPv6 addresses and future IP address formats + * enclosed in square brackets, and registered names which may be DNS names + * or even more complex names. This is different (and is much more loose) * from what is commonly accepted as valid HTTP URLs for example. - * + * * @param string $host - * @param integer $allowed bitmask of allowed host types + * @param integer $allowed bitmask of allowed host types * @return boolean */ public static function validateHost($host, $allowed = self::HOST_ALL) { - if ($allowed & self::HOST_REGNAME) { + if ($allowed & self::HOST_REGNAME) { if (static::isValidRegName($host)) { return true; } } - - if ($allowed & self::HOST_DNSNAME) { + + if ($allowed & self::HOST_DNSNAME) { if (static::isValidDnsHostname($host)) { return true; } } - + if ($allowed & self::HOST_IPVANY) { if (static::isValidIpAddress($host, $allowed)) { - return true; + return true; } } - + return false; } - + /** - * Validate the port - * + * Validate the port + * * Valid values include numbers between 1 and 65535, and empty values - * + * * @param integer $port * @return boolean */ public static function validatePort($port) { if ($port === 0) { - return false; + return false; } - + if ($port) { $port = (int) $port; if ($port < 1 || $port > 0xffff) { return false; } } - + return true; } - + /** - * Validate the path - * + * Validate the path + * * @param string $path * @return boolean */ @@ -867,25 +867,25 @@ public static function validatePath($path) /** * Check if a URI query or fragment part is valid or not - * - * Query and Fragment parts are both restricted by the same syntax rules, - * so the same validation method can be used for both. - * + * + * Query and Fragment parts are both restricted by the same syntax rules, + * so the same validation method can be used for both. + * * You can encode a query or fragment part to ensure it is valid by passing * it through the encodeQueryFragment() method. - * + * * @param string $input - * @return boolean + * @return boolean */ public static function validateQueryFragment($input) { $regex = '/^(?:[' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ':@\/\?]+|%[A-Fa-f0-9]{2})*$/'; return (boolean) preg_match($regex, $input); } - + /** - * URL-encode the user info part of a URI - * + * URL-encode the user info part of a URI + * * @param string $userInfo * @return string * @throws Exception\InvalidArgumentException @@ -898,21 +898,21 @@ public static function encodeUserInfo($userInfo) (is_object($userInfo) ? get_class($userInfo) : gettype($userInfo)) )); } - - $regex = '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:]|%(?![A-Fa-f0-9]{2}))/'; + + $regex = '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:]|%(?![A-Fa-f0-9]{2}))/'; $replace = function($match) { return rawurlencode($match[0]); }; - + return preg_replace_callback($regex, $replace, $userInfo); } - + /** * Encode the path - * + * * Will replace all characters which are not strictly allowed in the path * part with percent-encoded representation - * + * * @param string $path * @return string */ @@ -923,23 +923,23 @@ public static function encodePath($path) 'Expecting a string, got %s', (is_object($path) ? get_class($path) : gettype($path)) )); - } - + } + $regex = '/(?:[^' . self::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/'; $replace = function($match) { return rawurlencode($match[0]); }; - + return preg_replace_callback($regex, $replace, $path); } - + /** - * URL-encode a query string or fragment based on RFC-3986 guidelines. - * - * Note that query and fragment encoding allows more unencoded characters - * than the usual rawurlencode() function would usually return - for example + * URL-encode a query string or fragment based on RFC-3986 guidelines. + * + * Note that query and fragment encoding allows more unencoded characters + * than the usual rawurlencode() function would usually return - for example * '/' and ':' are allowed as literals. - * + * * @param string $input * @return string */ @@ -950,26 +950,26 @@ public static function encodeQueryFragment($input) 'Expecting a string, got %s', (is_object($input) ? get_class($input) : gettype($input)) )); - } - - $regex = '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/'; + } + + $regex = '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/'; $replace = function($match) { return rawurlencode($match[0]); }; - + return preg_replace_callback($regex, $replace, $input); } - + /** - * Extract only the scheme part out of a URI string. - * + * Extract only the scheme part out of a URI string. + * * This is used by the parse() method, but is useful as a standalone public * method if one wants to test a URI string for it's scheme before doing * anything with it. - * - * Will return the scmeme if found, or NULL if no scheme found (URI may + * + * Will return the scmeme if found, or NULL if no scheme found (URI may * still be valid, but not full) - * + * * @param string $uriString * @return string|null * @throws InvalidArgumentException @@ -982,34 +982,34 @@ public static function parseScheme($uriString) (is_object($uriString) ? get_class($uriString) : gettype($uriString)) )); } - + if (preg_match('/^([A-Za-z][A-Za-z0-9\.\+\-]*):/', $uriString, $match)) { return $match[1]; - } + } return null; } - + /** * Remove any extra dot segments (/../, /./) from a path * * Algorithm is adapted from RFC-3986 section 5.2.4 * (@link http://tools.ietf.org/html/rfc3986#section-5.2.4) - * + * * @todo consider optimizing - * + * * @param string $path * @return string */ public static function removePathDotSegments($path) { $output = ''; - + while ($path) { if ($path == '..' || $path == '.') { break; } - + switch (true) { case ($path == '/.'): $path = '/'; @@ -1033,32 +1033,32 @@ public static function removePathDotSegments($path) break; default: $slash = strpos($path, '/', 1); - if ($slash === false) { + if ($slash === false) { $seg = $path; } else { - $seg = substr($path, 0, $slash); + $seg = substr($path, 0, $slash); } - + $output .= $seg; $path = substr($path, strlen($seg)); break; } } - - return $output; + + return $output; } - + /** * Merge a base URI and a relative URI into a new URI object - * + * * This convenience method wraps ::resolve() to allow users to quickly - * create new absolute URLs without the need to instantiate and clone + * create new absolute URLs without the need to instantiate and clone * URI objects. - * + * * If objects are passed in, none of the passed objects will be modified. - * + * * @param Uri|string $baseUri - * @param Uri|string $relativeUri + * @param Uri|string $relativeUri * @return Uri */ public static function merge($baseUri, $relativeUri) @@ -1066,10 +1066,10 @@ public static function merge($baseUri, $relativeUri) $uri = new self($relativeUri); return $uri->resolve($baseUri); } - + /** * Check if a host name is a valid IP address, depending on allowed IP address types - * + * * @param string $host * @param integer $allowed allowed address types * @return boolean @@ -1080,29 +1080,29 @@ protected static function isValidIpAddress($host, $allowed) 'allowipv4' => (bool) ($allowed & self::HOST_IPV4), 'allowipv6' => (bool) ($allowed & self::HOST_IPV6), ); - + if ($allowed & (self::HOST_IPV6 | self::HOST_IPVF)) { - if (preg_match('/^\[(.+)\]$/', $host, $match)) { + if (preg_match('/^\[(.+)\]$/', $host, $match)) { $host = $match[1]; $validatorParams['allowipv4'] = false; } } - + if ($allowed & (self::HOST_IPV4 | self::HOST_IPV6)) { $validator = new Validator\Ip($validatorParams); if ($validator->isValid($host)) { return true; } } - - if ($allowed & self::HOST_IPVF) { + + if ($allowed & self::HOST_IPVF) { $regex = '/^v\.[[:xdigit:]]+[' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ':]+$/'; return (bool) preg_match($regex, $host); } - + return false; } - + /** * Check if an address is a valid DNS hostname * @@ -1114,10 +1114,10 @@ protected static function isValidDnsHostname($host) $validator = new Validator\Hostname(array( 'allow' => Validator\Hostname::ALLOW_DNS | Validator\Hostname::ALLOW_LOCAL, )); - + return $validator->isValid($host); } - + /** * Check if an address is a valid registerd name (as defined by RFC-3986) address * @@ -1129,20 +1129,20 @@ protected static function isValidRegName($host) $regex = '/^(?:[' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ':@\/\?]+|%[A-Fa-f0-9]{2})+$/'; return (bool) preg_match($regex, $host); } - + /** * Part normalization methods - * + * * These are called by normalize() using static::_normalize*() so they may * be extended or overridden by extending classes to implement additional * scheme specific normalization rules */ - + /** * Normalize the scheme - * + * * Usually this means simpy converting the scheme to lower case - * + * * @param string $scheme * @return string */ @@ -1150,48 +1150,48 @@ protected static function normalizeScheme($scheme) { return strtolower($scheme); } - + /** * Normalize the host part - * + * * By default this converts host names to lower case - * + * * @param string $host * @return string */ protected static function normalizeHost($host) { return strtolower($host); - } - + } + /** * Normalize the port - * + * * If the class defines a default port for the current scheme, and the - * current port is default, it will be unset. - * + * current port is default, it will be unset. + * * @param integer $port - * @param string $scheme + * @param string $scheme * @return integer|null */ protected static function normalizePort($port, $scheme = null) { - if ($scheme - && isset(static::$defaultPorts[$scheme]) + if ($scheme + && isset(static::$defaultPorts[$scheme]) && ($port == static::$defaultPorts[$scheme]) ) { return null; } - - return $port; + + return $port; } - + /** * Normalize the path - * + * * This involves removing redundant dot segments, decoding any over-encoded * characters and encoding everything that needs to be encoded and is not - * + * * @param string $path * @return string */ @@ -1203,16 +1203,16 @@ protected static function normalizePath($path) '/[' . self::CHAR_UNRESERVED . ':@&=\+\$,\/;%]/' ) ); - + return $path; } - + /** * Normalize the query part - * + * * This involves decoding everything that doesn't need to be encoded, and * encoding everything else - * + * * @param string $query * @return string */ @@ -1224,15 +1224,15 @@ protected static function normalizeQuery($query) '/[' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]/' ) ); - + return $query; } - + /** * Normalize the fragment part - * + * * Currently this is exactly the same as _normalizeQuery(). - * + * * @param string $fragment * @return string */ @@ -1240,12 +1240,12 @@ protected static function normalizeFragment($fragment) { return static::normalizeQuery($fragment); } - + /** * Decode all percent encoded characters which are allowed to be represented literally - * + * * Will not decode any characters which are not listed in the 'allowed' list - * + * * @param string $input * @param string $allowed Pattern of allowed characters */ @@ -1253,12 +1253,12 @@ protected static function decodeUrlEncodedChars($input, $allowed = '') { $decodeCb = function($match) use ($allowed) { $char = rawurldecode($match[0]); - if (preg_match($allowed, $char)) { + if (preg_match($allowed, $char)) { return $char; } return $match[0]; }; - + return preg_replace_callback('/%[A-Fa-f0-9]{2}/', $decodeCb, $input); } } diff --git a/library/Zend/Uri/UriFactory.php b/library/Zend/Uri/UriFactory.php index f3fe82ebe1b..bfd12a4458d 100644 --- a/library/Zend/Uri/UriFactory.php +++ b/library/Zend/Uri/UriFactory.php @@ -15,7 +15,7 @@ * * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ @@ -28,13 +28,13 @@ /** * URI Factory Class - * - * The URI factory can be used to generate URI objects from strings, using a + * + * The URI factory can be used to generate URI objects from strings, using a * different URI subclass depending on the input URI scheme. New scheme-specific - * classes can be registered using the registerScheme() method. - * - * Note that this class contains only static methods and should not be - * instanciated + * classes can be registered using the registerScheme() method. + * + * Note that this class contains only static methods and should not be + * instanciated * * @uses \Zend\Uri\Uri * @uses \Zend\Uri\Http @@ -44,14 +44,14 @@ * @uses \Zend\Loader * @category Zend * @package Zend_Uri - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class UriFactory +abstract class UriFactory { /** * Registered scheme-specific classes - * + * * @var array */ static protected $schemeClasses = array( @@ -60,10 +60,10 @@ abstract class UriFactory 'mailto' => 'Zend\Uri\Mailto', 'file' => 'Zend\Uri\File', ); - + /** - * Register a scheme-specific class to be used - * + * Register a scheme-specific class to be used + * * @param unknown_type $scheme * @param unknown_type $class */ @@ -72,10 +72,10 @@ static public function registerScheme($scheme, $class) $scheme = strtolower($scheme); static::$_schemeClasses[$scheme] = $class; } - + /** * Create a URI from a string - * + * * @param string $uri * @param string $defaultScheme * @return \Zend\Uri\Uri @@ -88,17 +88,17 @@ static public function factory($uriString, $defaultScheme = null) (is_object($uriString) ? get_class($uriString) : gettype($uriString)) )); } - + $uri = new Uri($uriString); $scheme = strtolower($uri->getScheme()); - if (!$scheme && $defaultScheme) { + if (!$scheme && $defaultScheme) { $scheme = $defaultScheme; } - + if ($scheme && isset(static::$schemeClasses[$scheme])) { $class = static::$schemeClasses[$scheme]; $uri = new $class($uri); - if (! $uri instanceof Uri) { + if (! $uri instanceof Uri) { throw new Exception\InvalidArgumentException(sprintf( 'class "%s" registered for scheme "%s" is not a subclass of Zend\Uri\Uri', $class, @@ -106,7 +106,7 @@ static public function factory($uriString, $defaultScheme = null) )); } } - + return $uri; } } diff --git a/tests/Zend/Config/YamlTest.php b/tests/Zend/Config/YamlTest.php old mode 100755 new mode 100644 index 4c1e5738594..3d376f3a2e2 --- a/tests/Zend/Config/YamlTest.php +++ b/tests/Zend/Config/YamlTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Config * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: IniTest.php 18950 2009-11-12 15:37:56Z alexander $ */ @@ -29,7 +29,7 @@ * @category Zend * @package Zend_Config * @subpackage UnitTests - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Config */ diff --git a/tests/Zend/Uri/FileTest.php b/tests/Zend/Uri/FileTest.php index 34b8fb4c99b..7e73370e907 100644 --- a/tests/Zend/Uri/FileTest.php +++ b/tests/Zend/Uri/FileTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Uri * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Uri * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Uri * @group Zend_Uri_Http @@ -42,10 +42,10 @@ class FileTest extends TestCase /** * Data Providers */ - + /** * Valid schemes - * + * * @return array */ public static function validSchemeProvider() @@ -56,10 +56,10 @@ public static function validSchemeProvider() array('File'), ); } - + /** * Invalid schemes - * + * * @return array */ public static function invalidSchemeProvider() @@ -117,7 +117,7 @@ public static function windowsUris() /** * Test that specific schemes are valid for this class - * + * * @param string $scheme * @dataProvider validSchemeProvider */ @@ -127,10 +127,10 @@ public function testValidScheme($scheme) $uri->setScheme($scheme); $this->assertEquals($scheme, $uri->getScheme()); } - + /** * Test that specific schemes are invalid for this class - * + * * @param string $scheme * @dataProvider invalidSchemeProvider */ @@ -144,7 +144,7 @@ public function testInvalidScheme($scheme) /** * Test that validateScheme returns false for schemes not valid for use * with the File class - * + * * @param string $scheme * @dataProvider invalidSchemeProvider */ diff --git a/tests/Zend/Uri/HttpTest.php b/tests/Zend/Uri/HttpTest.php index f1faebb095a..2765e14c7dc 100644 --- a/tests/Zend/Uri/HttpTest.php +++ b/tests/Zend/Uri/HttpTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Uri * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Uri * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Uri * @group Zend_Uri_Http @@ -42,10 +42,10 @@ class HttpTest extends TestCase /** * Data Providers */ - + /** * Valid HTTP schemes - * + * * @return array */ static public function validSchemeProvider() @@ -57,10 +57,10 @@ static public function validSchemeProvider() array('Https'), ); } - + /** * Invalid HTTP schemes - * + * * @return array */ static public function invalidSchemeProvider() @@ -72,7 +72,7 @@ static public function invalidSchemeProvider() array('http:') ); } - + static public function portNormalizationTestsProvider() { return array( @@ -90,7 +90,7 @@ static public function portNormalizationTestsProvider() /** * Test that specific schemes are valid for this class - * + * * @param string $scheme * @dataProvider validSchemeProvider */ @@ -100,10 +100,10 @@ public function testValidScheme($scheme) $uri->setScheme($scheme); $this->assertEquals($scheme, $uri->getScheme()); } - + /** * Test that specific schemes are invalid for this class - * + * * @param string $scheme * @dataProvider invalidSchemeProvider */ @@ -117,7 +117,7 @@ public function testInvalidScheme($scheme) /** * Test that validateScheme returns false for schemes not valid for use * with the HTTP class - * + * * @param string $scheme * @dataProvider invalidSchemeProvider */ @@ -125,10 +125,10 @@ public function testValidateSchemeInvalid($scheme) { $this->assertFalse(HttpUri::validateScheme($scheme)); } - + /** - * Test that normalizing an HTTP URL removes the port depending on scheme - * + * Test that normalizing an HTTP URL removes the port depending on scheme + * * @param string $orig * @param string $expected * @dataProvider portNormalizationTestsProvider diff --git a/tests/Zend/Uri/MailtoTest.php b/tests/Zend/Uri/MailtoTest.php index 649923113d0..b08b362291d 100644 --- a/tests/Zend/Uri/MailtoTest.php +++ b/tests/Zend/Uri/MailtoTest.php @@ -15,7 +15,7 @@ * @category Zend * @package Zend_Uri * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Uri * @subpackage UnitTests - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Uri * @group Zend_Uri_Http @@ -42,10 +42,10 @@ class MailtoTest extends TestCase /** * Data Providers */ - + /** * Valid schemes - * + * * @return array */ static public function validSchemeProvider() @@ -56,10 +56,10 @@ static public function validSchemeProvider() array('Mailto'), ); } - + /** * Invalid schemes - * + * * @return array */ static public function invalidSchemeProvider() @@ -82,14 +82,14 @@ static public function invalidUris() array('mailto:foo:bar'), ); } - + /** * Tests */ /** * Test that specific schemes are valid for this class - * + * * @param string $scheme * @dataProvider validSchemeProvider */ @@ -99,10 +99,10 @@ public function testValidScheme($scheme) $uri->setScheme($scheme); $this->assertEquals($scheme, $uri->getScheme()); } - + /** * Test that specific schemes are invalid for this class - * + * * @param string $scheme * @dataProvider invalidSchemeProvider */ @@ -116,7 +116,7 @@ public function testInvalidScheme($scheme) /** * Test that validateScheme returns false for schemes not valid for use * with the Mailto class - * + * * @param string $scheme * @dataProvider invalidSchemeProvider */ diff --git a/tests/Zend/Uri/UriTest.php b/tests/Zend/Uri/UriTest.php index decdf2d5bce..d490ee0162d 100644 --- a/tests/Zend/Uri/UriTest.php +++ b/tests/Zend/Uri/UriTest.php @@ -1,4 +1,4 @@ -$setMethod($v); } - + $this->assertEquals($exp, (string) $uri); } - + /** * Test the parseScheme static method to extract the scheme part - * + * * @param string $uriString * @param array $parts * @dataProvider uriWithPartsProvider @@ -84,16 +84,16 @@ public function testComposeNewUriAndCastToString($exp, $parts) public function testParseScheme($uriString, $parts) { $scheme = Uri::parseScheme($uriString); - if (! isset($parts['scheme'])) { + if (! isset($parts['scheme'])) { $parts['scheme'] = null; } - + $this->assertEquals($parts['scheme'], $scheme); } - + /** * Test that parseScheme throws an exception in case of invalid input - + * @param mixed $input * @dataProvider notStringInputProvider */ @@ -102,20 +102,20 @@ public function testParseSchemeInvalidInput($input) $this->setExpectedException('Zend\Uri\Exception\InvalidArgumentException') $scheme = Uri::parseScheme($input); } - + /** * Test that __toString() (magic) returns an empty string if URI is invalid - * + * * @dataProvider invalidUriObjectProvider */ public function testMagicToStringEmptyIfInvalid(Uri $uri) { $this->assertEquals('', (string) $uri); } - + /** * Test that toString() (not magic) throws an exception if URI is invalid - * + * * @dataProvider invalidUriObjectProvider */ public function testToStringThrowsExceptionIfInvalid(Uri $uri) @@ -123,10 +123,10 @@ public function testToStringThrowsExceptionIfInvalid(Uri $uri) $this->setExpectedException('Zend\Uri\Exception\InvalidUriException') echo $uri->toString(); } - + /** * Test that we can parse a malformed URI - * + * * @link http://framework.zend.com/issues/browse/ZF-11286 */ public function testCanParseMalformedUrlZF11286() @@ -134,17 +134,17 @@ public function testCanParseMalformedUrlZF11286() $urlString = 'http://example.org/SitePages/file has spaces.html?foo=bar'; $uri = new Uri($urlString); $fixedUri = new Uri($uri->toString()); - + $this->assertEquals('/SitePages/file%20has%20spaces.html', $fixedUri->getPath()); } - + /** * Accessor Tests */ - + /** * Test that we can get the scheme out of a parsed URI - * + * * @param string $uriString * @param array $parts * @dataProvider uriWithPartsProvider @@ -158,10 +158,10 @@ public function testGetScheme($uriString, $parts) $this->assertNull($uri->getScheme()); } } - + /** * Test that we get the correct userInfo - * + * * @param string $uriString * @param array $parts * @dataProvider uriWithPartsProvider @@ -175,10 +175,10 @@ public function testGetUserInfo($uriString, $parts) $this->assertNull($uri->getUserInfo()); } } - + /** * Test that we can get the host out of a parsed URI - * + * * @param string $uriString * @param array $parts * @dataProvider uriWithPartsProvider @@ -195,7 +195,7 @@ public function testGetHost($uriString, $parts) /** * Test that we can get the port out of a parsed Uri - * + * * @param string $uriString * @param array $parts * @dataProvider uriWithPartsProvider @@ -212,7 +212,7 @@ public function testGetPort($uriString, $parts) /** * Test that we can get the path out of a parsed Uri - * + * * @param string $uriString * @param array $parts * @dataProvider uriWithPartsProvider @@ -226,10 +226,10 @@ public function testGetPath($uriString, $parts) $this->assertNull($uri->getPath()); } } - + /** * Test that we can get the query out of a parsed Uri - * + * * @param string $uriString * @param array $parts * @dataProvider uriWithPartsProvider @@ -251,19 +251,19 @@ public function testGetQueryAsArrayReturnsCorrectArray() { $url = new Uri('http://example.com/foo/?test=a&var[]=1&var[]=2&some[thing]=3'); $this->assertEquals('test=a&var[]=1&var[]=2&some[thing]=3', $url->getQuery()); - + $exp = array( 'test' => 'a', 'var' => array(1, 2), 'some' => array('thing' => 3) ); - + $this->assertEquals($exp, $url->getQueryAsArray()); } - + /** * Test that we can get the fragment out of a parsed URI - * + * * @param string $uriString * @param array $parts * @dataProvider uriWithPartsProvider @@ -281,23 +281,23 @@ public function testGetFragment($uriString, $parts) /** * Mutator Tests */ - + /** * Test we can set the scheme to NULL - * + * */ public function testSetSchemeNull() { $uri = new Uri('http://example.com'); $this->assertEquals('http', $uri->getScheme()); - + $uri->setScheme(null); $this->assertNull($uri->getScheme()); } - + /** * Test we can set different valid schemes - * + * * @param string $scheme * @dataProvider validSchemeProvider */ @@ -306,11 +306,11 @@ public function testSetSchemeValid($scheme) $uri = new Uri; $uri->setScheme($scheme); $this->assertEquals($scheme, $uri->getScheme()); - } - + } + /** * Test that setting an invalid scheme causes an exception - * + * * @param string $scheme * @dataProvider invalidSchemeProvider */ @@ -320,10 +320,10 @@ public function testSetInvalidScheme($scheme) $this->setExpectedException('Zend\Uri\Exception\InvalidUriPartException') $uri->setScheme($scheme); } - + /** * Test that we can set a valid hostname - * + * * @param string $host * @dataProvider validHostProvider */ @@ -333,10 +333,10 @@ public function testSetGetValidHost($host) $uri->setHost($host); $this->assertEquals($host, $uri->getHost()); } - + /** * Test that when setting an invalid host an exception is thrown - * + * * @param string $host * @dataProvider invalidHostProvider */ @@ -346,10 +346,10 @@ public function testSetInvalidHost($host) $this->setExpectedException('Zend\Uri\Exception\InvalidUriPartException') $uri->setHost($host); } - + /** * Test that we can set the host part to 'null' - * + * */ public function testSetNullHost() { @@ -357,10 +357,10 @@ public function testSetNullHost() $uri->setHost(null); $this->assertNull($uri->getHost()); } - + /** * Test that we can use an array to set the query parameters - * + * * @param array $data * @param string $expqs * @dataProvider queryParamsArrayProvider @@ -369,17 +369,17 @@ public function testSetQueryFromArray(array $data, $expqs) { $uri = new Uri(); $uri->setQuery($data); - + $this->assertEquals('?' . $expqs, $uri->toString()); } - + /** * Validation and encoding tests */ - + /** * Test that valid URIs pass validation - * + * * @param string $uriString * @dataProvider validUriStringProvider */ @@ -392,17 +392,17 @@ public function testValidUriIsValid($uriString) /** * Test that invalid URIs pass validation * - * @param \Zend\Uri\Uri $uri + * @param \Zend\Uri\Uri $uri * @dataProvider invalidUriObjectProvider */ public function testInvalidUriIsInvalid(Uri $uri) { $this->assertFalse($uri->isValid()); } - + /** * Check that valid schemes are valid according to validateScheme() - * + * * @param string $scheme * @dataProvider validSchemeProvider */ @@ -410,10 +410,10 @@ public function testValidateSchemeValid($scheme) { $this->assertTrue(Uri::validateScheme($scheme)); } - + /** * Check that invalid schemes are invalid according to validateScheme() - * + * * @param string $scheme * @dataProvider invalidSchemeProvider */ @@ -421,10 +421,10 @@ public function testValidateSchemeInvalid($scheme) { $this->assertFalse(Uri::validateScheme($scheme)); } - + /** * Check that valid hosts are valid according to validateHost() - * + * * @param string $host * @dataProvider validHostProvider */ @@ -432,10 +432,10 @@ public function testValidateHostValid($host) { $this->assertTrue(Uri::validateHost($host)); } - + /** * Check that invalid hosts are invalid according to validateHost() - * + * * @param string $host * @dataProvider invalidHostProvider */ @@ -443,10 +443,10 @@ public function testValiteHostInvalid($host) { $this->assertFalse(Uri::validateHost($host)); } - + /** * Check that valid paths are valid according to validatePath() - * + * * @param string $path * @dataProvider validPathProvider */ @@ -454,10 +454,10 @@ public function testValidatePathValid($path) { $this->assertTrue(Uri::validatePath($path)); } - + /** * Check that invalid paths are invalid according to validatePath() - * + * * @param string $path * @dataProvider invalidPathProvider */ @@ -465,10 +465,10 @@ public function testValidatePathInvalid($path) { $this->assertFalse(Uri::validatePath($path)); } - + /** * Test that valid path parts are unchanged by the 'encode' function - * + * * @param string $path * @dataProvider validPathProvider */ @@ -476,10 +476,10 @@ public function testEncodePathValid($path) { $this->assertEquals($path, Uri::encodePath($path)); } - + /** * Test that invalid path parts are properly encoded by the 'encode' function - * + * * @param string $path * @param string $exp * @dataProvider invalidPathProvider @@ -488,10 +488,10 @@ public function testEncodePathInvalid($path, $exp) { $this->assertEquals($exp, Uri::encodePath($path)); } - + /** * Test that valid query or fragment parts are validated properly - * + * * @param $input * @dataProvider validQueryFragmentProvider */ @@ -499,10 +499,10 @@ public function testValidQueryFragment($input) { $this->assertTrue(Uri::validateQueryFragment($input)); } - + /** * Test that invalid query or fragment parts are validated properly - * + * * @param $input * @dataProvider invalidQueryFragmentProvider */ @@ -510,7 +510,7 @@ public function testInvalidQueryFragment($input, $exp) { $this->assertFalse(Uri::validateQueryFragment($input)); } - + /** * Test that valid query or fragment parts properly encoded * @@ -523,9 +523,9 @@ public function testEncodeInvalidQueryFragment($input, $exp) $actual = Uri::encodeQueryFragment($input); $this->assertEquals($exp, $actual); } - + /** - * Test that valid query or fragment parts are not modified when paseed + * Test that valid query or fragment parts are not modified when paseed * through encodeQueryFragment() * * @param $input @@ -537,10 +537,10 @@ public function testEncodeValidQueryFragment($input) $actual = Uri::encodeQueryFragment($input); $this->assertEquals($input, $actual); } - + /** * Test that valid userInfo input is validated by validateUserInfo - * + * * @param string $userInfo * @dataProvider validUserInfoProvider */ @@ -548,22 +548,22 @@ public function testValidateUserInfoValid($userInfo) { $this->assertTrue(Uri::validateUserInfo($userInfo)); } - + /** * Test that invalid userInfo input is not accepted by validateUserInfo - * + * * @param string $userInfo - * @param string $exp + * @param string $exp * @dataProvider invalidUserInfoProvider */ public function testValidateUserInfoInvalid($userInfo, $exp) { $this->assertFalse(Uri::validateUserInfo($userInfo)); } - + /** * Test that valid userInfo is returned unchanged by encodeUserInfo - * + * * @param $userInfo * @dataProvider validUserInfoProvider */ @@ -571,22 +571,22 @@ public function testEncodeUserInfoValid($userInfo) { $this->assertEquals($userInfo, Uri::encodeUserInfo($userInfo)); } - + /** * Test that invalid userInfo input properly encoded by encodeUserInfo - * + * * @param string $userInfo - * @param string $exp + * @param string $exp * @dataProvider invalidUserInfoProvider */ public function testEncodeUserInfoInvalid($userInfo, $exp) { $this->assertEquals($exp, Uri::encodeUserInfo($userInfo)); } - + /** * Test that validatePort works for valid ports - * + * * @param mixed $port * @dataProvider validPortProvider */ @@ -594,10 +594,10 @@ public function testValidatePortValid($port) { $this->assertTrue(Uri::validatePort($port)); } - + /** * Test that validatePort works for invalid ports - * + * * @param mixed $port * @dataProvider invalidPortProvider */ @@ -605,7 +605,7 @@ public function testValidatePortInvalid($port) { $this->assertFalse(Uri::validatePort($port)); } - + /** * @group ZF-1480 */ @@ -636,15 +636,15 @@ public function testRemoveQueryParametersModifiesQueryAndReturnsOldQuery() $this->assertEquals('a=1&c=3', $url->getQuery()); } */ - + /** * Resolving, Normalization and Reference creation tests */ - + /** - * Test that resolving relative URIs works using the examples specified in + * Test that resolving relative URIs works using the examples specified in * the RFC - * + * * @param string $relative * @param string $expected * @dataProvider resolvedAbsoluteUriProvider @@ -653,25 +653,25 @@ public function testRelativeUriResolvingRfcSamples($baseUrl, $relative, $expecte { $uri = new Uri($relative); $uri->resolve($baseUrl); - + $this->assertEquals($expected, $uri->toString()); } - + /** * Test the removal of extra dot segments from paths - * + * * @param $orig * @param $expected * @dataProvider pathWithDotSegmentProvider */ public function testRemovePathDotSegments($orig, $expected) { - $this->assertEquals($expected, Uri::removePathDotSegments($orig)); + $this->assertEquals($expected, Uri::removePathDotSegments($orig)); } - + /** * Test normalizing URLs - * + * * @param string $orig * @param string $expected * @dataProvider normalizedUrlsProvider @@ -681,10 +681,10 @@ public function testNormalizeUrl($orig, $expected) $url = new Uri($orig); $this->assertEquals($expected, $url->normalize()->toString()); } - + /** * Test the merge() static method for merging new URIs - * + * * @param string $base * @param string $relative * @param string $expected @@ -695,35 +695,35 @@ public function testMergeToNewUri($base, $relative, $expected) $actual = Uri::merge($base, $relative)->toString(); $this->assertEquals($expected, $actual); } - + /** * Make sure that the ::merge() method does not modify any input objects - * - * This performs two checks: + * + * This performs two checks: * 1. That the result object is *not* the same object as any of the input ones * 2. That the method doesn't modify the input objects - * + * */ public function testMergeTwoObjectsNotModifying() { $base = new Uri('http://example.com/bar'); $ref = new Uri('baz?qwe=1'); - + $baseSig = serialize($base); $refSig = serialize($ref); - + $actual = Uri::merge($base, $ref); - + $this->assertNotSame($base, $actual); $this->assertNotSame($ref, $actual); - + $this->assertEquals($baseSig, serialize($base)); $this->assertEquals($refSig, serialize($ref)); } - + /** * Test that makeRelative() works as expected - * + * * @dataProvider commonBaseUriProvider */ public function testMakeRelative($base, $url, $expected) @@ -732,27 +732,27 @@ public function testMakeRelative($base, $url, $expected) $url->makeRelative($base); $this->assertEquals($expected, $url->toString()); } - + /** * Other tests */ - + /** * Test that the copy constructor works - * + * * @dataProvider validUriStringProvider */ public function testConstructorCopyExistingObject($uriString) { $uri = new Uri($uriString); $uri2 = new Uri($uri); - + $this->assertEquals($uri, $uri2); } - + /** * Test that the constructor throws an exception on invalid input - * + * * @param mixed $input * @dataProvider invalidConstructorInputProvider */ @@ -761,10 +761,10 @@ public function testConstructorInvalidInput($input) $this->setExpectedException('Zend\Uri\Exception\InvalidArgumentException'); $uri = new Uri($input); } - + /** * Test the fluent interface - * + * * @param string $method * @param string $params * @dataProvider fluentInterfaceMethodProvider @@ -775,11 +775,11 @@ public function testFluentInterface($method, $params) $ret = call_user_func_array(array($uri, $method), $params); $this->assertSame($uri, $ret); } - + /** * Data Providers */ - + static public function validUserInfoProvider() { return array( @@ -793,7 +793,7 @@ static public function validUserInfoProvider() array('a_.!~*\'(-)n0123Di%25%26:pass;:&=+$,word') ); } - + static public function invalidUserInfoProvider() { return array( @@ -802,10 +802,10 @@ static public function invalidUserInfoProvider() array('shahar.e@zend.com', 'shahar.e%40zend.com') ); } - + /** - * Data provider for valid URIs, not necessarily complete - * + * Data provider for valid URIs, not necessarily complete + * * @return array */ static public function validUriStringProvider() @@ -822,10 +822,10 @@ static public function validUriStringProvider() array('http://a_.!~*\'(-)n0123Di%25%26:pass;:&=+$,word@www.zend.com') ); } - + /** - * Valid schemes - * + * Valid schemes + * * @return array */ static public function validSchemeProvider() @@ -841,13 +841,13 @@ static public function validSchemeProvider() array('k-'), ); } - + /** * Invalid schemes - * + * * @return array */ - static public function invalidSchemeProvider() + static public function invalidSchemeProvider() { return array( array('ht tp'), @@ -857,13 +857,13 @@ static public function invalidSchemeProvider() array('h%acp'), ); } - + /** * Valid query or fragment parts - * - * Each valid query or fragment part should require no encoding and if - * passed throuh an encoding method shoudl return unchanged. - * + * + * Each valid query or fragment part should require no encoding and if + * passed throuh an encoding method shoudl return unchanged. + * * @return array */ static public function validQueryFragmentProvider() @@ -872,16 +872,16 @@ static public function validQueryFragmentProvider() array('a=1&b=2&c=3&d=4'), array('with?questionmark/andslash'), array('id=123&url=http://example.com/?bar=foo+baz'), - array('with%20%0Aline%20break'), + array('with%20%0Aline%20break'), ); } - + /** - * Invalid query or fragment parts. - * + * Invalid query or fragment parts. + * * Additionally, this method supplies a valid, URL-encoded representation - * of each invalid part, which can be used to test encoding. - * + * of each invalid part, which can be used to test encoding. + * * @return array */ static public function invalidQueryFragmentProvider() @@ -894,17 +894,17 @@ static public function invalidQueryFragmentProvider() array("with%percent", "with%25percent"), ); } - + /** * Data provider for invalid URI objects - * + * * @return array */ static public function invalidUriObjectProvider() { // Empty URI is not valid $obj1 = new Uri; - + // Path cannot begin with '//' if there is no authority part $obj2 = new Uri; $obj2->setPath('//path'); @@ -912,11 +912,11 @@ static public function invalidUriObjectProvider() // A port-only URI with no host $obj3 = new Uri; $obj3->setPort(123); - + // A userinfo-only URI with no host - $obj4 = new Uri; + $obj4 = new Uri; $obj4->setUserInfo('shahar:password'); - + return array( array($obj1), array($obj2), @@ -924,25 +924,25 @@ static public function invalidUriObjectProvider() array($obj4) ); } - - + + /** * Data provider for valid URIs with their different parts - * + * * @return array */ static public function uriWithPartsProvider() { return array( array('ht-tp://server/path?query', array( - 'scheme' => 'ht-tp', + 'scheme' => 'ht-tp', 'host' => 'server', 'path' => '/path', 'query' => 'query', )), array('file:///foo/bar', array( 'scheme' => 'file', - 'host' => '', + 'host' => '', 'path' => '/foo/bar', )), array('http://dude:lebowski@example.com/#fr/ag?me.nt', array( @@ -968,10 +968,10 @@ static public function uriWithPartsProvider() )) ); } - + /** * Provider for valid ports - * + * * @return array */ static public function validPortProvider() @@ -984,7 +984,7 @@ static public function validPortProvider() array('443') ); } - + /** * Provider for invalid ports * @@ -1003,7 +1003,7 @@ static public function invalidPortProvider() array('/') ); } - + static public function validHostProvider() { return array( @@ -1012,7 +1012,7 @@ static public function validHostProvider() array('127.0.0.1'), array('0.0.0.0'), array('255.255.255.255'), - + // IPv6 addresses // Examples from http://en.wikipedia.org/wiki/IPv6_address array('[2001:0db8:85a3:0000:0000:8a2e:0370:7334]'), @@ -1021,7 +1021,7 @@ static public function validHostProvider() array('[0:0:0:0:0:0:0:1]'), array('[::1]'), array('[2001:0db8:85a3:08d3:1319:8a2e:0370:7348]'), - + // Internet and local DNS names array('www.example.com'), array('zend.com'), @@ -1033,7 +1033,7 @@ static public function validHostProvider() array('a.b.c.d'), array('a1.b2.c3.d4'), array('some-domain-with-dashes'), - + // Registered name (other than DNS names) array('some~unre_served.ch4r5'), array('pct.%D7%A9%D7%97%D7%A8%20%D7%94%D7%92%D7%93%D7%95%D7%9C.co.il'), @@ -1041,7 +1041,7 @@ static public function validHostProvider() array('%2F%3A') ); } - + static public function invalidHostProvider() { return array( @@ -1050,7 +1050,7 @@ static public function invalidHostProvider() array('[12:34'), ); } - + static public function validPathProvider() { return array( @@ -1067,22 +1067,22 @@ static public function validPathProvider() array('C:/Program%20Files/Zend'), ); } - + static public function invalidPathProvider() { return array( array('?', '%3F'), array('/#', '/%23'), - + // See http://framework.zend.com/issues/browse/ZF-11286 - array('Giri%C5%9F Sayfas%C4%B1.aspx', 'Giri%C5%9F%20Sayfas%C4%B1.aspx') + array('Giri%C5%9F Sayfas%C4%B1.aspx', 'Giri%C5%9F%20Sayfas%C4%B1.aspx') ); } - + /** * Return all methods that are expected to return the same object they * are called on, to test that the fluent interface is not broken - * + * * @return array */ static public function fluentInterfaceMethodProvider() @@ -1100,13 +1100,13 @@ static public function fluentInterfaceMethodProvider() array('normalize', array()) ); } - + /** - * Test cases for absolute URI resolving - * - * These examples are taken from RFC-3986 section about relative URI - * resolving (@link http://tools.ietf.org/html/rfc3986#section-5.4). - * + * Test cases for absolute URI resolving + * + * These examples are taken from RFC-3986 section about relative URI + * resolving (@link http://tools.ietf.org/html/rfc3986#section-5.4). + * * @return array */ static public function resolvedAbsoluteUriProvider() @@ -1155,11 +1155,11 @@ static public function resolvedAbsoluteUriProvider() array('http://a/b/c/d;p?q', 'http:g', 'http:g'), ); } - + /** * Data provider for arrays of query string parameters, with the expected * query string - * + * * @return array */ static public function queryParamsArrayProvider() @@ -1179,10 +1179,10 @@ static public function queryParamsArrayProvider() ), 'array%5B0%5D=foo&array%5B1%5D=bar&array%5B2%5D=baz&otherstuff%5B%5D=1234') ); } - + /** * Provider for testing removal of extra dot segments in paths - * + * * @return array */ static public function pathWithDotSegmentProvider() @@ -1192,7 +1192,7 @@ static public function pathWithDotSegmentProvider() array('mid/content=5/../6', 'mid/6') ); } - + static public function normalizedUrlsProvider() { return array( @@ -1203,26 +1203,26 @@ static public function normalizedUrlsProvider() array('/foo/bar?url=http%3A%2F%2Fwww.example.com%2Fbaz', '/foo/bar?url=http://www.example.com/baz'), array('File:///SitePages/fi%6ce%20has%20spaces', 'file:///SitePages/file%20has%20spaces'), array('/foo/bar/../baz?do=action#showFragment', '/foo/baz?do=action#showFragment'), - + // This should be left unchanged, at least for the generic Uri class array('http://example.com:80/file?query=bar', 'http://example.com:80/file?query=bar'), ); } - + static public function commonBaseUriProvider() { return array( - array('http://example.com/dir/subdir/', 'http://example.com/dir/subdir/more/file1.txt', 'more/file1.txt'), - array('http://example.com/dir/subdir/', 'http://example.com/dir/otherdir/file2.txt', '../otherdir/file2.txt'), - array('http://example.com/dir/subdir/', 'http://otherhost.com/dir/subdir/file3.txt', 'http://otherhost.com/dir/subdir/file3.txt'), + array('http://example.com/dir/subdir/', 'http://example.com/dir/subdir/more/file1.txt', 'more/file1.txt'), + array('http://example.com/dir/subdir/', 'http://example.com/dir/otherdir/file2.txt', '../otherdir/file2.txt'), + array('http://example.com/dir/subdir/', 'http://otherhost.com/dir/subdir/file3.txt', 'http://otherhost.com/dir/subdir/file3.txt'), ); } - - + + /** * Provider for testing the constructor's behavior on invalid input - * - * @return array + * + * @return array */ static public function invalidConstructorInputProvider() { @@ -1234,13 +1234,13 @@ static public function invalidConstructorInputProvider() array(12) ); } - + /** * Provider for testing the behaviors of functions that expect only strings - * - * Most of these methods are expected to throw an exception for the + * + * Most of these methods are expected to throw an exception for the * provided values - * + * * @return array */ static public function notStringInputProvider()