diff --git a/composer.json b/composer.json
index 3c337641b..68363e9cc 100644
--- a/composer.json
+++ b/composer.json
@@ -2,9 +2,16 @@
"name": "zf1s/zf1",
"description": "Zend Framework 1 complete package, PHP 5.3-8.3 compatible. Please consider using individual zf1s/zend-* packages instead - see README.",
"license": "BSD-3-Clause",
+ "repositories": [
+ {
+ "type": "git",
+ "url": "git@github.com:zf1s/compat.git"
+ }
+ ],
"require": {
"php": ">=5.3.3",
- "symfony/polyfill-php70": "^1.19"
+ "symfony/polyfill-php70": "^1.19",
+ "zf1s/compat": "^1.0"
},
"require-dev": {
"ext-ctype": "*",
diff --git a/packages/zend-acl/library/Zend/Acl.php b/packages/zend-acl/library/Zend/Acl.php
index c64178c87..6954f5ef6 100644
--- a/packages/zend-acl/library/Zend/Acl.php
+++ b/packages/zend-acl/library/Zend/Acl.php
@@ -1,4 +1,7 @@
setRule(self::OP_ADD, self::TYPE_ALLOW, $roles, $resources, $privileges, $assert);
}
@@ -510,12 +515,14 @@ public function allow($roles = null, $resources = null, $privileges = null, Zend
* @param Zend_Acl_Role_Interface|string|array $roles
* @param Zend_Acl_Resource_Interface|string|array $resources
* @param string|array $privileges
- * @param Zend_Acl_Assert_Interface $assert
+ * @param Zend_Acl_Assert_Interface|null $assert
* @uses Zend_Acl::setRule()
* @return Zend_Acl Provides a fluent interface
*/
- public function deny($roles = null, $resources = null, $privileges = null, Zend_Acl_Assert_Interface $assert = null)
+ public function deny($roles = null, $resources = null, $privileges = null, $assert = null)
{
+ Types::isNullable('assert', $assert, 'Zend_Acl_Assert_Interface');
+
return $this->setRule(self::OP_ADD, self::TYPE_DENY, $roles, $resources, $privileges, $assert);
}
@@ -593,15 +600,17 @@ public function removeDeny($roles = null, $resources = null, $privileges = null)
* @param Zend_Acl_Role_Interface|string|array $roles
* @param Zend_Acl_Resource_Interface|string|array $resources
* @param string|array $privileges
- * @param Zend_Acl_Assert_Interface $assert
+ * @param Zend_Acl_Assert_Interface|null $assert
* @throws Zend_Acl_Exception
* @uses Zend_Acl_Role_Registry::get()
* @uses Zend_Acl::get()
* @return Zend_Acl Provides a fluent interface
*/
public function setRule($operation, $type, $roles = null, $resources = null, $privileges = null,
- Zend_Acl_Assert_Interface $assert = null)
+ $assert = null)
{
+ Types::isNullable('assert', $assert, 'Zend_Acl_Assert_Interface');
+
// ensure that the rule type is valid; normalize input to uppercase
$type = strtoupper($type);
if (self::TYPE_ALLOW !== $type && self::TYPE_DENY !== $type) {
@@ -915,12 +924,14 @@ protected function _getRoleRegistry()
* This method returns true if a rule is found and allows access. If a rule exists and denies access,
* then this method returns false. If no applicable rule is found, then this method returns null.
*
- * @param Zend_Acl_Role_Interface $role
- * @param Zend_Acl_Resource_Interface $resource
+ * @param Zend_Acl_Role_Interface $role
+ * @param Zend_Acl_Resource_Interface|null $resource
* @return boolean|null
*/
- protected function _roleDFSAllPrivileges(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null)
+ protected function _roleDFSAllPrivileges(Zend_Acl_Role_Interface $role, $resource = null)
{
+ Types::isNullable('resource', $resource, 'Zend_Acl_Resource_Interface');
+
$dfs = array(
'visited' => array(),
'stack' => array()
@@ -949,15 +960,17 @@ protected function _roleDFSAllPrivileges(Zend_Acl_Role_Interface $role, Zend_Acl
*
* This method is used by the internal depth-first search algorithm and may modify the DFS data structure.
*
- * @param Zend_Acl_Role_Interface $role
- * @param Zend_Acl_Resource_Interface $resource
- * @param array $dfs
+ * @param Zend_Acl_Role_Interface $role
+ * @param Zend_Acl_Resource_Interface|null $resource
+ * @param array $dfs
* @return boolean|null
* @throws Zend_Acl_Exception
*/
- protected function _roleDFSVisitAllPrivileges(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null,
+ protected function _roleDFSVisitAllPrivileges(Zend_Acl_Role_Interface $role, $resource = null,
&$dfs = null)
{
+ Types::isNullable('resource', $resource, 'Zend_Acl_Resource_Interface');
+
if (null === $dfs) {
/**
* @see Zend_Acl_Exception
@@ -992,15 +1005,17 @@ protected function _roleDFSVisitAllPrivileges(Zend_Acl_Role_Interface $role, Zen
* This method returns true if a rule is found and allows access. If a rule exists and denies access,
* then this method returns false. If no applicable rule is found, then this method returns null.
*
- * @param Zend_Acl_Role_Interface $role
- * @param Zend_Acl_Resource_Interface $resource
- * @param string $privilege
+ * @param Zend_Acl_Role_Interface $role
+ * @param Zend_Acl_Resource_Interface|null $resource
+ * @param string $privilege
* @return boolean|null
* @throws Zend_Acl_Exception
*/
- protected function _roleDFSOnePrivilege(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null,
+ protected function _roleDFSOnePrivilege(Zend_Acl_Role_Interface $role, $resource = null,
$privilege = null)
{
+ Types::isNullable('resource', $resource, 'Zend_Acl_Resource_Interface');
+
if (null === $privilege) {
/**
* @see Zend_Acl_Exception
@@ -1037,16 +1052,18 @@ protected function _roleDFSOnePrivilege(Zend_Acl_Role_Interface $role, Zend_Acl_
*
* This method is used by the internal depth-first search algorithm and may modify the DFS data structure.
*
- * @param Zend_Acl_Role_Interface $role
- * @param Zend_Acl_Resource_Interface $resource
- * @param string $privilege
- * @param array $dfs
+ * @param Zend_Acl_Role_Interface $role
+ * @param Zend_Acl_Resource_Interface|null $resource
+ * @param string $privilege
+ * @param array $dfs
* @return boolean|null
* @throws Zend_Acl_Exception
*/
- protected function _roleDFSVisitOnePrivilege(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null,
+ protected function _roleDFSVisitOnePrivilege(Zend_Acl_Role_Interface $role, $resource = null,
$privilege = null, &$dfs = null)
{
+ Types::isNullable('resource', $resource, 'Zend_Acl_Resource_Interface');
+
if (null === $privilege) {
/**
* @see Zend_Acl_Exception
@@ -1093,14 +1110,17 @@ protected function _roleDFSVisitOnePrivilege(Zend_Acl_Role_Interface $role, Zend
* If all three parameters are null, then the default ACL rule type is returned,
* based on whether its assertion method passes.
*
- * @param Zend_Acl_Resource_Interface $resource
- * @param Zend_Acl_Role_Interface $role
- * @param string $privilege
+ * @param Zend_Acl_Resource_Interface|null $resource
+ * @param Zend_Acl_Role_Interface|null $role
+ * @param string $privilege
* @return string|null
*/
- protected function _getRuleType(Zend_Acl_Resource_Interface $resource = null, Zend_Acl_Role_Interface $role = null,
+ protected function _getRuleType($resource = null, $role = null,
$privilege = null)
{
+ Types::isNullable('resource', $resource, 'Zend_Acl_Resource_Interface');
+ Types::isNullable('role', $role, 'Zend_Acl_Role_Interface');
+
// get the rules for the $resource and $role
if (null === ($rules = $this->_getRules($resource, $role))) {
return null;
@@ -1149,14 +1169,17 @@ protected function _getRuleType(Zend_Acl_Resource_Interface $resource = null, Ze
*
* If the $create parameter is true, then a rule set is first created and then returned to the caller.
*
- * @param Zend_Acl_Resource_Interface $resource
- * @param Zend_Acl_Role_Interface $role
- * @param boolean $create
+ * @param Zend_Acl_Resource_Interface|null $resource
+ * @param Zend_Acl_Role_Interface|null $role
+ * @param boolean $create
* @return array|null
*/
- protected function &_getRules(Zend_Acl_Resource_Interface $resource = null, Zend_Acl_Role_Interface $role = null,
+ protected function &_getRules($resource = null, $role = null,
$create = false)
{
+ Types::isNullable('resource', $resource, 'Zend_Acl_Resource_Interface');
+ Types::isNullable('role', $role, 'Zend_Acl_Role_Interface');
+
// create a reference to null
$null = null;
$nullRef =& $null;
diff --git a/packages/zend-acl/library/Zend/Acl/Assert/Interface.php b/packages/zend-acl/library/Zend/Acl/Assert/Interface.php
index 6abd8af81..4f0bf3976 100644
--- a/packages/zend-acl/library/Zend/Acl/Assert/Interface.php
+++ b/packages/zend-acl/library/Zend/Acl/Assert/Interface.php
@@ -54,11 +54,11 @@ interface Zend_Acl_Assert_Interface
* privileges, respectively.
*
* @param Zend_Acl $acl
- * @param Zend_Acl_Role_Interface $role
- * @param Zend_Acl_Resource_Interface $resource
+ * @param null|Zend_Acl_Role_Interface $role
+ * @param null|Zend_Acl_Resource_Interface $resource
* @param string $privilege
* @return boolean
*/
- public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null,
+ public function assert(Zend_Acl $acl, $role = null, $resource = null,
$privilege = null);
}
diff --git a/packages/zend-auth/library/Zend/Auth/Adapter/DbTable.php b/packages/zend-auth/library/Zend/Auth/Adapter/DbTable.php
index 2e00de957..7b113fc02 100644
--- a/packages/zend-auth/library/Zend/Auth/Adapter/DbTable.php
+++ b/packages/zend-auth/library/Zend/Auth/Adapter/DbTable.php
@@ -1,4 +1,7 @@
_setDbAdapter($zendDb);
if (null !== $tableName) {
@@ -158,12 +163,14 @@ public function __construct(Zend_Db_Adapter_Abstract $zendDb = null, $tableName
/**
* _setDbAdapter() - set the database adapter to be used for quering
*
- * @param Zend_Db_Adapter_Abstract
+ * @param Zend_Db_Adapter_Abstract|null $zendDb
* @throws Zend_Auth_Adapter_Exception
* @return Zend_Auth_Adapter_DbTable
*/
- protected function _setDbAdapter(Zend_Db_Adapter_Abstract $zendDb = null)
+ protected function _setDbAdapter($zendDb = null)
{
+ Types::isNullable('zendDb', $zendDb, 'Zend_Db_Adapter_Abstract');
+
$this->_zendDb = $zendDb;
/**
diff --git a/packages/zend-auth/library/Zend/Auth/Adapter/OpenId.php b/packages/zend-auth/library/Zend/Auth/Adapter/OpenId.php
index 37c6b2cb3..3f1d65282 100644
--- a/packages/zend-auth/library/Zend/Auth/Adapter/OpenId.php
+++ b/packages/zend-auth/library/Zend/Auth/Adapter/OpenId.php
@@ -1,4 +1,7 @@
_id = $id;
$this->_storage = $storage;
$this->_returnTo = $returnTo;
diff --git a/packages/zend-cache/library/Zend/Cache.php b/packages/zend-cache/library/Zend/Cache.php
index 987de7100..17d2dbf79 100644
--- a/packages/zend-cache/library/Zend/Cache.php
+++ b/packages/zend-cache/library/Zend/Cache.php
@@ -1,4 +1,7 @@
_label = $label;
}
-
+
/**
* Retrieve the label for the CAPTCHA
* @return string
@@ -62,12 +65,14 @@ public function getLabel()
/**
* Render the captcha
*
- * @param Zend_View_Interface $view
+ * @param Zend_View_Interface|null $view
* @param mixed $element
* @return string
*/
- public function render(Zend_View_Interface $view = null, $element = null)
+ public function render($view = null, $element = null)
{
+ Types::isNullable('view', $view, 'Zend_View_Interface');
+
return $this->getLabel() . ': '
. strrev($this->getWord())
. '';
diff --git a/packages/zend-captcha/library/Zend/Captcha/Figlet.php b/packages/zend-captcha/library/Zend/Captcha/Figlet.php
index 35f9dbdea..fe0022c8f 100644
--- a/packages/zend-captcha/library/Zend/Captcha/Figlet.php
+++ b/packages/zend-captcha/library/Zend/Captcha/Figlet.php
@@ -1,4 +1,7 @@
'
. $this->_figlet->render($this->getWord())
. "\n";
diff --git a/packages/zend-captcha/library/Zend/Captcha/Image.php b/packages/zend-captcha/library/Zend/Captcha/Image.php
index 75f298be8..7d1d543bd 100644
--- a/packages/zend-captcha/library/Zend/Captcha/Image.php
+++ b/packages/zend-captcha/library/Zend/Captcha/Image.php
@@ -1,4 +1,7 @@
';
if (($view instanceof Zend_View_Abstract) && !$view->doctype()->isXhtml()) {
$endTag = '>';
diff --git a/packages/zend-captcha/library/Zend/Captcha/ReCaptcha.php b/packages/zend-captcha/library/Zend/Captcha/ReCaptcha.php
index dfc36f75d..d540ee4f8 100644
--- a/packages/zend-captcha/library/Zend/Captcha/ReCaptcha.php
+++ b/packages/zend-captcha/library/Zend/Captcha/ReCaptcha.php
@@ -1,4 +1,7 @@
getBelongsTo();
diff --git a/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter.php b/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter.php
index a60767fa4..67e097a69 100644
--- a/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter.php
+++ b/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter.php
@@ -72,7 +72,7 @@ public function listCollections($options = null);
* @param null|array $options
* @return Zend_Cloud_DocumentService_DocumentSet
*/
- public function listDocuments($collectionName, array $options = null);
+ public function listDocuments($collectionName, $options = null);
/**
* Insert document
diff --git a/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter/SimpleDb.php b/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter/SimpleDb.php
index aa8f04534..771fb7fa1 100644
--- a/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter/SimpleDb.php
+++ b/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter/SimpleDb.php
@@ -1,4 +1,7 @@
select('*')->from($collectionName);
$items = $this->query($collectionName, $query, $options);
return $items;
diff --git a/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php b/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php
index 837c18328..197c6676d 100644
--- a/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php
+++ b/packages/zend-cloud/library/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php
@@ -1,4 +1,7 @@
select()->from($collectionName);
return $this->query($collectionName, $select);
}
diff --git a/packages/zend-cloud/library/Zend/Cloud/Infrastructure/InstanceList.php b/packages/zend-cloud/library/Zend/Cloud/Infrastructure/InstanceList.php
index f0de0fc70..934aafdaf 100644
--- a/packages/zend-cloud/library/Zend/Cloud/Infrastructure/InstanceList.php
+++ b/packages/zend-cloud/library/Zend/Cloud/Infrastructure/InstanceList.php
@@ -1,4 +1,7 @@
setOptions($options);
}
diff --git a/packages/zend-config/library/Zend/Config/Writer/FileAbstract.php b/packages/zend-config/library/Zend/Config/Writer/FileAbstract.php
index dbf8381da..e3201970c 100644
--- a/packages/zend-config/library/Zend/Config/Writer/FileAbstract.php
+++ b/packages/zend-config/library/Zend/Config/Writer/FileAbstract.php
@@ -1,4 +1,7 @@
setFilename($filename);
}
diff --git a/packages/zend-controller/library/Zend/Controller/Action.php b/packages/zend-controller/library/Zend/Controller/Action.php
index 36664ed27..ad7928955 100644
--- a/packages/zend-controller/library/Zend/Controller/Action.php
+++ b/packages/zend-controller/library/Zend/Controller/Action.php
@@ -1,4 +1,7 @@
setRequest($request);
} else {
@@ -721,13 +727,15 @@ public function getAllParams()
* @param string $action
* @param string $controller
* @param string $module
- * @param array $params
+ * @param array|null $params
* @return void
* @deprecated Deprecated as of Zend Framework 1.7. Use
* forward() instead.
*/
- final protected function _forward($action, $controller = null, $module = null, array $params = null)
+ final protected function _forward($action, $controller = null, $module = null, $params = null)
{
+ Types::isNullable('params', $params, 'array');
+
$this->forward($action, $controller, $module, $params);
}
@@ -754,11 +762,13 @@ final protected function _forward($action, $controller = null, $module = null, a
* @param string $action
* @param string $controller
* @param string $module
- * @param array $params
+ * @param array|null $params
* @return void
*/
- final public function forward($action, $controller = null, $module = null, array $params = null)
+ final public function forward($action, $controller = null, $module = null, $params = null)
{
+ Types::isNullable('params', $params, 'array');
+
$request = $this->getRequest();
if (null !== $params) {
diff --git a/packages/zend-controller/library/Zend/Controller/Action/Helper/Abstract.php b/packages/zend-controller/library/Zend/Controller/Action/Helper/Abstract.php
index d5d6dbc5e..a88bf3ebe 100644
--- a/packages/zend-controller/library/Zend/Controller/Action/Helper/Abstract.php
+++ b/packages/zend-controller/library/Zend/Controller/Action/Helper/Abstract.php
@@ -1,4 +1,7 @@
_actionController = $actionController;
return $this;
}
diff --git a/packages/zend-controller/library/Zend/Controller/Action/Helper/Url.php b/packages/zend-controller/library/Zend/Controller/Action/Helper/Url.php
index ce20f7eaf..2280359b9 100644
--- a/packages/zend-controller/library/Zend/Controller/Action/Helper/Url.php
+++ b/packages/zend-controller/library/Zend/Controller/Action/Helper/Url.php
@@ -1,4 +1,7 @@
getRequest();
if (null === $controller) {
@@ -107,11 +112,13 @@ public function url($urlOptions = array(), $name = null, $reset = false, $encode
* @param string $action
* @param string $controller
* @param string $module
- * @param array $params
+ * @param array|null $params
* @return string
*/
- public function direct($action, $controller = null, $module = null, array $params = null)
+ public function direct($action, $controller = null, $module = null, $params = null)
{
+ Types::isNullable('params', $params, 'array');
+
return $this->simple($action, $controller, $module, $params);
}
}
diff --git a/packages/zend-controller/library/Zend/Controller/Action/Helper/ViewRenderer.php b/packages/zend-controller/library/Zend/Controller/Action/Helper/ViewRenderer.php
index ffc846454..81a53cdc9 100644
--- a/packages/zend-controller/library/Zend/Controller/Action/Helper/ViewRenderer.php
+++ b/packages/zend-controller/library/Zend/Controller/Action/Helper/ViewRenderer.php
@@ -1,4 +1,7 @@
setView($view);
}
@@ -626,7 +631,7 @@ public function getViewScript($action = null, array $vars = array())
} elseif (null !== $action) {
$vars['action'] = $action;
}
-
+
$replacePattern = array('/[^a-z0-9]+$/i', '/^[^a-z0-9]+/i');
$vars['action'] = preg_replace($replacePattern, '', $vars['action']);
diff --git a/packages/zend-controller/library/Zend/Controller/Dispatcher/Abstract.php b/packages/zend-controller/library/Zend/Controller/Dispatcher/Abstract.php
index 9feb1520a..3b7a5c25a 100644
--- a/packages/zend-controller/library/Zend/Controller/Dispatcher/Abstract.php
+++ b/packages/zend-controller/library/Zend/Controller/Dispatcher/Abstract.php
@@ -1,4 +1,7 @@
_response = $response;
return $this;
}
diff --git a/packages/zend-controller/library/Zend/Controller/Dispatcher/Interface.php b/packages/zend-controller/library/Zend/Controller/Dispatcher/Interface.php
index 2c1b88dd2..9b0e0cc99 100644
--- a/packages/zend-controller/library/Zend/Controller/Dispatcher/Interface.php
+++ b/packages/zend-controller/library/Zend/Controller/Dispatcher/Interface.php
@@ -129,7 +129,7 @@ public function clearParams($name = null);
* @param Zend_Controller_Response_Abstract|null $response
* @return void
*/
- public function setResponse(Zend_Controller_Response_Abstract $response = null);
+ public function setResponse($response = null);
/**
* Retrieve the response object, if any
diff --git a/packages/zend-controller/library/Zend/Controller/Front.php b/packages/zend-controller/library/Zend/Controller/Front.php
index 554f3dbae..b3f09904a 100644
--- a/packages/zend-controller/library/Zend/Controller/Front.php
+++ b/packages/zend-controller/library/Zend/Controller/Front.php
@@ -1,4 +1,7 @@
getParam('noErrorHandler') && !$this->_plugins->hasPlugin('Zend_Controller_Plugin_ErrorHandler')) {
// Register with stack index of 100
// require_once 'Zend/Controller/Plugin/ErrorHandler.php';
diff --git a/packages/zend-controller/library/Zend/Controller/Plugin/ActionStack.php b/packages/zend-controller/library/Zend/Controller/Plugin/ActionStack.php
index 3b800cc19..55427a472 100644
--- a/packages/zend-controller/library/Zend/Controller/Plugin/ActionStack.php
+++ b/packages/zend-controller/library/Zend/Controller/Plugin/ActionStack.php
@@ -1,4 +1,7 @@
_request = $request;
foreach ($this->_routes as $route) {
diff --git a/packages/zend-controller/library/Zend/Controller/Router/Route/Hostname.php b/packages/zend-controller/library/Zend/Controller/Router/Route/Hostname.php
index 1e816cab6..6e2d4cdc9 100644
--- a/packages/zend-controller/library/Zend/Controller/Router/Route/Hostname.php
+++ b/packages/zend-controller/library/Zend/Controller/Router/Route/Hostname.php
@@ -1,4 +1,7 @@
_request = $request;
}
diff --git a/packages/zend-crypt/library/Zend/Crypt/Rsa.php b/packages/zend-crypt/library/Zend/Crypt/Rsa.php
index 78fc118be..3f147eb52 100644
--- a/packages/zend-crypt/library/Zend/Crypt/Rsa.php
+++ b/packages/zend-crypt/library/Zend/Crypt/Rsa.php
@@ -1,4 +1,7 @@
getOpensslKeyResource();
@@ -202,14 +209,16 @@ public function decrypt($data, Zend_Crypt_Rsa_Key $key, $format = null)
}
/**
- * @param array $configargs
- *
+ * @param array|null $configargs
+ *
* @throws Zend_Crypt_Rsa_Exception
- *
+ *
* @return ArrayObject
*/
- public function generateKeys(array $configargs = null)
+ public function generateKeys($configargs = null)
{
+ Types::isNullable('configargs', $configargs, 'array');
+
$config = null;
$passPhrase = null;
if ($configargs !== null) {
@@ -320,8 +329,10 @@ public function getHashAlgorithm()
return $this->_hashAlgorithm;
}
- protected function _parseConfigArgs(array $config = null)
+ protected function _parseConfigArgs($config = null)
{
+ Types::isNullable('config', $config, 'array');
+
$configs = array();
if (isset($config['private_key_bits'])) {
$configs['private_key_bits'] = $config['private_key_bits'];
diff --git a/packages/zend-db/library/Zend/Db/Adapter/Db2/Exception.php b/packages/zend-db/library/Zend/Db/Adapter/Db2/Exception.php
index 5d98df1a0..b7d8a8404 100644
--- a/packages/zend-db/library/Zend/Db/Adapter/Db2/Exception.php
+++ b/packages/zend-db/library/Zend/Db/Adapter/Db2/Exception.php
@@ -1,4 +1,7 @@
getCode();
}
diff --git a/packages/zend-db/library/Zend/Db/Statement.php b/packages/zend-db/library/Zend/Db/Statement.php
index 140daf968..d50123ca4 100644
--- a/packages/zend-db/library/Zend/Db/Statement.php
+++ b/packages/zend-db/library/Zend/Db/Statement.php
@@ -1,4 +1,7 @@
_adapter->quote('a');
- $q = $q[0];
+ $q = $q[0];
// get the value used as an escaped quote,
// e.g. \' or ''
$qe = $this->_adapter->quote($q);
@@ -193,7 +196,7 @@ protected function _stripQuoted($sql)
// this segfaults only after 65,000 characters instead of 9,000
$sql = preg_replace("/$q([^$q{$escapeChar}]*|($qe)*)*$q/s", '', $sql);
}
-
+
// get a version of the SQL statement with all quoted
// values and delimited identifiers stripped out
// remove "foo\"bar"
@@ -291,11 +294,13 @@ public function bindValue($parameter, $value, $type = null)
/**
* Executes a prepared statement.
*
- * @param array $params OPTIONAL Values to bind to parameter placeholders.
+ * @param array|null $params OPTIONAL Values to bind to parameter placeholders.
* @return bool
*/
- public function execute(array $params = null)
+ public function execute($params = null)
{
+ Types::isNullable('params', $params, 'array');
+
/*
* Simple case - no query profiler to manage.
*/
diff --git a/packages/zend-db/library/Zend/Db/Statement/Db2.php b/packages/zend-db/library/Zend/Db/Statement/Db2.php
index c7abd36d5..41ed0bd31 100644
--- a/packages/zend-db/library/Zend/Db/Statement/Db2.php
+++ b/packages/zend-db/library/Zend/Db/Statement/Db2.php
@@ -1,4 +1,7 @@
_stmt) {
return false;
}
diff --git a/packages/zend-db/library/Zend/Db/Statement/Mysqli.php b/packages/zend-db/library/Zend/Db/Statement/Mysqli.php
index 648af560b..22d95823d 100644
--- a/packages/zend-db/library/Zend/Db/Statement/Mysqli.php
+++ b/packages/zend-db/library/Zend/Db/Statement/Mysqli.php
@@ -1,4 +1,7 @@
_stmt) {
return false;
}
diff --git a/packages/zend-db/library/Zend/Db/Statement/Oracle.php b/packages/zend-db/library/Zend/Db/Statement/Oracle.php
index aae0a55be..713d0d220 100644
--- a/packages/zend-db/library/Zend/Db/Statement/Oracle.php
+++ b/packages/zend-db/library/Zend/Db/Statement/Oracle.php
@@ -1,4 +1,7 @@
_adapter->getConnection();
if (!$this->_stmt) {
diff --git a/packages/zend-db/library/Zend/Db/Statement/Pdo.php b/packages/zend-db/library/Zend/Db/Statement/Pdo.php
index 310b283d4..71cfe464b 100644
--- a/packages/zend-db/library/Zend/Db/Statement/Pdo.php
+++ b/packages/zend-db/library/Zend/Db/Statement/Pdo.php
@@ -1,4 +1,7 @@
_stmt->execute($params);
diff --git a/packages/zend-db/library/Zend/Db/Statement/Sqlsrv.php b/packages/zend-db/library/Zend/Db/Statement/Sqlsrv.php
index ddb27d245..a4a843ef4 100644
--- a/packages/zend-db/library/Zend/Db/Statement/Sqlsrv.php
+++ b/packages/zend-db/library/Zend/Db/Statement/Sqlsrv.php
@@ -1,4 +1,7 @@
_adapter->getConnection();
if (!$this->_stmt) {
return false;
@@ -376,7 +381,7 @@ public function nextRowset()
// require_once 'Zend/Db/Statement/Sqlsrv/Exception.php';
throw new Zend_Db_Statement_Sqlsrv_Exception(sqlsrv_errors());
}
-
+
// reset column keys
$this->_keys = null;
@@ -411,7 +416,7 @@ public function rowCount()
return $num_rows;
}
-
+
/**
* Returns an array containing all of the result set rows.
*
diff --git a/packages/zend-db/library/Zend/Db/Table/Abstract.php b/packages/zend-db/library/Zend/Db/Table/Abstract.php
index 9599a1509..7d2ae92dc 100644
--- a/packages/zend-db/library/Zend/Db/Table/Abstract.php
+++ b/packages/zend-db/library/Zend/Db/Table/Abstract.php
@@ -1,4 +1,7 @@
getDefinition();
diff --git a/packages/zend-db/library/Zend/Db/Table/Row/Abstract.php b/packages/zend-db/library/Zend/Db/Table/Row/Abstract.php
index 5032d669d..e51533077 100644
--- a/packages/zend-db/library/Zend/Db/Table/Row/Abstract.php
+++ b/packages/zend-db/library/Zend/Db/Table/Row/Abstract.php
@@ -1,4 +1,7 @@
_table = null;
$this->_connected = false;
@@ -876,12 +881,14 @@ protected function _prepareReference(Zend_Db_Table_Abstract $dependentTable, Zen
*
* @param string|Zend_Db_Table_Abstract $dependentTable
* @param string OPTIONAL $ruleKey
- * @param Zend_Db_Table_Select OPTIONAL $select
+ * @param Zend_Db_Table_Select|null OPTIONAL $select
* @return Zend_Db_Table_Rowset_Abstract Query result from $dependentTable
* @throws Zend_Db_Table_Row_Exception If $dependentTable is not a table or is not loadable.
*/
- public function findDependentRowset($dependentTable, $ruleKey = null, Zend_Db_Table_Select $select = null)
+ public function findDependentRowset($dependentTable, $ruleKey = null, $select = null)
{
+ Types::isNullable('select', $select, 'Zend_Db_Table_Select');
+
$db = $this->_getTable()->getAdapter();
if (is_string($dependentTable)) {
@@ -932,12 +939,14 @@ public function findDependentRowset($dependentTable, $ruleKey = null, Zend_Db_Ta
*
* @param string|Zend_Db_Table_Abstract $parentTable
* @param string OPTIONAL $ruleKey
- * @param Zend_Db_Table_Select OPTIONAL $select
+ * @param Zend_Db_Table_Select|null OPTIONAL $select
* @return Zend_Db_Table_Row_Abstract Query result from $parentTable
* @throws Zend_Db_Table_Row_Exception If $parentTable is not a table or is not loadable.
*/
- public function findParentRow($parentTable, $ruleKey = null, Zend_Db_Table_Select $select = null)
+ public function findParentRow($parentTable, $ruleKey = null, $select = null)
{
+ Types::isNullable('select', $select, 'Zend_Db_Table_Select');
+
$db = $this->_getTable()->getAdapter();
if (is_string($parentTable)) {
@@ -999,13 +1008,15 @@ public function findParentRow($parentTable, $ruleKey = null, Zend_Db_Table_Selec
* @param string|Zend_Db_Table_Abstract $intersectionTable
* @param string OPTIONAL $callerRefRule
* @param string OPTIONAL $matchRefRule
- * @param Zend_Db_Table_Select OPTIONAL $select
+ * @param Zend_Db_Table_Select|null OPTIONAL $select
* @return Zend_Db_Table_Rowset_Abstract Query result from $matchTable
* @throws Zend_Db_Table_Row_Exception If $matchTable or $intersectionTable is not a table class or is not loadable.
*/
public function findManyToManyRowset($matchTable, $intersectionTable, $callerRefRule = null,
- $matchRefRule = null, Zend_Db_Table_Select $select = null)
+ $matchRefRule = null, $select = null)
{
+ Types::isNullable('select', $select, 'Zend_Db_Table_Select');
+
$db = $this->_getTable()->getAdapter();
if (is_string($intersectionTable)) {
diff --git a/packages/zend-dojo/library/Zend/Dojo/Form.php b/packages/zend-dojo/library/Zend/Dojo/Form.php
index c909fc686..fc333ec34 100644
--- a/packages/zend-dojo/library/Zend/Dojo/Form.php
+++ b/packages/zend-dojo/library/Zend/Dojo/Form.php
@@ -1,4 +1,7 @@
getPluginLoader('helper')->getPaths('Zend_Dojo_View_Helper')) {
$view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper');
diff --git a/packages/zend-dojo/library/Zend/Dojo/Form/DisplayGroup.php b/packages/zend-dojo/library/Zend/Dojo/Form/DisplayGroup.php
index 56f763c82..f9e80e83e 100644
--- a/packages/zend-dojo/library/Zend/Dojo/Form/DisplayGroup.php
+++ b/packages/zend-dojo/library/Zend/Dojo/Form/DisplayGroup.php
@@ -1,4 +1,7 @@
getPluginLoader('helper')->getPaths('Zend_Dojo_View_Helper')) {
$view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper');
diff --git a/packages/zend-dojo/library/Zend/Dojo/Form/Element/Dijit.php b/packages/zend-dojo/library/Zend/Dojo/Form/Element/Dijit.php
index f56cfc80a..5ccd642ec 100644
--- a/packages/zend-dojo/library/Zend/Dojo/Form/Element/Dijit.php
+++ b/packages/zend-dojo/library/Zend/Dojo/Form/Element/Dijit.php
@@ -1,4 +1,7 @@
getPluginLoader('helper')->getPaths('Zend_Dojo_View_Helper')) {
$view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper');
diff --git a/packages/zend-eventmanager/library/Zend/EventManager/GlobalEventManager.php b/packages/zend-eventmanager/library/Zend/EventManager/GlobalEventManager.php
index 7e24c40ef..17110ba21 100644
--- a/packages/zend-eventmanager/library/Zend/EventManager/GlobalEventManager.php
+++ b/packages/zend-eventmanager/library/Zend/EventManager/GlobalEventManager.php
@@ -1,4 +1,7 @@
_detectVerifyTokenKey($httpGetData);
if (empty($verifyTokenKey)) {
return false;
@@ -264,8 +271,10 @@ protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue =
* @param null|array $httpGetData
* @return false|string
*/
- protected function _detectVerifyTokenKey(array $httpGetData = null)
+ protected function _detectVerifyTokenKey($httpGetData = null)
{
+ Types::isNullable('httpGetData', $httpGetData, 'array');
+
/**
* Available when sub keys encoding in Callback URL path
*/
diff --git a/packages/zend-feed/library/Zend/Feed/Reader/Extension/FeedAbstract.php b/packages/zend-feed/library/Zend/Feed/Reader/Extension/FeedAbstract.php
index caa6af776..69411f443 100644
--- a/packages/zend-feed/library/Zend/Feed/Reader/Extension/FeedAbstract.php
+++ b/packages/zend-feed/library/Zend/Feed/Reader/Extension/FeedAbstract.php
@@ -1,4 +1,7 @@
_domDocument = $dom;
if ($type !== null) {
diff --git a/packages/zend-filter/library/Zend/Filter/Input.php b/packages/zend-filter/library/Zend/Filter/Input.php
index 22a888a30..156893c27 100644
--- a/packages/zend-filter/library/Zend/Filter/Input.php
+++ b/packages/zend-filter/library/Zend/Filter/Input.php
@@ -1,4 +1,7 @@
setOptions($options);
}
@@ -801,8 +807,8 @@ protected function _validate()
$this->_data = array();
return;
}
-
- // remember the default not empty message in case we want to temporarily change it
+
+ // remember the default not empty message in case we want to temporarily change it
$preserveDefaultNotEmptyMessage = $this->_defaults[self::NOT_EMPTY_MESSAGE];
foreach ($this->_validatorRules as $ruleName => &$validatorRule) {
@@ -840,14 +846,14 @@ protected function _validate()
}
if (!isset($validatorRule[self::ALLOW_EMPTY])) {
$foundNotEmptyValidator = false;
-
+
foreach ($validatorRule as $rule) {
if ($rule === 'NotEmpty') {
$foundNotEmptyValidator = true;
// field may not be empty, we are ready
break 1;
}
-
+
if (is_array($rule)) {
$keys = array_keys($rule);
$classKey = array_shift($keys);
@@ -866,14 +872,14 @@ protected function _validate()
// it cannot be a NotEmpty validator, skip this one
continue;
}
-
+
if($rule instanceof Zend_Validate_NotEmpty) {
$foundNotEmptyValidator = true;
// field may not be empty, we are ready
break 1;
}
}
-
+
if (!$foundNotEmptyValidator) {
$validatorRule[self::ALLOW_EMPTY] = $this->_defaults[self::ALLOW_EMPTY];
} else {
@@ -923,7 +929,7 @@ protected function _validate()
/** we are changing the defaults here, this is alright if all subsequent validators are also a not empty
* validator, but it goes wrong if one of them is not AND is required!!!
* that is why we restore the default value at the end of this loop
- */
+ */
if (is_array($value)) {
$temp = $value; // keep the original value
$this->_defaults[self::NOT_EMPTY_MESSAGE] = array_pop($temp);
@@ -951,11 +957,11 @@ protected function _validate()
} else {
$this->_validateRule($validatorRule);
}
-
+
// reset the default not empty message
$this->_defaults[self::NOT_EMPTY_MESSAGE] = $preserveDefaultNotEmptyMessage;
}
-
+
/**
@@ -1035,8 +1041,8 @@ protected function _validateRule(array $validatorRule)
if (!($notEmptyValidator = $this->_getNotEmptyValidatorInstance($validatorRule))) {
$notEmptyValidator = $this->_getValidator('NotEmpty');
$notEmptyValidator->setMessage($this->_getNotEmptyMessage($validatorRule[self::RULE], $fieldKey));
- }
-
+ }
+
if (!$notEmptyValidator->isValid($field)) {
foreach ($notEmptyValidator->getMessages() as $messageKey => $message) {
if (!isset($messages[$messageKey])) {
@@ -1078,7 +1084,7 @@ protected function _validateRule(array $validatorRule)
$notEmptyValidator = $this->_getValidator('NotEmpty');
$notEmptyValidator->setMessage($this->_getNotEmptyMessage($validatorRule[self::RULE], $fieldName));
}
-
+
if ($validatorRule[self::ALLOW_EMPTY]) {
$validatorChain = $validatorRule[self::VALIDATOR_CHAIN];
} else {
@@ -1136,10 +1142,10 @@ protected function _validateRule(array $validatorRule)
}
}
}
-
+
/**
* Check a validatorRule for the presence of a NotEmpty validator instance.
- * The purpose is to preserve things like a custom message, that may have been
+ * The purpose is to preserve things like a custom message, that may have been
* set on the validator outside Zend_Filter_Input.
* @param array $validatorRule
* @return mixed false if none is found, Zend_Validate_NotEmpty instance if found
@@ -1150,7 +1156,7 @@ protected function _getNotEmptyValidatorInstance($validatorRule) {
return $value;
}
}
-
+
return false;
}
diff --git a/packages/zend-filter/library/Zend/Filter/LocalizedToNormalized.php b/packages/zend-filter/library/Zend/Filter/LocalizedToNormalized.php
index 4ca66501c..5955f0ef7 100644
--- a/packages/zend-filter/library/Zend/Filter/LocalizedToNormalized.php
+++ b/packages/zend-filter/library/Zend/Filter/LocalizedToNormalized.php
@@ -1,4 +1,7 @@
_options = $options + $this->_options;
return $this;
}
diff --git a/packages/zend-filter/library/Zend/Filter/NormalizedToLocalized.php b/packages/zend-filter/library/Zend/Filter/NormalizedToLocalized.php
index e2e377f1f..7753fcd0a 100644
--- a/packages/zend-filter/library/Zend/Filter/NormalizedToLocalized.php
+++ b/packages/zend-filter/library/Zend/Filter/NormalizedToLocalized.php
@@ -1,4 +1,7 @@
_options = $options + $this->_options;
return $this;
}
diff --git a/packages/zend-form/library/Zend/Form.php b/packages/zend-form/library/Zend/Form.php
index a5b412d3c..0b0c4f908 100644
--- a/packages/zend-form/library/Zend/Form.php
+++ b/packages/zend-form/library/Zend/Form.php
@@ -1,4 +1,7 @@
$spec) {
+ foreach ($subForms as $key => $spec) {
$name = (string) $key;
if ($spec instanceof Zend_Form) {
$this->addSubForm($spec, $name);
@@ -2671,11 +2674,13 @@ public function getCustomMessages()
/**
* Set view object
*
- * @param Zend_View_Interface $view
+ * @param Zend_View_Interface|null $view
* @return Zend_Form
*/
- public function setView(Zend_View_Interface $view = null)
+ public function setView($view = null)
{
+ Types::isNullable('view', $view, 'Zend_View_Interface');
+
$this->_view = $view;
return $this;
}
@@ -2912,8 +2917,10 @@ public function clearDecorators()
* @param bool $include Whether $elements is an inclusion or exclusion list
* @return Zend_Form
*/
- public function setElementDecorators(array $decorators, array $elements = null, $include = true)
+ public function setElementDecorators(array $decorators, $elements = null, $include = true)
{
+ Types::isNullable('elements', $elements, 'array');
+
if (is_array($elements)) {
if ($include) {
$elementObjs = array();
@@ -2979,11 +2986,13 @@ public function setSubFormDecorators(array $decorators)
/**
* Render form
*
- * @param Zend_View_Interface $view
+ * @param Zend_View_Interface|null $view
* @return string
*/
- public function render(Zend_View_Interface $view = null)
+ public function render($view = null)
{
+ Types::isNullable('view', $view, 'Zend_View_Interface');
+
if (null !== $view) {
$this->setView($view);
}
diff --git a/packages/zend-form/library/Zend/Form/Decorator/HtmlTag.php b/packages/zend-form/library/Zend/Form/Decorator/HtmlTag.php
index a5ca21ff1..33ca1609c 100644
--- a/packages/zend-form/library/Zend/Form/Decorator/HtmlTag.php
+++ b/packages/zend-form/library/Zend/Form/Decorator/HtmlTag.php
@@ -1,4 +1,7 @@
_htmlAttribs($attribs);
diff --git a/packages/zend-form/library/Zend/Form/DisplayGroup.php b/packages/zend-form/library/Zend/Form/DisplayGroup.php
index 35efe1c24..d32d26563 100644
--- a/packages/zend-form/library/Zend/Form/DisplayGroup.php
+++ b/packages/zend-form/library/Zend/Form/DisplayGroup.php
@@ -1,4 +1,7 @@
_view = $view;
return $this;
}
@@ -915,8 +920,10 @@ public function getView()
*
* @return string
*/
- public function render(Zend_View_Interface $view = null)
+ public function render($view = null)
{
+ Types::isNullable('view', $view, 'Zend_View_Interface');
+
if (null !== $view) {
$this->setView($view);
}
diff --git a/packages/zend-form/library/Zend/Form/Element.php b/packages/zend-form/library/Zend/Form/Element.php
index b0ab28416..e431193bc 100644
--- a/packages/zend-form/library/Zend/Form/Element.php
+++ b/packages/zend-form/library/Zend/Form/Element.php
@@ -1,4 +1,7 @@
_view = $view;
return $this;
}
@@ -2053,11 +2058,13 @@ public function clearDecorators()
/**
* Render form element
*
- * @param Zend_View_Interface $view
+ * @param Zend_View_Interface|null $view
* @return string
*/
- public function render(Zend_View_Interface $view = null)
+ public function render($view = null)
{
+ Types::isNullable('view', $view, 'Zend_View_Interface');
+
if ($this->_isPartialRendering) {
return '';
}
diff --git a/packages/zend-form/library/Zend/Form/Element/Captcha.php b/packages/zend-form/library/Zend/Form/Element/Captcha.php
index 9c950bcce..b1a175e0b 100644
--- a/packages/zend-form/library/Zend/Form/Element/Captcha.php
+++ b/packages/zend-form/library/Zend/Form/Element/Captcha.php
@@ -1,4 +1,7 @@
getCaptcha();
$captcha->setName($this->getFullyQualifiedName());
diff --git a/packages/zend-form/library/Zend/Form/Element/File.php b/packages/zend-form/library/Zend/Form/Element/File.php
index c2ee9bc6e..2a8391b27 100644
--- a/packages/zend-form/library/Zend/Form/Element/File.php
+++ b/packages/zend-form/library/Zend/Form/Element/File.php
@@ -1,4 +1,7 @@
getDecorators() as $decorator) {
if ($decorator instanceof Zend_Form_Decorator_Marker_File_Interface) {
diff --git a/packages/zend-form/library/Zend/Form/Element/Hash.php b/packages/zend-form/library/Zend/Form/Element/Hash.php
index 8dbff1b8e..275731fac 100644
--- a/packages/zend-form/library/Zend/Form/Element/Hash.php
+++ b/packages/zend-form/library/Zend/Form/Element/Hash.php
@@ -1,4 +1,7 @@
initCsrfToken();
return parent::render($view);
}
diff --git a/packages/zend-layout/library/Zend/Layout/Controller/Action/Helper/Layout.php b/packages/zend-layout/library/Zend/Layout/Controller/Action/Helper/Layout.php
index b4d7da0ab..1c1b84d1f 100644
--- a/packages/zend-layout/library/Zend/Layout/Controller/Action/Helper/Layout.php
+++ b/packages/zend-layout/library/Zend/Layout/Controller/Action/Helper/Layout.php
@@ -1,4 +1,7 @@
setLayoutInstance($layout);
} else {
diff --git a/packages/zend-layout/library/Zend/Layout/Controller/Plugin/Layout.php b/packages/zend-layout/library/Zend/Layout/Controller/Plugin/Layout.php
index b596d6f47..63969f321 100644
--- a/packages/zend-layout/library/Zend/Layout/Controller/Plugin/Layout.php
+++ b/packages/zend-layout/library/Zend/Layout/Controller/Plugin/Layout.php
@@ -1,4 +1,7 @@
setLayout($layout);
}
diff --git a/packages/zend-ldap/library/Zend/Ldap.php b/packages/zend-ldap/library/Zend/Ldap.php
index a6091ec29..a13be9b13 100644
--- a/packages/zend-ldap/library/Zend/Ldap.php
+++ b/packages/zend-ldap/library/Zend/Ldap.php
@@ -1,5 +1,7 @@
isConnection($this->_resource)) {
return 0;
}
-
+
$ret = @ldap_get_option($this->_resource, LDAP_OPT_ERROR_NUMBER, $err);
if ($ret === true) {
if ($err <= -1 && $err >= -17) {
@@ -639,12 +641,14 @@ public function getCanonicalAccountName($acctname, $form = 0)
}
/**
- * @param array $attrs An array of names of desired attributes
+ * @param array|null $attrs An array of names of desired attributes
* @return array An array of the attributes representing the account
* @throws Zend_Ldap_Exception
*/
- protected function _getAccount($acctname, array $attrs = null)
+ protected function _getAccount($acctname, $attrs = null)
{
+ Types::isNullable('attrs', $attrs, 'array');
+
$baseDn = $this->getBaseDn();
if (!$baseDn) {
/**
@@ -708,7 +712,7 @@ public function disconnect()
$this->_boundUser = false;
return $this;
}
-
+
/**
* @param $resource
*
@@ -719,7 +723,7 @@ public function isConnection($resource)
if (PHP_VERSION_ID < 80100) {
return is_resource($resource);
}
-
+
return $resource instanceof \LDAP\Connection;
}
@@ -1018,11 +1022,11 @@ public function search($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB,
*/
// require_once 'Zend/Ldap/Collection/Iterator/Default.php';
$iterator = new Zend_Ldap_Collection_Iterator_Default($this, $search);
-
+
if ($sort !== null && is_string($sort)) {
$iterator->sort($sort);
}
-
+
return $this->_createCollection($iterator, $collectionClass);
}
diff --git a/packages/zend-ldap/library/Zend/Ldap/Exception.php b/packages/zend-ldap/library/Zend/Ldap/Exception.php
index 74b1a3ee4..ff243184f 100644
--- a/packages/zend-ldap/library/Zend/Ldap/Exception.php
+++ b/packages/zend-ldap/library/Zend/Ldap/Exception.php
@@ -1,4 +1,7 @@
getLastErrorCode();
}
diff --git a/packages/zend-ldap/library/Zend/Ldap/Node.php b/packages/zend-ldap/library/Zend/Ldap/Node.php
index 6d742f5ab..140f8e38b 100644
--- a/packages/zend-ldap/library/Zend/Ldap/Node.php
+++ b/packages/zend-ldap/library/Zend/Ldap/Node.php
@@ -1,4 +1,7 @@
attachLdap($ldap);
else $this->detachLdap();
@@ -415,12 +420,14 @@ public function willBeMoved()
/**
* Sends all pending changes to the LDAP server
*
- * @param Zend_Ldap $ldap
+ * @param Zend_Ldap|null $ldap
* @return Zend_Ldap_Node Provides a fluent interface
* @throws Zend_Ldap_Exception
*/
- public function update(Zend_Ldap $ldap = null)
+ public function update($ldap = null)
{
+ Types::isNullable('ldap', $ldap, 'Zend_Ldap');
+
if ($ldap !== null) {
$this->attachLdap($ldap);
}
@@ -903,12 +910,14 @@ public function offsetUnset($name)
*
* This is an online method.
*
- * @param Zend_Ldap $ldap
+ * @param Zend_Ldap|null $ldap
* @return boolean
* @throws Zend_Ldap_Exception
*/
- public function exists(Zend_Ldap $ldap = null)
+ public function exists($ldap = null)
{
+ Types::isNullable('ldap', $ldap, 'Zend_Ldap');
+
if ($ldap !== null) {
$this->attachLdap($ldap);
}
@@ -921,12 +930,14 @@ public function exists(Zend_Ldap $ldap = null)
*
* This is an online method.
*
- * @param Zend_Ldap $ldap
+ * @param Zend_Ldap|null $ldap
* @return Zend_Ldap_Node Provides a fluent interface
* @throws Zend_Ldap_Exception
*/
- public function reload(Zend_Ldap $ldap = null)
+ public function reload($ldap = null)
{
+ Types::isNullable('ldap', $ldap, 'Zend_Ldap');
+
if ($ldap !== null) {
$this->attachLdap($ldap);
}
@@ -1053,12 +1064,14 @@ public function getChildren()
/**
* Returns the parent of the current node.
*
- * @param Zend_Ldap $ldap
+ * @param Zend_Ldap|null $ldap
* @return Zend_Ldap_Node
* @throws Zend_Ldap_Exception
*/
- public function getParent(Zend_Ldap $ldap = null)
+ public function getParent($ldap = null)
{
+ Types::isNullable('ldap', $ldap, 'Zend_Ldap');
+
if ($ldap !== null) {
$this->attachLdap($ldap);
}
diff --git a/packages/zend-ldap/library/Zend/Ldap/Node/Abstract.php b/packages/zend-ldap/library/Zend/Ldap/Node/Abstract.php
index cb7bc48c5..d06c9a55b 100644
--- a/packages/zend-ldap/library/Zend/Ldap/Node/Abstract.php
+++ b/packages/zend-ldap/library/Zend/Ldap/Node/Abstract.php
@@ -1,4 +1,7 @@
getEntry($this->_getDn(), array('*', '+'), true);
$this->_loadData($data, true);
diff --git a/packages/zend-log/library/Zend/Log.php b/packages/zend-log/library/Zend/Log.php
index c62972b8e..d974d1fb1 100644
--- a/packages/zend-log/library/Zend/Log.php
+++ b/packages/zend-log/library/Zend/Log.php
@@ -1,4 +1,7 @@
_priorities = array_flip($r->getConstants());
diff --git a/packages/zend-log/library/Zend/Log/Writer/Mail.php b/packages/zend-log/library/Zend/Log/Writer/Mail.php
index 24a6c5a0c..ab8e4f45c 100644
--- a/packages/zend-log/library/Zend/Log/Writer/Mail.php
+++ b/packages/zend-log/library/Zend/Log/Writer/Mail.php
@@ -1,4 +1,7 @@
_layout->events will be set for use in the layout template.
*
* @param Zend_Mail $mail Mail instance
- * @param Zend_Layout $layout Layout instance; optional
+ * @param Zend_Layout|null $layout Layout instance; optional
* @return void
*/
- public function __construct(Zend_Mail $mail, Zend_Layout $layout = null)
+ public function __construct(Zend_Mail $mail, $layout = null)
{
+ Types::isNullable('layout', $layout, 'Zend_Layout');
+
$this->_mail = $mail;
if (null !== $layout) {
$this->setLayout($layout);
diff --git a/packages/zend-mail/library/Zend/Mail/Transport/Sendmail.php b/packages/zend-mail/library/Zend/Mail/Transport/Sendmail.php
index 8cc758603..75bfcc563 100644
--- a/packages/zend-mail/library/Zend/Mail/Transport/Sendmail.php
+++ b/packages/zend-mail/library/Zend/Mail/Transport/Sendmail.php
@@ -1,4 +1,7 @@
_errstr = $errstr;
return true;
}
diff --git a/packages/zend-mobile/library/Zend/Mobile/Push/Response/Gcm.php b/packages/zend-mobile/library/Zend/Mobile/Push/Response/Gcm.php
index 99aebaecc..d3291a661 100644
--- a/packages/zend-mobile/library/Zend/Mobile/Push/Response/Gcm.php
+++ b/packages/zend-mobile/library/Zend/Mobile/Push/Response/Gcm.php
@@ -1,4 +1,7 @@
array(
+ * 'registration_id' => array(
* 'message_id' => 'id',
* 'error' => 'error',
* 'registration_id' => 'id'
diff --git a/packages/zend-navigation/library/Zend/Navigation/Page.php b/packages/zend-navigation/library/Zend/Navigation/Page.php
index 4fab3993f..fad69a475 100644
--- a/packages/zend-navigation/library/Zend/Navigation/Page.php
+++ b/packages/zend-navigation/library/Zend/Navigation/Page.php
@@ -1,4 +1,7 @@
_fragment = $fragment;
return $this;
}
-
+
/**
* Returns fragment identifier
*
@@ -537,7 +540,7 @@ public function setAccesskey($character = null)
'Invalid argument: $character must be a single character or null'
);
}
-
+
$this->_accesskey = $character;
return $this;
}
@@ -1000,13 +1003,15 @@ public function getVisible($recursive = false)
/**
* Sets parent container
*
- * @param Zend_Navigation_Container $parent [optional] new parent to set.
+ * @param Zend_Navigation_Container|null $parent [optional] new parent to set.
* Default is null which will set
* no parent.
* @return Zend_Navigation_Page fluent interface, returns self
*/
- public function setParent(Zend_Navigation_Container $parent = null)
+ public function setParent($parent = null)
{
+ Types::isNullable('parent', $parent, 'Zend_Navigation_Container');
+
if ($parent === $this) {
// require_once 'Zend/Navigation/Exception.php';
throw new Zend_Navigation_Exception(
diff --git a/packages/zend-navigation/library/Zend/Navigation/Page/Mvc.php b/packages/zend-navigation/library/Zend/Navigation/Page/Mvc.php
index 70e4632be..ceb3fb2f1 100644
--- a/packages/zend-navigation/library/Zend/Navigation/Page/Mvc.php
+++ b/packages/zend-navigation/library/Zend/Navigation/Page/Mvc.php
@@ -1,4 +1,7 @@
clearParams();
if (is_array($params)) {
diff --git a/packages/zend-oauth/library/Zend/Oauth/Consumer.php b/packages/zend-oauth/library/Zend/Oauth/Consumer.php
index 35f053c47..031bcefd7 100644
--- a/packages/zend-oauth/library/Zend/Oauth/Consumer.php
+++ b/packages/zend-oauth/library/Zend/Oauth/Consumer.php
@@ -1,4 +1,7 @@
isValid()) {
// require_once 'Zend/Oauth/Exception.php';
diff --git a/packages/zend-oauth/library/Zend/Oauth/Http.php b/packages/zend-oauth/library/Zend/Oauth/Http.php
index 7ffdc3834..431a305fd 100644
--- a/packages/zend-oauth/library/Zend/Oauth/Http.php
+++ b/packages/zend-oauth/library/Zend/Oauth/Http.php
@@ -1,4 +1,7 @@
_consumer = $consumer;
$this->_preferredRequestScheme = $this->_consumer->getRequestScheme();
if ($parameters !== null) {
@@ -216,12 +222,14 @@ public function getRequestSchemeQueryStringClient(array $params, $url)
* Manages the switch from OAuth request scheme to another lower preference
* scheme during a request cycle.
*
- * @param Zend_Http_Response
+ * @param Zend_Http_Response|null $response
* @return void
* @throws Zend_Oauth_Exception if unable to retrieve valid token response
*/
- protected function _assessRequestAttempt(Zend_Http_Response $response = null)
+ protected function _assessRequestAttempt($response = null)
{
+ Types::isNullable('response', $response, 'Zend_Http_Response');
+
switch ($this->_preferredRequestScheme) {
case Zend_Oauth::REQUEST_SCHEME_HEADER:
$this->_preferredRequestScheme = Zend_Oauth::REQUEST_SCHEME_POSTBODY;
diff --git a/packages/zend-oauth/library/Zend/Oauth/Http/Utility.php b/packages/zend-oauth/library/Zend/Oauth/Http/Utility.php
index 9d65f0814..b41079299 100644
--- a/packages/zend-oauth/library/Zend/Oauth/Http/Utility.php
+++ b/packages/zend-oauth/library/Zend/Oauth/Http/Utility.php
@@ -1,4 +1,7 @@
$config->getConsumerKey(),
'oauth_nonce' => $this->generateNonce(),
diff --git a/packages/zend-oauth/library/Zend/Oauth/Token.php b/packages/zend-oauth/library/Zend/Oauth/Token.php
index a2daf6520..47114396a 100644
--- a/packages/zend-oauth/library/Zend/Oauth/Token.php
+++ b/packages/zend-oauth/library/Zend/Oauth/Token.php
@@ -1,4 +1,7 @@
_response = $response;
$params = $this->_parseParameters($response);
diff --git a/packages/zend-oauth/library/Zend/Oauth/Token/Access.php b/packages/zend-oauth/library/Zend/Oauth/Token/Access.php
index cc9d5259b..fb2d1a31b 100644
--- a/packages/zend-oauth/library/Zend/Oauth/Token/Access.php
+++ b/packages/zend-oauth/library/Zend/Oauth/Token/Access.php
@@ -1,4 +1,7 @@
_data = $data;
$params = $this->_parseData();
diff --git a/packages/zend-oauth/library/Zend/Oauth/Token/Request.php b/packages/zend-oauth/library/Zend/Oauth/Token/Request.php
index 21168b1fd..71a334fef 100644
--- a/packages/zend-oauth/library/Zend/Oauth/Token/Request.php
+++ b/packages/zend-oauth/library/Zend/Oauth/Token/Request.php
@@ -1,4 +1,7 @@
_storage = new Zend_OpenId_Consumer_Storage_File();
@@ -134,13 +138,15 @@ public function __construct(Zend_OpenId_Consumer_Storage $storage = null,
* @param string $returnTo URL to redirect response from server to
* @param string $root HTTP URL to identify consumer on server
* @param mixed $extensions extension object or array of extensions objects
- * @param Zend_Controller_Response_Abstract $response an optional response
+ * @param Zend_Controller_Response_Abstract|null $response an optional response
* object to perform HTTP or HTML form redirection
* @return bool
*/
public function login($id, $returnTo = null, $root = null, $extensions = null,
- Zend_Controller_Response_Abstract $response = null)
+ $response = null)
{
+ Types::isNullable('response', $response, 'Zend_Controller_Response_Abstract');
+
return $this->_checkId(
false,
$id,
@@ -161,14 +167,16 @@ public function login($id, $returnTo = null, $root = null, $extensions = null,
* @param string $returnTo HTTP URL to redirect response from server to
* @param string $root HTTP URL to identify consumer on server
* @param mixed $extensions extension object or array of extensions objects
- * @param Zend_Controller_Response_Abstract $response an optional response
+ * @param Zend_Controller_Response_Abstract|null $response an optional response
* object to perform HTTP or HTML form redirection
* @return bool
*/
public function check($id, $returnTo=null, $root=null, $extensions = null,
- Zend_Controller_Response_Abstract $response = null)
+ $response = null)
{
+ Types::isNullable('response', $response, 'Zend_Controller_Response_Abstract');
+
return $this->_checkId(
true,
$id,
@@ -300,7 +308,7 @@ public function verify($params, &$identity = "", $extensions = null)
if (isset($params['openid_op_endpoint']) && $url !== $params['openid_op_endpoint']) {
$this->_setError("The op_endpoint URI is not the same of URI associated with the assoc_handle");
return false;
- }
+ }
$signed = explode(',', $params['openid_signed']);
// Check the parameters for the signature
// @see https://openid.net/specs/openid-authentication-2_0.html#positive_assertions
@@ -314,7 +322,7 @@ public function verify($params, &$identity = "", $extensions = null)
return false;
}
}
-
+
$data = '';
foreach ($signed as $key) {
$data .= $key . ':' . $params['openid_' . strtr($key,'.','_')] . "\n";
@@ -763,13 +771,13 @@ protected function _discovery(&$id, &$server, &$version)
$r)) {
$XRDS = $r[3];
$version = 2.0;
- $response = $this->_httpRequest($XRDS);
+ $response = $this->_httpRequest($XRDS);
if (preg_match(
'/([^\t]*)<\/URI>/i',
$response,
$x)) {
$server = $x[1];
- // $realId
+ // $realId
$realId = 'http://specs.openid.net/auth/2.0/identifier_select';
}
else {
@@ -854,8 +862,10 @@ protected function _discovery(&$id, &$server, &$version)
* @return bool
*/
protected function _checkId($immediate, $id, $returnTo=null, $root=null,
- $extensions=null, Zend_Controller_Response_Abstract $response = null)
+ $extensions=null, $response = null)
{
+ Types::isNullable('response', $response, 'Zend_Controller_Response_Abstract');
+
$this->_setError('');
if (!Zend_OpenId::normalize($id)) {
diff --git a/packages/zend-openid/library/Zend/OpenId/Extension/Sreg.php b/packages/zend-openid/library/Zend/OpenId/Extension/Sreg.php
index 2636c629c..0f0cff6fa 100644
--- a/packages/zend-openid/library/Zend/OpenId/Extension/Sreg.php
+++ b/packages/zend-openid/library/Zend/OpenId/Extension/Sreg.php
@@ -1,5 +1,7 @@
_props = $props;
$this->_policy_url = $policy_url;
$this->_version = $version;
diff --git a/packages/zend-openid/library/Zend/OpenId/Provider.php b/packages/zend-openid/library/Zend/OpenId/Provider.php
index b0a0569ee..0e44dd392 100644
--- a/packages/zend-openid/library/Zend/OpenId/Provider.php
+++ b/packages/zend-openid/library/Zend/OpenId/Provider.php
@@ -1,5 +1,7 @@
= 2.0) {
@@ -638,13 +647,15 @@ protected function _checkId($version, $params, $immediate, $extensions=null,
*
* @param array $params GET or POST request variables
* @param mixed $extensions extension object or array of extensions objects
- * @param Zend_Controller_Response_Abstract $response an optional response
+ * @param Zend_Controller_Response_Abstract|null $response an optional response
* object to perform HTTP or HTML form redirection
* @return bool
*/
public function respondToConsumer($params, $extensions=null,
- Zend_Controller_Response_Abstract $response = null)
+ $response = null)
{
+ Types::isNullable('response', $response, 'Zend_Controller_Response_Abstract');
+
$version = 1.1;
if (isset($params['openid_ns']) &&
$params['openid_ns'] == Zend_OpenId::NS_2_0) {
diff --git a/packages/zend-openid/library/Zend/OpenId/Provider/User/Session.php b/packages/zend-openid/library/Zend/OpenId/Provider/User/Session.php
index ab66ddd24..d0f0263b3 100644
--- a/packages/zend-openid/library/Zend/OpenId/Provider/User/Session.php
+++ b/packages/zend-openid/library/Zend/OpenId/Provider/User/Session.php
@@ -1,5 +1,7 @@
_session = new Zend_Session_Namespace("openid");
} else {
diff --git a/packages/zend-paginator/library/Zend/Paginator.php b/packages/zend-paginator/library/Zend/Paginator.php
index 82cd62da1..e51ed16ba 100644
--- a/packages/zend-paginator/library/Zend/Paginator.php
+++ b/packages/zend-paginator/library/Zend/Paginator.php
@@ -1,4 +1,7 @@
getPaginatorAdapter());
} else {
@@ -534,7 +539,7 @@ public function getTotalItemCount()
if (!$this->_cacheEnabled()) {
return count($this->getAdapter());
} else {
- $cacheId = md5($this->_getCacheInternalId(). '_itemCount');
+ $cacheId = md5($this->_getCacheInternalId(). '_itemCount');
$itemCount = self::$_cache->load($cacheId);
if ($itemCount === false) {
@@ -542,7 +547,7 @@ public function getTotalItemCount()
self::$_cache->save($itemCount, $cacheId, array($this->_getCacheInternalId()));
}
-
+
return $itemCount;
}
}
@@ -933,11 +938,13 @@ public function getView()
/**
* Sets the view object.
*
- * @param Zend_View_Interface $view
+ * @param Zend_View_Interface|null $view
* @return Zend_Paginator
*/
- public function setView(Zend_View_Interface $view = null)
+ public function setView($view = null)
{
+ Types::isNullable('view', $view, 'Zend_View_Interface');
+
$this->_view = $view;
return $this;
@@ -990,11 +997,13 @@ public function normalizePageNumber($pageNumber)
/**
* Renders the paginator.
*
- * @param Zend_View_Interface $view
+ * @param Zend_View_Interface|null $view
* @return string
*/
- public function render(Zend_View_Interface $view = null)
+ public function render($view = null)
{
+ Types::isNullable('view', $view, 'Zend_View_Interface');
+
if (null !== $view) {
$this->setView($view);
}
@@ -1060,7 +1069,7 @@ protected function _getCacheId($page = null)
protected function _getCacheInternalId()
{
$adapter = $this->getAdapter();
-
+
if (method_exists($adapter, 'getCacheIdentifier')) {
return md5(serialize(array(
$adapter->getCacheIdentifier(), $this->getItemCountPerPage()
diff --git a/packages/zend-pdf/library/Zend/Pdf.php b/packages/zend-pdf/library/Zend/Pdf.php
index 289fc9154..409c5c13e 100644
--- a/packages/zend-pdf/library/Zend/Pdf.php
+++ b/packages/zend-pdf/library/Zend/Pdf.php
@@ -1,4 +1,7 @@
_trailer->Root;
$root->touch();
diff --git a/packages/zend-pdf/library/Zend/Pdf/Action.php b/packages/zend-pdf/library/Zend/Pdf/Action.php
index 868f42708..452e31057 100644
--- a/packages/zend-pdf/library/Zend/Pdf/Action.php
+++ b/packages/zend-pdf/library/Zend/Pdf/Action.php
@@ -1,4 +1,7 @@
getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
// require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('$dictionary mast be an indirect dictionary object.');
@@ -364,17 +369,20 @@ public function __construct(Zend_Pdf_Element $dictionary, SplObjectStorage $proc
* @param Zend_Pdf_ElementFactory $factory object factory for newly created indirect objects
* @param boolean $updateNavigation Update navigation flag
* @param Zend_Pdf_Element $parent Parent outline dictionary reference
- * @param Zend_Pdf_Element $prev Previous outline dictionary reference
- * @param SplObjectStorage $processedOutlines List of already processed outlines
+ * @param Zend_Pdf_Element|null $prev Previous outline dictionary reference
+ * @param SplObjectStorage|null $processedOutlines List of already processed outlines
* @return Zend_Pdf_Element
* @throws Zend_Pdf_Exception
*/
public function dumpOutline(Zend_Pdf_ElementFactory_Interface $factory,
$updateNavigation,
Zend_Pdf_Element $parent,
- Zend_Pdf_Element $prev = null,
- SplObjectStorage $processedOutlines = null)
+ $prev = null,
+ $processedOutlines = null)
{
+ Types::isNullable('prev', $prev, 'Zend_Pdf_Element');
+ Types::isNullable('processedOutlines', $processedOutlines, 'SplObjectStorage');
+
if ($processedOutlines === null) {
$processedOutlines = new SplObjectStorage();
}
diff --git a/packages/zend-pdf/library/Zend/Pdf/Resource/GraphicsState.php b/packages/zend-pdf/library/Zend/Pdf/Resource/GraphicsState.php
index 02f5d9cc8..60575b89d 100644
--- a/packages/zend-pdf/library/Zend/Pdf/Resource/GraphicsState.php
+++ b/packages/zend-pdf/library/Zend/Pdf/Resource/GraphicsState.php
@@ -1,4 +1,7 @@
_context = $context;
diff --git a/packages/zend-queue/library/Zend/Queue/Adapter/Activemq.php b/packages/zend-queue/library/Zend/Queue/Adapter/Activemq.php
index cd8f426e9..24eca20fe 100644
--- a/packages/zend-queue/library/Zend/Queue/Adapter/Activemq.php
+++ b/packages/zend-queue/library/Zend/Queue/Adapter/Activemq.php
@@ -1,4 +1,7 @@
_options['driverOptions'];
@@ -227,11 +232,13 @@ protected function _subscribe(Zend_Queue $queue)
*
* @param integer $maxMessages
* @param integer $timeout
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return Zend_Queue_Message_Iterator
*/
- public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null)
+ public function receive($maxMessages=null, $timeout=null, $queue=null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
if ($maxMessages === null) {
$maxMessages = 1;
}
@@ -293,11 +300,13 @@ public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null
* Push an element onto the end of the queue
*
* @param string $message message to send to the queue
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return Zend_Queue_Message
*/
- public function send($message, Zend_Queue $queue=null)
+ public function send($message, $queue=null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
if ($queue === null) {
$queue = $this->_queue;
}
@@ -340,13 +349,15 @@ public function send($message, Zend_Queue $queue=null)
/**
* Returns the length of the queue
*
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return integer
* @throws Zend_Queue_Exception (not supported)
*/
#[ReturnTypeWillChange]
- public function count(Zend_Queue $queue=null)
+ public function count($queue=null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
// require_once 'Zend/Queue/Exception.php';
throw new Zend_Queue_Exception('count() is not supported in this adapter');
}
diff --git a/packages/zend-queue/library/Zend/Queue/Adapter/AdapterAbstract.php b/packages/zend-queue/library/Zend/Queue/Adapter/AdapterAbstract.php
index cf55db9d1..14a1e8733 100644
--- a/packages/zend-queue/library/Zend/Queue/Adapter/AdapterAbstract.php
+++ b/packages/zend-queue/library/Zend/Queue/Adapter/AdapterAbstract.php
@@ -1,4 +1,7 @@
(string) The port of the database
*
* @param array|Zend_Config $config An array having configuration data
- * @param Zend_Queue The Zend_Queue object that created this class
+ * @param Zend_Queue|null The Zend_Queue object that created this class
* @return void
* @throws Zend_Queue_Exception
*/
- public function __construct($options, Zend_Queue $queue = null)
+ public function __construct($options, $queue = null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
if ($options instanceof Zend_Config) {
$options = $options->toArray();
}
diff --git a/packages/zend-queue/library/Zend/Queue/Adapter/AdapterInterface.php b/packages/zend-queue/library/Zend/Queue/Adapter/AdapterInterface.php
index 0be56dc7e..4160a13c4 100644
--- a/packages/zend-queue/library/Zend/Queue/Adapter/AdapterInterface.php
+++ b/packages/zend-queue/library/Zend/Queue/Adapter/AdapterInterface.php
@@ -35,10 +35,10 @@ interface Zend_Queue_Adapter_AdapterInterface
* Constructor
*
* @param array|Zend_Config $options
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return void
*/
- public function __construct($options, Zend_Queue $queue = null);
+ public function __construct($options, $queue = null);
/**
* Retrieve queue instance
@@ -108,7 +108,7 @@ public function getQueues();
* @return integer
*/
#[ReturnTypeWillChange]
- public function count(Zend_Queue $queue = null);
+ public function count($queue = null);
/********************************************************************
* Messsage management functions
@@ -121,7 +121,7 @@ public function count(Zend_Queue $queue = null);
* @param Zend_Queue|null $queue
* @return Zend_Queue_Message
*/
- public function send($message, Zend_Queue $queue = null);
+ public function send($message, $queue = null);
/**
* Get messages in the queue
@@ -131,7 +131,7 @@ public function send($message, Zend_Queue $queue = null);
* @param Zend_Queue|null $queue
* @return Zend_Queue_Message_Iterator
*/
- public function receive($maxMessages = null, $timeout = null, Zend_Queue $queue = null);
+ public function receive($maxMessages = null, $timeout = null, $queue = null);
/**
* Delete a message from the queue
diff --git a/packages/zend-queue/library/Zend/Queue/Adapter/Array.php b/packages/zend-queue/library/Zend/Queue/Adapter/Array.php
index 0dc8816b1..a38021df7 100644
--- a/packages/zend-queue/library/Zend/Queue/Adapter/Array.php
+++ b/packages/zend-queue/library/Zend/Queue/Adapter/Array.php
@@ -1,4 +1,7 @@
_queue;
}
@@ -162,12 +169,14 @@ public function count(Zend_Queue $queue=null)
* Send a message to the queue
*
* @param string $message Message to send to the active queue
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return Zend_Queue_Message
* @throws Zend_Queue_Exception
*/
- public function send($message, Zend_Queue $queue=null)
+ public function send($message, $queue=null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
if ($queue === null) {
$queue = $this->_queue;
}
@@ -212,11 +221,13 @@ public function send($message, Zend_Queue $queue=null)
*
* @param integer $maxMessages Maximum number of messages to return
* @param integer $timeout Visibility timeout for these messages
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return Zend_Queue_Message_Iterator
*/
- public function receive($maxMessages = null, $timeout = null, Zend_Queue $queue = null)
+ public function receive($maxMessages = null, $timeout = null, $queue = null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
if ($maxMessages === null) {
$maxMessages = 1;
}
diff --git a/packages/zend-queue/library/Zend/Queue/Adapter/Db.php b/packages/zend-queue/library/Zend/Queue/Adapter/Db.php
index 8e6539cb2..6ddd5ecec 100644
--- a/packages/zend-queue/library/Zend/Queue/Adapter/Db.php
+++ b/packages/zend-queue/library/Zend/Queue/Adapter/Db.php
@@ -1,4 +1,7 @@
_options['options'][Zend_Db_Select::FOR_UPDATE])) {
@@ -284,13 +289,15 @@ public function getQueues()
/**
* Return the approximate number of messages in the queue
*
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return integer
* @throws Zend_Queue_Exception
*/
#[ReturnTypeWillChange]
- public function count(Zend_Queue $queue = null)
+ public function count($queue = null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
if ($queue === null) {
$queue = $this->_queue;
}
@@ -313,12 +320,14 @@ public function count(Zend_Queue $queue = null)
* Send a message to the queue
*
* @param string $message Message to send to the active queue
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return Zend_Queue_Message
* @throws Zend_Queue_Exception - database error
*/
- public function send($message, Zend_Queue $queue = null)
+ public function send($message, $queue = null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
if ($this->_messageRow === null) {
$this->_messageRow = $this->_messageTable->createRow();
}
@@ -371,12 +380,14 @@ public function send($message, Zend_Queue $queue = null)
*
* @param integer $maxMessages Maximum number of messages to return
* @param integer $timeout Visibility timeout for these messages
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return Zend_Queue_Message_Iterator
* @throws Zend_Queue_Exception - database error
*/
- public function receive($maxMessages = null, $timeout = null, Zend_Queue $queue = null)
+ public function receive($maxMessages = null, $timeout = null, $queue = null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
if ($maxMessages === null) {
$maxMessages = 1;
}
diff --git a/packages/zend-queue/library/Zend/Queue/Adapter/Memcacheq.php b/packages/zend-queue/library/Zend/Queue/Adapter/Memcacheq.php
index 7393290f7..261ef8fe0 100644
--- a/packages/zend-queue/library/Zend/Queue/Adapter/Memcacheq.php
+++ b/packages/zend-queue/library/Zend/Queue/Adapter/Memcacheq.php
@@ -1,4 +1,7 @@
_queue;
}
@@ -293,12 +302,14 @@ public function send($message, Zend_Queue $queue=null)
*
* @param integer $maxMessages Maximum number of messages to return
* @param integer $timeout Visibility timeout for these messages
- * @param Zend_Queue $queue
+ * @param Zend_Queue|null $queue
* @return Zend_Queue_Message_Iterator
* @throws Zend_Queue_Exception
*/
- public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null)
+ public function receive($maxMessages=null, $timeout=null, $queue=null)
{
+ Types::isNullable('queue', $queue, 'Zend_Queue');
+
if ($maxMessages === null) {
$maxMessages = 1;
}
diff --git a/packages/zend-queue/library/Zend/Queue/Adapter/Null.php b/packages/zend-queue/library/Zend/Queue/Adapter/Null.php
index c679eef50..55e50bac1 100644
--- a/packages/zend-queue/library/Zend/Queue/Adapter/Null.php
+++ b/packages/zend-queue/library/Zend/Queue/Adapter/Null.php
@@ -1,4 +1,7 @@
_noReset) {
- // if $_noReset we do not want to reset on this request,
+ // if $_noReset we do not want to reset on this request,
// but we do on any subsequent request
$this->_noReset = false;
} else {
self::getHttpClient()->resetParameters();
}
-
+
self::getHttpClient()->setUri($this->_uri);
}
-
+
/**
- * Tells Zend_Rest_Client not to reset all parameters on it's
+ * Tells Zend_Rest_Client not to reset all parameters on it's
* Zend_Http_Client. If you want no reset, this must be called explicitly
* before every request for which you do not want to reset the parameters.
* Parameters will accumulate between requests, but as soon as you do not
@@ -154,12 +157,14 @@ public function setNoReset($bool = true)
* Performs an HTTP GET request to the $path.
*
* @param string $path
- * @param array $query Array of GET parameters
+ * @param array|null $query Array of GET parameters
* @throws Zend_Http_Client_Exception
* @return Zend_Http_Response
*/
- public function restGet($path, array $query = null)
+ public function restGet($path, $query = null)
{
+ Types::isNullable('query', $query, 'array');
+
$this->_prepareRest($path);
$client = self::getHttpClient();
$client->setParameterGet($query);
diff --git a/packages/zend-rest/library/Zend/Rest/Client/Result.php b/packages/zend-rest/library/Zend/Rest/Client/Result.php
index 9b8087acd..951514b00 100644
--- a/packages/zend-rest/library/Zend/Rest/Client/Result.php
+++ b/packages/zend-rest/library/Zend/Rest/Client/Result.php
@@ -1,4 +1,7 @@
_sxml = Zend_Xml_Security::scan($data);
+ $this->_sxml = Zend_Xml_Security::scan($data);
restore_error_handler();
if($this->_sxml === false) {
if ($this->_errstr === null) {
@@ -71,11 +74,13 @@ public function __construct($data)
* @param string $errstr
* @param string $errfile
* @param string $errline
- * @param array $errcontext
+ * @param array|null $errcontext
* @return true
*/
- public function handleXmlErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null)
+ public function handleXmlErrors($errno, $errstr, $errfile = null, $errline = null, $errcontext = null)
{
+ Types::isNullable('errcontext', $errcontext, 'array');
+
$this->_errstr = $errstr;
return true;
}
@@ -184,7 +189,7 @@ public function getStatus()
{
$status = $this->_sxml->xpath('//status/text()');
if ( !isset($status[0]) ) return false;
-
+
$status = strtolower($status[0]);
if (ctype_alpha($status) && $status == 'success') {
diff --git a/packages/zend-server/library/Zend/Server/Reflection/Node.php b/packages/zend-server/library/Zend/Server/Reflection/Node.php
index d80abf342..0abda3186 100644
--- a/packages/zend-server/library/Zend/Server/Reflection/Node.php
+++ b/packages/zend-server/library/Zend/Server/Reflection/Node.php
@@ -1,4 +1,7 @@
_value = $value;
if (null !== $parent) {
$this->setParent($parent, true);
diff --git a/packages/zend-service-delicious/library/Zend/Service/Delicious.php b/packages/zend-service-delicious/library/Zend/Service/Delicious.php
index 044ba8036..1cb969c35 100644
--- a/packages/zend-service-delicious/library/Zend/Service/Delicious.php
+++ b/packages/zend-service-delicious/library/Zend/Service/Delicious.php
@@ -1,5 +1,7 @@
$operation,
diff --git a/packages/zend-service-flickr/library/Zend/Service/Flickr.php b/packages/zend-service-flickr/library/Zend/Service/Flickr.php
index 2c0ec629d..50ce5c1b4 100644
--- a/packages/zend-service-flickr/library/Zend/Service/Flickr.php
+++ b/packages/zend-service-flickr/library/Zend/Service/Flickr.php
@@ -1,5 +1,7 @@
10,
'page' => 1,
diff --git a/packages/zend-service-recaptcha/library/Zend/Service/ReCaptcha/Response.php b/packages/zend-service-recaptcha/library/Zend/Service/ReCaptcha/Response.php
index d20318f1d..adf848472 100644
--- a/packages/zend-service-recaptcha/library/Zend/Service/ReCaptcha/Response.php
+++ b/packages/zend-service-recaptcha/library/Zend/Service/ReCaptcha/Response.php
@@ -1,4 +1,7 @@
setStatus($status);
}
diff --git a/packages/zend-service-twitter/library/Zend/Service/Twitter.php b/packages/zend-service-twitter/library/Zend/Service/Twitter.php
index b82a3af74..0c4a72f87 100644
--- a/packages/zend-service-twitter/library/Zend/Service/Twitter.php
+++ b/packages/zend-service-twitter/library/Zend/Service/Twitter.php
@@ -1,4 +1,7 @@
toArray();
}
diff --git a/packages/zend-service-windowsazure/library/Zend/Service/SqlAzure/Management/Client.php b/packages/zend-service-windowsazure/library/Zend/Service/SqlAzure/Management/Client.php
index 38e414c5c..d64ab3fd6 100644
--- a/packages/zend-service-windowsazure/library/Zend/Service/SqlAzure/Management/Client.php
+++ b/packages/zend-service-windowsazure/library/Zend/Service/SqlAzure/Management/Client.php
@@ -1,4 +1,7 @@
_subscriptionId = $subscriptionId;
$this->_certificatePath = $certificatePath;
$this->_certificatePassphrase = $certificatePassphrase;
-
+
$this->_retryPolicy = $retryPolicy;
if (is_null($this->_retryPolicy)) {
$this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
}
-
+
// Setup default Zend_Http_Client channel
$options = array(
'adapter' => 'Zend_Http_Client_Adapter_Socket',
@@ -153,47 +158,47 @@ public function __construct(
}
$this->_httpClientChannel = new Zend_Http_Client(null, $options);
}
-
+
/**
* Set the HTTP client channel to use
- *
+ *
* @param Zend_Http_Client_Adapter_Interface|string $adapterInstance Adapter instance or adapter class name.
*/
public function setHttpClientChannel($adapterInstance = 'Zend_Http_Client_Adapter_Socket')
{
$this->_httpClientChannel->setAdapter($adapterInstance);
}
-
+
/**
* Retrieve HTTP client channel
- *
+ *
* @return Zend_Http_Client_Adapter_Interface
*/
public function getHttpClientChannel()
{
return $this->_httpClientChannel;
}
-
+
/**
* Returns the Windows Azure subscription ID
- *
+ *
* @return string
*/
public function getSubscriptionId()
{
return $this->_subscriptionId;
}
-
+
/**
* Returns the last request ID.
- *
+ *
* @return string
*/
public function getLastRequestId()
{
return $this->_lastRequestId;
}
-
+
/**
* Get base URL for creating requests
*
@@ -203,7 +208,7 @@ public function getBaseUrl()
{
return self::URL_MANAGEMENT . '/' . $this->_subscriptionId;
}
-
+
/**
* Perform request using Zend_Http_Client channel
*
@@ -225,12 +230,12 @@ protected function _performRequest(
if (strpos($path, '/') !== 0) {
$path = '/' . $path;
}
-
+
// Clean headers
if (is_null($headers)) {
$headers = array();
}
-
+
// Ensure cUrl will also work correctly:
// - disable Content-Type if required
// - disable Expect: 100 Continue
@@ -241,7 +246,7 @@ protected function _performRequest(
// Add version header
$headers['x-ms-version'] = $this->_apiVersion;
-
+
// URL encoding
$path = self::urlencode($path);
$queryString = self::urlencode($queryString);
@@ -250,7 +255,7 @@ protected function _performRequest(
$requestUrl = $this->getBaseUrl() . $path . $queryString;
$requestHeaders = $headers;
- // Prepare request
+ // Prepare request
$this->_httpClientChannel->resetParameters(true);
$this->_httpClientChannel->setUri($requestUrl);
$this->_httpClientChannel->setHeaders($requestHeaders);
@@ -261,47 +266,49 @@ protected function _performRequest(
array($this->_httpClientChannel, 'request'),
array($httpVerb)
);
-
+
// Store request id
$this->_lastRequestId = $response->getHeader('x-ms-request-id');
-
+
return $response;
}
-
- /**
+
+ /**
* Parse result from Zend_Http_Response
*
- * @param Zend_Http_Response $response Response from HTTP call
+ * @param Zend_Http_Response|null $response Response from HTTP call
* @return object
* @throws Zend_Service_WindowsAzure_Exception
*/
- protected function _parseResponse(Zend_Http_Response $response = null)
+ protected function _parseResponse($response = null)
{
+ Types::isNullable('response', $response, 'Zend_Http_Response');
+
if (is_null($response)) {
// require_once 'Zend/Service/SqlAzure/Exception.php';
throw new Zend_Service_SqlAzure_Exception('Response should not be null.');
}
-
+
$xml = @Zend_Xml_Security::scan($response->getBody());
-
+
if ($xml !== false) {
- // Fetch all namespaces
- $namespaces = array_merge($xml->getNamespaces(true), $xml->getDocNamespaces(true));
-
+ // Fetch all namespaces
+ $namespaces = array_merge($xml->getNamespaces(true), $xml->getDocNamespaces(true));
+
// Register all namespace prefixes
- foreach ($namespaces as $prefix => $ns) {
+ foreach ($namespaces as $prefix => $ns) {
if ($prefix != '') {
$xml->registerXPathNamespace($prefix, $ns);
- }
- }
+ }
+ }
}
-
+
return $xml;
}
-
+
/**
* URL encode function
- *
+ *
* @param string $value Value to encode
* @return string Encoded value
*/
@@ -309,10 +316,10 @@ public static function urlencode($value)
{
return str_replace(' ', '%20', $value);
}
-
+
/**
* Builds a query string from an array of elements
- *
+ *
* @param array Array of elements
* @return string Assembled query string
*/
@@ -320,7 +327,7 @@ public static function createQueryStringFromArray($queryString)
{
return count($queryString) > 0 ? '?' . implode('&', $queryString) : '';
}
-
+
/**
* Get error message from Zend_Http_Response
*
@@ -337,10 +344,10 @@ protected function _getErrorMessage(Zend_Http_Response $response, $alternativeEr
return $alternativeError;
}
}
-
+
/**
* The Create Server operation adds a new SQL Azure server to a subscription.
- *
+ *
* @param string $administratorLogin Administrator login.
* @param string $administratorPassword Administrator password.
* @param string $location Location of the server.
@@ -361,15 +368,15 @@ public function createServer($administratorLogin, $administratorPassword, $locat
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception('Please specify a location for the server.');
}
-
+
$response = $this->_performRequest(self::OP_SERVERS, '',
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
'' . $administratorLogin . '' . $administratorPassword . '' . $location . '');
-
+
if ($response->isSuccessful()) {
$xml = $this->_parseResponse($response);
-
+
return new Zend_Service_SqlAzure_Management_ServerInstance(
(string)$xml,
$administratorLogin,
@@ -378,23 +385,23 @@ public function createServer($administratorLogin, $administratorPassword, $locat
} else {
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
- }
+ }
}
-
+
/**
* The Get Servers operation enumerates SQL Azure servers that are provisioned for a subscription.
- *
+ *
* @return array An array of Zend_Service_SqlAzure_Management_ServerInstance.
* @throws Zend_Service_SqlAzure_Management_Exception
*/
public function listServers()
{
$response = $this->_performRequest(self::OP_SERVERS);
-
+
if ($response->isSuccessful()) {
$xml = $this->_parseResponse($response);
$xmlServices = null;
-
+
if (!$xml->Server) {
return array();
}
@@ -403,10 +410,10 @@ public function listServers()
} else {
$xmlServices = array($xml->Server);
}
-
+
$services = array();
- if (!is_null($xmlServices)) {
-
+ if (!is_null($xmlServices)) {
+
for ($i = 0; $i < count($xmlServices); $i++) {
$services[] = new Zend_Service_SqlAzure_Management_ServerInstance(
(string)$xmlServices[$i]->Name,
@@ -421,10 +428,10 @@ public function listServers()
throw new Zend_Service_SqlAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Drop Server operation drops a SQL Azure server from a subscription.
- *
+ *
* @param string $serverName Server to drop.
* @throws Zend_Service_SqlAzure_Management_Exception
*/
@@ -434,18 +441,18 @@ public function dropServer($serverName)
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception('Server name should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_SERVERS . '/' . $serverName, '', Zend_Http_Client::DELETE);
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
- }
+ }
}
-
+
/**
* The Set Server Administrator Password operation sets the administrative password of a SQL Azure server for a subscription.
- *
+ *
* @param string $serverName Server to set password for.
* @param string $administratorPassword Administrator password.
* @throws Zend_Service_SqlAzure_Management_Exception
@@ -460,21 +467,21 @@ public function setAdministratorPassword($serverName, $administratorPassword)
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception('Administrator password should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_SERVERS . '/' . $serverName, '?op=ResetPassword',
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
'' . $administratorPassword . '');
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
- }
+ }
}
-
+
/**
* The Set Server Firewall Rule operation updates an existing firewall rule or adds a new firewall rule for a SQL Azure server that belongs to a subscription.
- *
+ *
* @param string $serverName Server name.
* @param string $ruleName Firewall rule name.
* @param string $startIpAddress Start IP address.
@@ -500,14 +507,14 @@ public function createFirewallRule($serverName, $ruleName, $startIpAddress, $end
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception('End IP address should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_SERVERS . '/' . $serverName . '/' . self::OP_FIREWALLRULES . '/' . $ruleName, '',
Zend_Http_Client::PUT,
array('Content-Type' => 'application/xml; charset=utf-8'),
'' . $startIpAddress . '' . $endIpAddress . '');
if ($response->isSuccessful()) {
-
+
return new Zend_Service_SqlAzure_Management_FirewallRuleInstance(
$ruleName,
$startIpAddress,
@@ -518,10 +525,10 @@ public function createFirewallRule($serverName, $ruleName, $startIpAddress, $end
throw new Zend_Service_SqlAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Get Server Firewall Rules operation retrieves a list of all the firewall rules for a SQL Azure server that belongs to a subscription.
- *
+ *
* @param string $serverName Server name.
* @return Array of Zend_Service_SqlAzure_Management_FirewallRuleInstance.
* @throws Zend_Service_SqlAzure_Management_Exception
@@ -532,13 +539,13 @@ public function listFirewallRules($serverName)
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception('Server name should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_SERVERS . '/' . $serverName . '/' . self::OP_FIREWALLRULES);
-
+
if ($response->isSuccessful()) {
$xml = $this->_parseResponse($response);
$xmlServices = null;
-
+
if (!$xml->FirewallRule) {
return array();
}
@@ -547,10 +554,10 @@ public function listFirewallRules($serverName)
} else {
$xmlServices = array($xml->FirewallRule);
}
-
+
$services = array();
- if (!is_null($xmlServices)) {
-
+ if (!is_null($xmlServices)) {
+
for ($i = 0; $i < count($xmlServices); $i++) {
$services[] = new Zend_Service_SqlAzure_Management_FirewallRuleInstance(
(string)$xmlServices[$i]->Name,
@@ -563,12 +570,12 @@ public function listFirewallRules($serverName)
} else {
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
- }
+ }
}
-
+
/**
* The Delete Server Firewall Rule operation deletes a firewall rule from a SQL Azure server that belongs to a subscription.
- *
+ *
* @param string $serverName Server name.
* @param string $ruleName Rule name.
* @throws Zend_Service_SqlAzure_Management_Exception
@@ -583,7 +590,7 @@ public function deleteFirewallRule($serverName, $ruleName)
// require_once 'Zend/Service/SqlAzure/Management/Exception.php';
throw new Zend_Service_SqlAzure_Management_Exception('Rule name should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_SERVERS . '/' . $serverName . '/' . self::OP_FIREWALLRULES . '/' . $ruleName, '',
Zend_Http_Client::DELETE);
@@ -592,10 +599,10 @@ public function deleteFirewallRule($serverName, $ruleName)
throw new Zend_Service_SqlAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Creates a firewall rule for Microsoft Services. This is required if access to SQL Azure is required from other services like Windows Azure.
- *
+ *
* @param string $serverName Server name.
* @param boolean $allowAccess Allow access from other Microsoft Services?
* @throws Zend_Service_SqlAzure_Management_Exception
@@ -608,5 +615,5 @@ public function createFirewallRuleForMicrosoftServices($serverName, $allowAccess
$this->deleteFirewallRule($serverName, 'MicrosoftServices');
}
}
-
+
}
diff --git a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Diagnostics/Manager.php b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Diagnostics/Manager.php
index e1dc65b88..29dd4ddee 100644
--- a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Diagnostics/Manager.php
+++ b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Diagnostics/Manager.php
@@ -1,4 +1,7 @@
_blobStorageClient = $blobStorageClient;
$this->_controlContainer = $controlContainer;
@@ -71,20 +76,20 @@ protected function _ensureStorageInitialized()
$this->_blobStorageClient->createContainer($this->_controlContainer);
}
}
-
+
/**
* Get default configuration values
- *
+ *
* @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
*/
public function getDefaultConfiguration()
{
return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
}
-
+
/**
* Checks if a configuration for a specific role instance exists.
- *
+ *
* @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
* @return boolean
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
@@ -98,10 +103,10 @@ public function configurationForRoleInstanceExists($roleInstance = null)
return $this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance);
}
-
+
/**
* Checks if a configuration for current role instance exists. Only works on Development Fabric or Windows Azure Fabric.
- *
+ *
* @return boolean
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
@@ -114,10 +119,10 @@ public function configurationForCurrentRoleInstanceExists()
return $this->_blobStorageClient->blobExists($this->_controlContainer, $this->_getCurrentRoleInstanceId());
}
-
+
/**
* Get configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
- *
+ *
* @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
@@ -129,10 +134,10 @@ public function getConfigurationForCurrentRoleInstance()
}
return $this->getConfigurationForRoleInstance($this->_getCurrentRoleInstanceId());
}
-
+
/**
* Get the current role instance ID. Only works on Development Fabric or Windows Azure Fabric.
- *
+ *
* @return string
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
@@ -142,7 +147,7 @@ protected function _getCurrentRoleInstanceId()
// require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
}
-
+
if (strpos($_SERVER['RdRoleId'], 'deployment(') === false) {
return $_SERVER['RdRoleId'];
} else {
@@ -153,17 +158,17 @@ protected function _getCurrentRoleInstanceId()
if (!isset($_SERVER['RoleDeploymentID']) && !isset($_SERVER['RoleInstanceID']) && !isset($_SERVER['RoleName'])) {
throw new Exception('Server variables \'RoleDeploymentID\', \'RoleInstanceID\' and \'RoleName\' are unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
}
-
+
if (strpos($_SERVER['RdRoleId'], 'deployment(') === false) {
return $_SERVER['RdRoleId'];
} else {
return $_SERVER['RoleDeploymentID'] . '/' . $_SERVER['RoleInstanceID'] . '/' . $_SERVER['RoleName'];
}
}
-
+
/**
* Set configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
- *
+ *
* @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
@@ -173,13 +178,13 @@ public function setConfigurationForCurrentRoleInstance(Zend_Service_WindowsAzure
// require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
}
-
+
$this->setConfigurationForRoleInstance($this->_getCurrentRoleInstanceId(), $configuration);
}
-
+
/**
* Get configuration for a specific role instance
- *
+ *
* @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
* @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
@@ -191,8 +196,8 @@ public function getConfigurationForRoleInstance($roleInstance = null)
throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
}
-
-
+
+
if ($this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance)) {
$configurationInstance = new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
$configurationInstance->loadXml( $this->_blobStorageClient->getBlobData($this->_controlContainer, $roleInstance) );
@@ -201,10 +206,10 @@ public function getConfigurationForRoleInstance($roleInstance = null)
return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
}
-
+
/**
* Set configuration for a specific role instance
- *
+ *
* @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
* @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
diff --git a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Management/Client.php b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Management/Client.php
index af88c86c5..fc8b9fa8e 100644
--- a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Management/Client.php
+++ b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Management/Client.php
@@ -1,4 +1,7 @@
_subscriptionId = $subscriptionId;
$this->_certificatePath = $certificatePath;
$this->_certificatePassphrase = $certificatePassphrase;
-
+
$this->_retryPolicy = $retryPolicy;
if (is_null($this->_retryPolicy)) {
$this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
}
-
+
// Setup default Zend_Http_Client channel
$options = array(
'adapter' => 'Zend_Http_Client_Adapter_Socket',
@@ -192,47 +197,47 @@ public function __construct(
}
$this->_httpClientChannel = new Zend_Http_Client(null, $options);
}
-
+
/**
* Set the HTTP client channel to use
- *
+ *
* @param Zend_Http_Client_Adapter_Interface|string $adapterInstance Adapter instance or adapter class name.
*/
public function setHttpClientChannel($adapterInstance = 'Zend_Http_Client_Adapter_Socket')
{
$this->_httpClientChannel->setAdapter($adapterInstance);
}
-
+
/**
* Retrieve HTTP client channel
- *
+ *
* @return Zend_Http_Client_Adapter_Interface
*/
public function getHttpClientChannel()
{
return $this->_httpClientChannel;
}
-
+
/**
* Returns the Windows Azure subscription ID
- *
+ *
* @return string
*/
public function getSubscriptionId()
{
return $this->_subscriptionId;
}
-
+
/**
* Returns the last request ID.
- *
+ *
* @return string
*/
public function getLastRequestId()
{
return $this->_lastRequestId;
}
-
+
/**
* Get base URL for creating requests
*
@@ -242,7 +247,7 @@ public function getBaseUrl()
{
return self::URL_MANAGEMENT . '/' . $this->_subscriptionId;
}
-
+
/**
* Perform request using Zend_Http_Client channel
*
@@ -264,12 +269,12 @@ protected function _performRequest(
if (strpos($path, '/') !== 0) {
$path = '/' . $path;
}
-
+
// Clean headers
if (is_null($headers)) {
$headers = array();
}
-
+
// Ensure cUrl will also work correctly:
// - disable Content-Type if required
// - disable Expect: 100 Continue
@@ -280,7 +285,7 @@ protected function _performRequest(
// Add version header
$headers['x-ms-version'] = $this->_apiVersion;
-
+
// URL encoding
$path = self::urlencode($path);
$queryString = self::urlencode($queryString);
@@ -289,7 +294,7 @@ protected function _performRequest(
$requestUrl = $this->getBaseUrl() . $path . $queryString;
$requestHeaders = $headers;
- // Prepare request
+ // Prepare request
$this->_httpClientChannel->resetParameters(true);
$this->_httpClientChannel->setUri($requestUrl);
$this->_httpClientChannel->setHeaders($requestHeaders);
@@ -300,47 +305,49 @@ protected function _performRequest(
array($this->_httpClientChannel, 'request'),
array($httpVerb)
);
-
+
// Store request id
$this->_lastRequestId = $response->getHeader('x-ms-request-id');
-
+
return $response;
}
-
- /**
+
+ /**
* Parse result from Zend_Http_Response
*
- * @param Zend_Http_Response $response Response from HTTP call
+ * @param Zend_Http_Response|null $response Response from HTTP call
* @return object
* @throws Zend_Service_WindowsAzure_Exception
*/
- protected function _parseResponse(Zend_Http_Response $response = null)
+ protected function _parseResponse($response = null)
{
+ Types::isNullable('response', $response, 'Zend_Http_Response');
+
if (is_null($response)) {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Response should not be null.');
}
-
+
$xml = Zend_Xml_Security::scan($response->getBody());
-
+
if ($xml !== false) {
- // Fetch all namespaces
- $namespaces = array_merge($xml->getNamespaces(true), $xml->getDocNamespaces(true));
-
+ // Fetch all namespaces
+ $namespaces = array_merge($xml->getNamespaces(true), $xml->getDocNamespaces(true));
+
// Register all namespace prefixes
- foreach ($namespaces as $prefix => $ns) {
+ foreach ($namespaces as $prefix => $ns) {
if ($prefix != '') {
$xml->registerXPathNamespace($prefix, $ns);
- }
- }
+ }
+ }
}
-
+
return $xml;
}
-
+
/**
* URL encode function
- *
+ *
* @param string $value Value to encode
* @return string Encoded value
*/
@@ -348,10 +355,10 @@ public static function urlencode($value)
{
return str_replace(' ', '%20', $value);
}
-
+
/**
* Builds a query string from an array of elements
- *
+ *
* @param array Array of elements
* @return string Assembled query string
*/
@@ -359,7 +366,7 @@ public static function createQueryStringFromArray($queryString)
{
return count($queryString) > 0 ? '?' . implode('&', $queryString) : '';
}
-
+
/**
* Get error message from Zend_Http_Response
*
@@ -376,7 +383,7 @@ protected function _getErrorMessage(Zend_Http_Response $response, $alternativeEr
return $alternativeError;
}
}
-
+
/**
* The Get Operation Status operation returns the status of the specified operation.
* After calling an asynchronous operation, you can call Get Operation Status to
@@ -391,7 +398,7 @@ public function getOperationStatus($requestId = '')
if ($requestId == '') {
$requestId = $this->getLastRequestId();
}
-
+
$response = $this->_performRequest(self::OP_OPERATIONS . '/' . $requestId);
if ($response->isSuccessful()) {
@@ -411,17 +418,17 @@ public function getOperationStatus($requestId = '')
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
-
+
+
/**
* The List Subscription Operations operation returns a list of create, update,
* and delete operations that were performed on a subscription during the specified timeframe.
* Documentation on the parameters can be found at http://msdn.microsoft.com/en-us/library/gg715318.aspx.
*
* @param string $startTime The start of the timeframe to begin listing subscription operations in UTC format. This parameter and the $endTime parameter indicate the timeframe to retrieve subscription operations. This parameter cannot indicate a start date of more than 90 days in the past.
- * @param string $endTime The end of the timeframe to begin listing subscription operations in UTC format. This parameter and the $startTime parameter indicate the timeframe to retrieve subscription operations.
- * @param string $objectIdFilter Returns subscription operations only for the specified object type and object ID.
+ * @param string $endTime The end of the timeframe to begin listing subscription operations in UTC format. This parameter and the $startTime parameter indicate the timeframe to retrieve subscription operations.
+ * @param string $objectIdFilter Returns subscription operations only for the specified object type and object ID.
* @param string $operationResultFilter Returns subscription operations only for the specified result status, either Succeeded, Failed, or InProgress.
* @param string $continuationToken Internal usage.
* @return array Array of Zend_Service_WindowsAzure_Management_SubscriptionOperationInstance
@@ -444,7 +451,7 @@ public function listSubscriptionOperations($startTime, $endTime, $objectIdFilter
throw new Zend_Service_WindowsAzure_Management_Exception('OperationResultFilter should be succeeded|failed|inprogress.');
}
}
-
+
$parameters = array();
$parameters[] = 'StartTime=' . $startTime;
$parameters[] = 'EndTime=' . $endTime;
@@ -457,18 +464,18 @@ public function listSubscriptionOperations($startTime, $endTime, $objectIdFilter
if ($continuationToken != '' && !is_null($continuationToken)) {
$parameters[] = 'ContinuationToken=' . $continuationToken;
}
-
+
$response = $this->_performRequest(self::OP_OPERATIONS, '?' . implode('&', $parameters));
if ($response->isSuccessful()) {
$result = $this->_parseResponse($response);
- $namespaces = $result->getDocNamespaces();
+ $namespaces = $result->getDocNamespaces();
$result->registerXPathNamespace('__empty_ns', $namespaces['']);
-
+
$xmlOperations = $result->xpath('//__empty_ns:SubscriptionOperation');
-
+
// Create return value
- $returnValue = array();
+ $returnValue = array();
foreach ($xmlOperations as $xmlOperation) {
// Create operation instance
$operation = new Zend_Service_WindowsAzure_Management_SubscriptionOperationInstance(
@@ -479,24 +486,24 @@ public function listSubscriptionOperations($startTime, $endTime, $objectIdFilter
(array)$xmlOperation->OperationCaller,
(array)$xmlOperation->OperationStatus
);
-
+
// Parse parameters
- $xmlOperation->registerXPathNamespace('__empty_ns', $namespaces['']);
+ $xmlOperation->registerXPathNamespace('__empty_ns', $namespaces['']);
$xmlParameters = $xmlOperation->xpath('.//__empty_ns:OperationParameter');
foreach ($xmlParameters as $xmlParameter) {
$xmlParameterDetails = $xmlParameter->children('http://schemas.datacontract.org/2004/07/Microsoft.Samples.WindowsAzure.ServiceManagement');
$operation->addOperationParameter((string)$xmlParameterDetails->Name, (string)$xmlParameterDetails->Value);
}
-
+
// Add to result
$returnValue[] = $operation;
}
-
+
// More data?
if (!is_null($result->ContinuationToken) && $result->ContinuationToken != '') {
$returnValue = array_merge($returnValue, $this->listSubscriptionOperations($startTime, $endTime, $objectIdFilter, $operationResultFilter, (string)$result->ContinuationToken));
}
-
+
// Return
return $returnValue;
} else {
@@ -504,10 +511,10 @@ public function listSubscriptionOperations($startTime, $endTime, $objectIdFilter
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Wait for an operation to complete
- *
+ *
* @param string $requestId The request ID. If omitted, the last request ID will be used.
* @param int $sleepInterval Sleep interval in milliseconds.
* @return Zend_Service_WindowsAzure_Management_OperationStatusInstance
@@ -527,27 +534,29 @@ public function waitForOperation($requestId = '', $sleepInterval = 250)
$status = $this->getOperationStatus($requestId);
usleep($sleepInterval);
}
-
+
return $status;
}
-
+
/**
* Creates a new Zend_Service_WindowsAzure_Storage_Blob instance for the current account
*
* @param string $serviceName the service name to create a storage client for.
- * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
+ * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract|null $retryPolicy Retry policy to use when making requests
* @return Zend_Service_WindowsAzure_Storage_Blob
*/
- public function createBlobClientForService($serviceName, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
+ public function createBlobClientForService($serviceName, $retryPolicy = null)
{
+ Types::isNullable('retryPolicy', $retryPolicy, 'Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract');
+
if ($serviceName == '' || is_null($serviceName)) {
throw new Zend_Service_WindowsAzure_Management_Exception('Service name should be specified.');
}
-
+
$storageKeys = $this->getStorageAccountKeys($serviceName);
-
-
-
+
+
+
return new Zend_Service_WindowsAzure_Storage_Blob(
Zend_Service_WindowsAzure_Storage::URL_CLOUD_BLOB,
$serviceName,
@@ -556,23 +565,25 @@ public function createBlobClientForService($serviceName, Zend_Service_WindowsAzu
$retryPolicy
);
}
-
+
/**
* Creates a new Zend_Service_WindowsAzure_Storage_Table instance for the current account
*
* @param string $serviceName the service name to create a storage client for.
- * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
+ * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract|null $retryPolicy Retry policy to use when making requests
* @return Zend_Service_WindowsAzure_Storage_Table
*/
- public function createTableClientForService($serviceName, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
+ public function createTableClientForService($serviceName, $retryPolicy = null)
{
+ Types::isNullable('retryPolicy', $retryPolicy, 'Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract');
+
if ($serviceName == '' || is_null($serviceName)) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Service name should be specified.');
}
-
+
$storageKeys = $this->getStorageAccountKeys($serviceName);
-
+
return new Zend_Service_WindowsAzure_Storage_Table(
Zend_Service_WindowsAzure_Storage::URL_CLOUD_TABLE,
$serviceName,
@@ -581,25 +592,27 @@ public function createTableClientForService($serviceName, Zend_Service_WindowsAz
$retryPolicy
);
}
-
+
/**
* Creates a new Zend_Service_WindowsAzure_Storage_Queue instance for the current account
*
* @param string $serviceName the service name to create a storage client for.
- * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
+ * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract|null $retryPolicy Retry policy to use when making requests
* @return Zend_Service_WindowsAzure_Storage_Queue
*/
- public function createQueueClientForService($serviceName, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
+ public function createQueueClientForService($serviceName, $retryPolicy = null)
{
+ Types::isNullable('retryPolicy', $retryPolicy, 'Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract');
+
if ($serviceName == '' || is_null($serviceName)) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Service name should be specified.');
}
-
+
$storageKeys = $this->getStorageAccountKeys($serviceName);
-
+
// require_once 'Zend/Service/WindowsAzure/Storage/Queue.php';
-
+
return new Zend_Service_WindowsAzure_Storage_Queue(
Zend_Service_WindowsAzure_Storage::URL_CLOUD_QUEUE,
$serviceName,
@@ -608,7 +621,7 @@ public function createQueueClientForService($serviceName, Zend_Service_WindowsAz
$retryPolicy
);
}
-
+
/**
* The List Storage Accounts operation lists the storage accounts available under
* the current subscription.
@@ -621,7 +634,7 @@ public function listStorageAccounts()
if ($response->isSuccessful()) {
$result = $this->_parseResponse($response);
-
+
if (!$result->StorageService) {
return array();
}
@@ -630,9 +643,9 @@ public function listStorageAccounts()
} else {
$xmlServices = array($result->StorageService);
}
-
+
$services = array();
- if (!is_null($xmlServices)) {
+ if (!is_null($xmlServices)) {
for ($i = 0; $i < count($xmlServices); $i++) {
$services[] = new Zend_Service_WindowsAzure_Management_StorageServiceInstance(
(string)$xmlServices[$i]->Url,
@@ -645,10 +658,10 @@ public function listStorageAccounts()
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Get Storage Account Properties operation returns the system properties for the
- * specified storage account. These properties include: the address, description, and
+ * specified storage account. These properties include: the address, description, and
* label of the storage account; and the name of the affinity group to which the service
* belongs, or its geo-location if it is not part of an affinity group.
*
@@ -661,7 +674,7 @@ public function getStorageAccountProperties($serviceName)
if ($serviceName == '' || is_null($serviceName)) {
throw new Zend_Service_WindowsAzure_Management_Exception('Service name should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_STORAGE_ACCOUNTS . '/' . $serviceName);
if ($response->isSuccessful()) {
@@ -669,7 +682,7 @@ public function getStorageAccountProperties($serviceName)
if (!is_null($xmlService)) {
// require_once 'Zend/Service/WindowsAzure/Management/StorageServiceInstance.php';
-
+
return new Zend_Service_WindowsAzure_Management_StorageServiceInstance(
(string)$xmlService->Url,
(string)$xmlService->ServiceName,
@@ -685,7 +698,7 @@ public function getStorageAccountProperties($serviceName)
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Get Storage Keys operation returns the primary
* and secondary access keys for the specified storage account.
@@ -700,7 +713,7 @@ public function getStorageAccountKeys($serviceName)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Service name should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_STORAGE_ACCOUNTS . '/' . $serviceName . '/keys');
if ($response->isSuccessful()) {
@@ -718,7 +731,7 @@ public function getStorageAccountKeys($serviceName)
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Regenerate Keys operation regenerates the primary
* or secondary access key for the specified storage account.
@@ -739,7 +752,7 @@ public function regenerateStorageAccountKey($serviceName, $key = 'primary')
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Key identifier should be primary|secondary.');
}
-
+
$response = $this->_performRequest(
self::OP_STORAGE_ACCOUNTS . '/' . $serviceName . '/keys', '?action=regenerate',
Zend_Http_Client::POST,
@@ -764,7 +777,7 @@ public function regenerateStorageAccountKey($serviceName, $key = 'primary')
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The List Hosted Services operation lists the hosted services available
* under the current subscription.
@@ -778,7 +791,7 @@ public function listHostedServices()
if ($response->isSuccessful()) {
$result = $this->_parseResponse($response);
-
+
if (!$result->HostedService) {
return array();
}
@@ -787,10 +800,10 @@ public function listHostedServices()
} else {
$xmlServices = array($result->HostedService);
}
-
+
$services = array();
- if (!is_null($xmlServices)) {
-
+ if (!is_null($xmlServices)) {
+
for ($i = 0; $i < count($xmlServices); $i++) {
$services[] = new Zend_Service_WindowsAzure_Management_HostedServiceInstance(
(string)$xmlServices[$i]->Url,
@@ -804,14 +817,14 @@ public function listHostedServices()
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Create Hosted Service operation creates a new hosted service in Windows Azure.
- *
+ *
* @param string $serviceName A name for the hosted service that is unique to the subscription.
* @param string $label A label for the hosted service. The label may be up to 100 characters in length.
* @param string $description A description for the hosted service. The description may be up to 1024 characters in length.
- * @param string $location Required if AffinityGroup is not specified. The location where the hosted service will be created.
+ * @param string $location Required if AffinityGroup is not specified. The location where the hosted service will be created.
* @param string $affinityGroup Required if Location is not specified. The name of an existing affinity group associated with this subscription.
*/
public function createHostedService($serviceName, $label, $description = '', $location = null, $affinityGroup = null)
@@ -836,25 +849,25 @@ public function createHostedService($serviceName, $label, $description = '', $lo
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Please specify a location -or- an affinity group for the service.');
}
-
+
$locationOrAffinityGroup = is_null($location)
? '' . $affinityGroup . ''
: '' . $location . '';
-
+
$response = $this->_performRequest(self::OP_HOSTED_SERVICES, '',
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
'' . $serviceName . '' . $description . '' . $locationOrAffinityGroup . '');
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Update Hosted Service operation updates the label and/or the description for a hosted service in Windows Azure.
- *
+ *
* @param string $serviceName A name for the hosted service that is unique to the subscription.
* @param string $label A label for the hosted service. The label may be up to 100 characters in length.
* @param string $description A description for the hosted service. The description may be up to 1024 characters in length.
@@ -873,21 +886,21 @@ public function updateHostedService($serviceName, $label, $description = '')
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Label is too long. The maximum length is 100 characters.');
}
-
+
$response = $this->_performRequest(self::OP_HOSTED_SERVICES . '/' . $serviceName, '',
Zend_Http_Client::PUT,
array('Content-Type' => 'application/xml; charset=utf-8'),
'' . $description . '');
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Delete Hosted Service operation deletes the specified hosted service in Windows Azure.
- *
+ *
* @param string $serviceName A name for the hosted service that is unique to the subscription.
*/
public function deleteHostedService($serviceName)
@@ -896,15 +909,15 @@ public function deleteHostedService($serviceName)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Service name should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_HOSTED_SERVICES . '/' . $serviceName, '', Zend_Http_Client::DELETE);
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Get Hosted Service Properties operation retrieves system properties
* for the specified hosted service. These properties include the service
@@ -922,14 +935,14 @@ public function getHostedServiceProperties($serviceName)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Service name should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_HOSTED_SERVICES . '/' . $serviceName, '?embed-detail=true');
if ($response->isSuccessful()) {
$xmlService = $this->_parseResponse($response);
if (!is_null($xmlService)) {
-
+
$returnValue = new Zend_Service_WindowsAzure_Management_HostedServiceInstance(
(string)$xmlService->Url,
(string)$xmlService->ServiceName,
@@ -938,20 +951,20 @@ public function getHostedServiceProperties($serviceName)
(string)$xmlService->HostedServiceProperties->Location,
(string)$xmlService->HostedServiceProperties->Label
);
-
+
// Deployments
if (count($xmlService->Deployments->Deployment) > 1) {
$xmlServices = $xmlService->Deployments->Deployment;
} else {
$xmlServices = array($xmlService->Deployments->Deployment);
}
-
+
$deployments = array();
foreach ($xmlServices as $xmlDeployment) {
$deployments[] = $this->_convertXmlElementToDeploymentInstance($xmlDeployment);
}
$returnValue->Deployments = $deployments;
-
+
return $returnValue;
}
return null;
@@ -964,7 +977,7 @@ public function getHostedServiceProperties($serviceName)
/**
* The Create Deployment operation uploads a new service package
* and creates a new deployment on staging or production.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @param string $name The name for the deployment. The deployment ID as listed on the Windows Azure management portal must be unique among other deployments for the hosted service.
@@ -1006,30 +1019,30 @@ public function createDeployment($serviceName, $deploymentSlot, $name, $label, $
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Configuration should be specified.');
}
-
+
if (@file_exists($configuration)) {
$configuration = mb_convert_encoding(file_get_contents($configuration), 'ISO-8859-1', 'UTF-8');
}
-
+
// Clean up the configuration
$conformingConfiguration = $this->_cleanConfiguration($configuration);
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deploymentslots/' . $deploymentSlot;
$response = $this->_performRequest($operationUrl, '',
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
'' . $name . '' . $packageUrl . '' . base64_encode($conformingConfiguration) . '' . ($startDeployment ? 'true' : 'false') . '' . ($treatWarningsAsErrors ? 'true' : 'false') . '');
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
- }
+ }
}
-
+
/**
* The Get Deployment operation returns configuration information, status,
* and system properties for the specified deployment.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @return Zend_Service_WindowsAzure_Management_DeploymentInstance
@@ -1046,15 +1059,15 @@ public function getDeploymentBySlot($serviceName, $deploymentSlot)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Deployment slot should be production|staging.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deploymentslots/' . $deploymentSlot;
return $this->_getDeployment($operationUrl);
}
-
+
/**
* The Get Deployment operation returns configuration information, status,
* and system properties for the specified deployment.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentId The deployment ID as listed on the Windows Azure management portal
* @return Zend_Service_WindowsAzure_Management_DeploymentInstance
@@ -1070,15 +1083,15 @@ public function getDeploymentByDeploymentId($serviceName, $deploymentId)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Deployment ID should be specified.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deployments/' . $deploymentId;
return $this->_getDeployment($operationUrl);
}
-
+
/**
* The Get Deployment operation returns configuration information, status,
* and system properties for the specified deployment.
- *
+ *
* @param string $operationUrl The operation url
* @return Zend_Service_WindowsAzure_Management_DeploymentInstance
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -1089,21 +1102,21 @@ protected function _getDeployment($operationUrl)
if ($response->isSuccessful()) {
$xmlService = $this->_parseResponse($response);
-
+
return $this->_convertXmlElementToDeploymentInstance($xmlService);
} else {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Swap Deployment operation initiates a virtual IP swap between
* the staging and production deployment environments for a service.
* If the service is currently running in the staging environment,
* it will be swapped to the production environment. If it is running
* in the production environment, it will be swapped to staging.
- *
+ *
* @param string $serviceName The service name.
* @param string $productionDeploymentName The name of the production deployment.
* @param string $sourceDeploymentName The name of the source deployment.
@@ -1123,22 +1136,22 @@ public function swapDeployment($serviceName, $productionDeploymentName, $sourceD
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Source Deployment ID should be specified.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName;
$response = $this->_performRequest($operationUrl, '',
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
'' . $productionDeploymentName . '' . $sourceDeploymentName . '');
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
- }
+ }
}
-
+
/**
* The Delete Deployment operation deletes the specified deployment.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -1154,14 +1167,14 @@ public function deleteDeploymentBySlot($serviceName, $deploymentSlot)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Deployment slot should be production|staging.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deploymentslots/' . $deploymentSlot;
return $this->_deleteDeployment($operationUrl);
}
-
+
/**
* The Delete Deployment operation deletes the specified deployment.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentId The deployment ID as listed on the Windows Azure management portal
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -1176,30 +1189,30 @@ public function deleteDeploymentByDeploymentId($serviceName, $deploymentId)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Deployment ID should be specified.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deployments/' . $deploymentId;
return $this->_deleteDeployment($operationUrl);
}
-
+
/**
* The Delete Deployment operation deletes the specified deployment.
- *
+ *
* @param string $operationUrl The operation url
* @throws Zend_Service_WindowsAzure_Management_Exception
*/
protected function _deleteDeployment($operationUrl)
{
$response = $this->_performRequest($operationUrl, '', Zend_Http_Client::DELETE);
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Update Deployment Status operation initiates a change in deployment status.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @param string $status The deployment status (running|suspended)
@@ -1221,14 +1234,14 @@ public function updateDeploymentStatusBySlot($serviceName, $deploymentSlot, $sta
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Status should be running|suspended.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deploymentslots/' . $deploymentSlot;
return $this->_updateDeploymentStatus($operationUrl, $status);
}
-
+
/**
* The Update Deployment Status operation initiates a change in deployment status.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentId The deployment ID as listed on the Windows Azure management portal
* @param string $status The deployment status (running|suspended)
@@ -1249,14 +1262,14 @@ public function updateDeploymentStatusByDeploymentId($serviceName, $deploymentId
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Status should be running|suspended.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deployments/' . $deploymentId;
return $this->_updateDeploymentStatus($operationUrl, $status);
}
-
+
/**
* The Update Deployment Status operation initiates a change in deployment status.
- *
+ *
* @param string $operationUrl The operation url
* @param string $status The deployment status (running|suspended)
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -1267,16 +1280,16 @@ protected function _updateDeploymentStatus($operationUrl, $status = 'running')
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
'' . ucfirst($status) . '');
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Converts an XmlElement into a Zend_Service_WindowsAzure_Management_DeploymentInstance
- *
+ *
* @param object $xmlService The XML Element
* @return Zend_Service_WindowsAzure_Management_DeploymentInstance
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -1284,7 +1297,7 @@ protected function _updateDeploymentStatus($operationUrl, $status = 'running')
protected function _convertXmlElementToDeploymentInstance($xmlService)
{
if (!is_null($xmlService)) {
-
+
$returnValue = new Zend_Service_WindowsAzure_Management_DeploymentInstance(
(string)$xmlService->Name,
(string)$xmlService->DeploymentSlot,
@@ -1299,16 +1312,16 @@ protected function _convertXmlElementToDeploymentInstance($xmlService)
(string)$xmlService->CurrentUpgradeDomain,
(string)$xmlService->UpgradeDomainCount
);
-
+
// Append role instances
if ($xmlService->RoleInstanceList && $xmlService->RoleInstanceList->RoleInstance) {
$xmlRoleInstances = $xmlService->RoleInstanceList->RoleInstance;
if (count($xmlService->RoleInstanceList->RoleInstance) == 1) {
$xmlRoleInstances = array($xmlService->RoleInstanceList->RoleInstance);
}
-
+
$roleInstances = array();
- if (!is_null($xmlRoleInstances)) {
+ if (!is_null($xmlRoleInstances)) {
for ($i = 0; $i < count($xmlRoleInstances); $i++) {
$roleInstances[] = array(
'rolename' => (string)$xmlRoleInstances[$i]->RoleName,
@@ -1317,37 +1330,37 @@ protected function _convertXmlElementToDeploymentInstance($xmlService)
);
}
}
-
+
$returnValue->RoleInstanceList = $roleInstances;
}
-
+
// Append roles
if ($xmlService->RoleList && $xmlService->RoleList->Role) {
$xmlRoles = $xmlService->RoleList->Role;
if (count($xmlService->RoleList->Role) == 1) {
$xmlRoles = array($xmlService->RoleList->Role);
}
-
+
$roles = array();
- if (!is_null($xmlRoles)) {
+ if (!is_null($xmlRoles)) {
for ($i = 0; $i < count($xmlRoles); $i++) {
$roles[] = array(
'rolename' => (string)$xmlRoles[$i]->RoleName,
- 'osversion' => (!is_null($xmlRoles[$i]->OsVersion) ? (string)$xmlRoles[$i]->OsVersion : (string)$xmlRoles[$i]->OperatingSystemVersion)
+ 'osversion' => (!is_null($xmlRoles[$i]->OsVersion) ? (string)$xmlRoles[$i]->OsVersion : (string)$xmlRoles[$i]->OperatingSystemVersion)
);
}
}
$returnValue->RoleList = $roles;
}
-
+
return $returnValue;
}
return null;
}
-
+
/**
* Updates a deployment's role instance count.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @param string|array $roleName The role name
@@ -1368,19 +1381,19 @@ public function setInstanceCountBySlot($serviceName, $deploymentSlot, $roleName,
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Role name name should be specified.');
}
-
+
// Get configuration
$deployment = $this->getDeploymentBySlot($serviceName, $deploymentSlot);
$configuration = $deployment->Configuration;
$configuration = $this->_updateInstanceCountInConfiguration($roleName, $instanceCount, $configuration);
-
+
// Update configuration
- $this->configureDeploymentBySlot($serviceName, $deploymentSlot, $configuration);
+ $this->configureDeploymentBySlot($serviceName, $deploymentSlot, $configuration);
}
-
+
/**
* Updates a deployment's role instance count.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @param string|array $roleName The role name
@@ -1401,19 +1414,19 @@ public function setInstanceCountByDeploymentId($serviceName, $deploymentId, $rol
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Role name name should be specified.');
}
-
+
// Get configuration
$deployment = $this->getDeploymentByDeploymentId($serviceName, $deploymentId);
$configuration = $deployment->Configuration;
$configuration = $this->_updateInstanceCountInConfiguration($roleName, $instanceCount, $configuration);
-
+
// Update configuration
$this->configureDeploymentByDeploymentId($serviceName, $deploymentId, $configuration);
}
-
+
/**
* Updates instance count in configuration XML.
- *
+ *
* @param string|array $roleName The role name
* @param string|array $instanceCount The instance count
* @param string $configuration XML configuration represented as a string
@@ -1431,32 +1444,32 @@ protected function _updateInstanceCountInConfiguration($roleName, $instanceCount
$configuration = preg_replace('/(<\?xml[^?]+?)utf-16/i', '$1utf-8', $configuration);
//$configuration = '' . substr($configuration, strpos($configuration, '>') + 2);
- $xml = Zend_Xml_Security::scan($configuration);
-
+ $xml = Zend_Xml_Security::scan($configuration);
+
// http://www.php.net/manual/en/simplexmlelement.xpath.php#97818
$namespaces = $xml->getDocNamespaces();
- $xml->registerXPathNamespace('__empty_ns', $namespaces['']);
-
+ $xml->registerXPathNamespace('__empty_ns', $namespaces['']);
+
for ($i = 0; $i < count($roleName); $i++) {
$elements = $xml->xpath('//__empty_ns:Role[@name="' . $roleName[$i] . '"]/__empty_ns:Instances');
-
+
if (count($elements) == 1) {
$element = $elements[0];
$element['count'] = $instanceCount[$i];
- }
+ }
}
-
+
$configuration = $xml->asXML();
//$configuration = preg_replace('/(<\?xml[^?]+?)utf-8/i', '$1utf-16', $configuration);
return $configuration;
}
-
+
/**
* The Change Deployment Configuration request may be specified as follows.
* Note that you can change a deployment's configuration either by specifying the deployment
- * environment (staging or production), or by specifying the deployment's unique name.
- *
+ * environment (staging or production), or by specifying the deployment's unique name.
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @param string $configuration XML configuration represented as a string
@@ -1477,20 +1490,20 @@ public function configureDeploymentBySlot($serviceName, $deploymentSlot, $config
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Configuration name should be specified.');
}
-
+
if (@file_exists($configuration)) {
$configuration = mb_convert_encoding(file_get_contents($configuration), 'ISO-8859-1', 'UTF-8');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deploymentslots/' . $deploymentSlot;
return $this->_configureDeployment($operationUrl, $configuration);
}
-
+
/**
* The Change Deployment Configuration request may be specified as follows.
* Note that you can change a deployment's configuration either by specifying the deployment
- * environment (staging or production), or by specifying the deployment's unique name.
- *
+ * environment (staging or production), or by specifying the deployment's unique name.
+ *
* @param string $serviceName The service name
* @param string $deploymentId The deployment ID as listed on the Windows Azure management portal
* @param string $configuration XML configuration represented as a string
@@ -1510,20 +1523,20 @@ public function configureDeploymentByDeploymentId($serviceName, $deploymentId, $
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Configuration name should be specified.');
}
-
+
if (@file_exists($configuration)) {
$configuration = mb_convert_encoding(file_get_contents($configuration), 'ISO-8859-1', 'UTF-8');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deployments/' . $deploymentId;
return $this->_configureDeployment($operationUrl, $configuration);
}
-
+
/**
* The Change Deployment Configuration request may be specified as follows.
* Note that you can change a deployment's configuration either by specifying the deployment
- * environment (staging or production), or by specifying the deployment's unique name.
- *
+ * environment (staging or production), or by specifying the deployment's unique name.
+ *
* @param string $operationUrl The operation url
* @param string $configuration XML configuration represented as a string
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -1537,16 +1550,16 @@ protected function _configureDeployment($operationUrl, $configuration)
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
'' . base64_encode($conformingConfiguration) . '');
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Upgrade Deployment operation initiates an upgrade.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @param string $label A URL that refers to the location of the service package in the Blob service. The service package must be located in a storage account beneath the same subscription.
@@ -1588,18 +1601,18 @@ public function upgradeDeploymentBySlot($serviceName, $deploymentSlot, $label, $
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Mode should be auto|manual.');
}
-
+
if (@file_exists($configuration)) {
$configuration = mb_convert_encoding(file_get_contents($configuration), 'ISO-8859-1', 'UTF-8');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deploymentslots/' . $deploymentSlot;
- return $this->_upgradeDeployment($operationUrl, $label, $packageUrl, $configuration, $mode, $roleToUpgrade);
+ return $this->_upgradeDeployment($operationUrl, $label, $packageUrl, $configuration, $mode, $roleToUpgrade);
}
-
+
/**
* The Upgrade Deployment operation initiates an upgrade.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentId The deployment ID as listed on the Windows Azure management portal
* @param string $label A URL that refers to the location of the service package in the Blob service. The service package must be located in a storage account beneath the same subscription.
@@ -1640,19 +1653,19 @@ public function upgradeDeploymentByDeploymentId($serviceName, $deploymentId, $la
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Mode should be auto|manual.');
}
-
+
if (@file_exists($configuration)) {
$configuration = mb_convert_encoding(file_get_contents($configuration), 'ISO-8859-1', 'UTF-8');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deployments/' . $deploymentId;
- return $this->_upgradeDeployment($operationUrl, $label, $packageUrl, $configuration, $mode, $roleToUpgrade);
+ return $this->_upgradeDeployment($operationUrl, $label, $packageUrl, $configuration, $mode, $roleToUpgrade);
}
-
-
+
+
/**
* The Upgrade Deployment operation initiates an upgrade.
- *
+ *
* @param string $operationUrl The operation url
* @param string $label A URL that refers to the location of the service package in the Blob service. The service package must be located in a storage account beneath the same subscription.
* @param string $packageUrl The service configuration file for the deployment.
@@ -1665,21 +1678,21 @@ protected function _upgradeDeployment($operationUrl, $label, $packageUrl, $confi
{
// Clean up the configuration
$conformingConfiguration = $this->_cleanConfiguration($configuration);
-
+
$response = $this->_performRequest($operationUrl . '/', '?comp=upgrade',
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
- '' . ucfirst($mode) . '' . $packageUrl . '' . base64_encode($conformingConfiguration) . '' . (!is_null($roleToUpgrade) ? '' . $roleToUpgrade . '' : '') . '');
-
+ '' . ucfirst($mode) . '' . $packageUrl . '' . base64_encode($conformingConfiguration) . '' . (!is_null($roleToUpgrade) ? '' . $roleToUpgrade . '' : '') . '');
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Walk Upgrade Domain operation specifies the next upgrade domain to be walked during an in-place upgrade.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @param int $upgradeDomain An integer value that identifies the upgrade domain to walk. Upgrade domains are identified with a zero-based index: the first upgrade domain has an ID of 0, the second has an ID of 1, and so on.
@@ -1696,14 +1709,14 @@ public function walkUpgradeDomainBySlot($serviceName, $deploymentSlot, $upgradeD
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Deployment slot should be production|staging.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deploymentslots/' . $deploymentSlot;
- return $this->_walkUpgradeDomain($operationUrl, $upgradeDomain);
+ return $this->_walkUpgradeDomain($operationUrl, $upgradeDomain);
}
-
+
/**
* The Walk Upgrade Domain operation specifies the next upgrade domain to be walked during an in-place upgrade.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentId The deployment ID as listed on the Windows Azure management portal
* @param int $upgradeDomain An integer value that identifies the upgrade domain to walk. Upgrade domains are identified with a zero-based index: the first upgrade domain has an ID of 0, the second has an ID of 1, and so on.
@@ -1719,15 +1732,15 @@ public function walkUpgradeDomainByDeploymentId($serviceName, $deploymentId, $up
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Deployment ID should be specified.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deployments/' . $deploymentId;
- return $this->_walkUpgradeDomain($operationUrl, $upgradeDomain);
+ return $this->_walkUpgradeDomain($operationUrl, $upgradeDomain);
}
-
-
+
+
/**
* The Walk Upgrade Domain operation specifies the next upgrade domain to be walked during an in-place upgrade.
- *
+ *
* @param string $operationUrl The operation url
* @param int $upgradeDomain An integer value that identifies the upgrade domain to walk. Upgrade domains are identified with a zero-based index: the first upgrade domain has an ID of 0, the second has an ID of 1, and so on.
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -1737,18 +1750,18 @@ protected function _walkUpgradeDomain($operationUrl, $upgradeDomain = 0)
$response = $this->_performRequest($operationUrl . '/', '?comp=walkupgradedomain',
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
- '' . $upgradeDomain . '');
+ '' . $upgradeDomain . '');
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Reboot Role Instance operation requests a reboot of a role instance
* that is running in a deployment.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @param string $roleInstanceName The role instance name
@@ -1769,15 +1782,15 @@ public function rebootRoleInstanceBySlot($serviceName, $deploymentSlot, $roleIns
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Role instance name should be specified.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deploymentslots/' . $deploymentSlot . '/roleinstances/' . $roleInstanceName;
return $this->_rebootOrReimageRoleInstance($operationUrl, 'reboot');
}
-
+
/**
* The Reboot Role Instance operation requests a reboot of a role instance
* that is running in a deployment.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentId The deployment ID as listed on the Windows Azure management portal
* @param string $roleInstanceName The role instance name
@@ -1797,7 +1810,7 @@ public function rebootRoleInstanceByDeploymentId($serviceName, $deploymentId, $r
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Role instance name should be specified.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deployments/' . $deploymentId . '/roleinstances/' . $roleInstanceName;
return $this->_rebootOrReimageRoleInstance($operationUrl, 'reboot');
}
@@ -1805,7 +1818,7 @@ public function rebootRoleInstanceByDeploymentId($serviceName, $deploymentId, $r
/**
* The Reimage Role Instance operation requests a reimage of a role instance
* that is running in a deployment.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentSlot The deployment slot (production or staging)
* @param string $roleInstanceName The role instance name
@@ -1826,15 +1839,15 @@ public function reimageRoleInstanceBySlot($serviceName, $deploymentSlot, $roleIn
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Role instance name should be specified.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deploymentslots/' . $deploymentSlot . '/roleinstances/' . $roleInstanceName;
return $this->_rebootOrReimageRoleInstance($operationUrl, 'reimage');
}
-
+
/**
* The Reimage Role Instance operation requests a reimage of a role instance
* that is running in a deployment.
- *
+ *
* @param string $serviceName The service name
* @param string $deploymentId The deployment ID as listed on the Windows Azure management portal
* @param string $roleInstanceName The role instance name
@@ -1854,14 +1867,14 @@ public function reimageRoleInstanceByDeploymentId($serviceName, $deploymentId, $
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Role instance name should be specified.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/deployments/' . $deploymentId . '/roleinstances/' . $roleInstanceName;
return $this->_rebootOrReimageRoleInstance($operationUrl, 'reimage');
}
-
+
/**
* Reboots or reimages a role instance.
- *
+ *
* @param string $operationUrl The operation url
* @param string $operation The operation (reboot|reimage)
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -1869,17 +1882,17 @@ public function reimageRoleInstanceByDeploymentId($serviceName, $deploymentId, $
protected function _rebootOrReimageRoleInstance($operationUrl, $operation = 'reboot')
{
$response = $this->_performRequest($operationUrl, '?comp=' . $operation, Zend_Http_Client::POST);
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The List Certificates operation lists all certificates associated with
* the specified hosted service.
- *
+ *
* @param string $serviceName The service name
* @return array Array of Zend_Service_WindowsAzure_Management_CertificateInstance
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -1890,7 +1903,7 @@ public function listCertificates($serviceName)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Service name should be specified.');
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/certificates';
$response = $this->_performRequest($operationUrl);
@@ -1907,8 +1920,8 @@ public function listCertificates($serviceName)
}
$services = array();
- if (!is_null($xmlServices)) {
-
+ if (!is_null($xmlServices)) {
+
for ($i = 0; $i < count($xmlServices); $i++) {
$services[] = new Zend_Service_WindowsAzure_Management_CertificateInstance(
(string)$xmlServices[$i]->CertificateUrl,
@@ -1924,10 +1937,10 @@ public function listCertificates($serviceName)
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Get Certificate operation returns the public data for the specified certificate.
- *
+ *
* @param string $serviceName|$certificateUrl The service name -or- the certificate URL
* @param string $algorithm Algorithm
* @param string $thumbprint Thumbprint
@@ -1944,17 +1957,17 @@ public function getCertificate($serviceName, $algorithm = '', $thumbprint = '')
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Algorithm and thumbprint should be specified.');
}
-
+
$operationUrl = str_replace($this->getBaseUrl(), '', $serviceName);
if (strpos($serviceName, 'https') === false) {
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/certificates/' . $algorithm . '-' . strtoupper($thumbprint);
}
-
+
$response = $this->_performRequest($operationUrl);
if ($response->isSuccessful()) {
$result = $this->_parseResponse($response);
-
+
return new Zend_Service_WindowsAzure_Management_CertificateInstance(
$this->getBaseUrl() . $operationUrl,
$algorithm,
@@ -1966,10 +1979,10 @@ public function getCertificate($serviceName, $algorithm = '', $thumbprint = '')
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Add Certificate operation adds a certificate to the subscription.
- *
+ *
* @param string $serviceName The service name
* @param string $certificateData Certificate data
* @param string $certificatePassword The certificate password
@@ -1994,11 +2007,11 @@ public function addCertificate($serviceName, $certificateData, $certificatePassw
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Certificate format should be "pfx".');
}
-
+
if (@file_exists($certificateData)) {
$certificateData = file_get_contents($certificateData);
}
-
+
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/certificates';
$response = $this->_performRequest($operationUrl, '',
Zend_Http_Client::POST,
@@ -2010,10 +2023,10 @@ public function addCertificate($serviceName, $certificateData, $certificatePassw
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Delete Certificate operation deletes a certificate from the subscription's certificate store.
- *
+ *
* @param string $serviceName|$certificateUrl The service name -or- the certificate URL
* @param string $algorithm Algorithm
* @param string $thumbprint Thumbprint
@@ -2029,12 +2042,12 @@ public function deleteCertificate($serviceName, $algorithm = '', $thumbprint = '
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Algorithm and thumbprint should be specified.');
}
-
+
$operationUrl = str_replace($this->getBaseUrl(), '', $serviceName);
if (strpos($serviceName, 'https') === false) {
$operationUrl = self::OP_HOSTED_SERVICES . '/' . $serviceName . '/certificates/' . $algorithm . '-' . strtoupper($thumbprint);
}
-
+
$response = $this->_performRequest($operationUrl, '', Zend_Http_Client::DELETE);
if (!$response->isSuccessful()) {
@@ -2042,11 +2055,11 @@ public function deleteCertificate($serviceName, $algorithm = '', $thumbprint = '
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The List Affinity Groups operation lists the affinity groups associated with
* the specified subscription.
- *
+ *
* @return array Array of Zend_Service_WindowsAzure_Management_AffinityGroupInstance
* @throws Zend_Service_WindowsAzure_Management_Exception
*/
@@ -2056,7 +2069,7 @@ public function listAffinityGroups()
if ($response->isSuccessful()) {
$result = $this->_parseResponse($response);
-
+
if (!$result->AffinityGroup) {
return array();
}
@@ -2065,10 +2078,10 @@ public function listAffinityGroups()
} else {
$xmlServices = array($result->AffinityGroup);
}
-
+
$services = array();
- if (!is_null($xmlServices)) {
-
+ if (!is_null($xmlServices)) {
+
for ($i = 0; $i < count($xmlServices); $i++) {
$services[] = new Zend_Service_WindowsAzure_Management_AffinityGroupInstance(
(string)$xmlServices[$i]->Name,
@@ -2084,14 +2097,14 @@ public function listAffinityGroups()
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Create Affinity Group operation creates a new affinity group for the specified subscription.
- *
+ *
* @param string $name A name for the affinity group that is unique to the subscription.
* @param string $label A label for the affinity group. The label may be up to 100 characters in length.
* @param string $description A description for the affinity group. The description may be up to 1024 characters in length.
- * @param string $location The location where the affinity group will be created. To list available locations, use the List Locations operation.
+ * @param string $location The location where the affinity group will be created. To list available locations, use the List Locations operation.
*/
public function createAffinityGroup($name, $label, $description = '', $location = '')
{
@@ -2115,24 +2128,24 @@ public function createAffinityGroup($name, $label, $description = '', $location
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Location should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_AFFINITYGROUPS, '',
Zend_Http_Client::POST,
array('Content-Type' => 'application/xml; charset=utf-8'),
- '' . $name . '' . $description . '' . $location . '');
-
+ '' . $name . '' . $description . '' . $location . '');
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Update Affinity Group operation updates the label and/or the description for an affinity group for the specified subscription.
- *
+ *
* @param string $name The name for the affinity group that should be updated.
* @param string $label A label for the affinity group. The label may be up to 100 characters in length.
- * @param string $description A description for the affinity group. The description may be up to 1024 characters in length.
+ * @param string $description A description for the affinity group. The description may be up to 1024 characters in length.
*/
public function updateAffinityGroup($name, $label, $description = '')
{
@@ -2152,21 +2165,21 @@ public function updateAffinityGroup($name, $label, $description = '')
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Description is too long. The maximum length is 1024 characters.');
}
-
+
$response = $this->_performRequest(self::OP_AFFINITYGROUPS . '/' . $name, '',
Zend_Http_Client::PUT,
array('Content-Type' => 'application/xml; charset=utf-8'),
- '' . $description . '');
-
+ '' . $description . '');
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Delete Affinity Group operation deletes an affinity group in the specified subscription.
- *
+ *
* @param string $name The name for the affinity group that should be deleted.
*/
public function deleteAffinityGroup($name)
@@ -2175,20 +2188,20 @@ public function deleteAffinityGroup($name)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Affinity group name should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_AFFINITYGROUPS . '/' . $name, '',
Zend_Http_Client::DELETE);
-
+
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The Get Affinity Group Properties operation returns the
* system properties associated with the specified affinity group.
- *
+ *
* @param string $affinityGroupName The affinity group name.
* @return Zend_Service_WindowsAzure_Management_AffinityGroupInstance
* @throws Zend_Service_WindowsAzure_Management_Exception
@@ -2199,12 +2212,12 @@ public function getAffinityGroupProperties($affinityGroupName)
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception('Affinity group name should be specified.');
}
-
+
$response = $this->_performRequest(self::OP_AFFINITYGROUPS . '/' . $affinityGroupName);
if ($response->isSuccessful()) {
$result = $this->_parseResponse($response);
-
+
$affinityGroup = new Zend_Service_WindowsAzure_Management_AffinityGroupInstance(
$affinityGroupName,
(string)$result->Label,
@@ -2218,9 +2231,9 @@ public function getAffinityGroupProperties($affinityGroupName)
} else {
$xmlService = array($result->HostedServices->HostedService);
}
-
+
$services = array();
- if (!is_null($xmlService)) {
+ if (!is_null($xmlService)) {
for ($i = 0; $i < count($xmlService); $i++) {
$services[] = array(
'url' => (string)$xmlService[$i]->Url,
@@ -2229,16 +2242,16 @@ public function getAffinityGroupProperties($affinityGroupName)
}
}
$affinityGroup->HostedServices = $services;
-
+
// Storage services
if (count($result->StorageServices->StorageService) > 1) {
$xmlService = $result->StorageServices->StorageService;
} else {
$xmlService = array($result->StorageServices->StorageService);
}
-
+
$services = array();
- if (!is_null($xmlService)) {
+ if (!is_null($xmlService)) {
for ($i = 0; $i < count($xmlService); $i++) {
$services[] = array(
'url' => (string)$xmlService[$i]->Url,
@@ -2246,19 +2259,19 @@ public function getAffinityGroupProperties($affinityGroupName)
);
}
}
- $affinityGroup->StorageServices = $services;
-
+ $affinityGroup->StorageServices = $services;
+
return $affinityGroup;
} else {
// require_once 'Zend/Service/WindowsAzure/Management/Exception.php';
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The List Locations operation lists all of the data center locations
* that are valid for your subscription.
- *
+ *
* @return array Array of Zend_Service_WindowsAzure_Management_LocationInstance
* @throws Zend_Service_WindowsAzure_Management_Exception
*/
@@ -2268,7 +2281,7 @@ public function listLocations()
if ($response->isSuccessful()) {
$result = $this->_parseResponse($response);
-
+
if (!$result->Location) {
return array();
}
@@ -2277,10 +2290,10 @@ public function listLocations()
} else {
$xmlServices = array($result->Location);
}
-
+
$services = array();
- if (!is_null($xmlServices)) {
-
+ if (!is_null($xmlServices)) {
+
for ($i = 0; $i < count($xmlServices); $i++) {
$services[] = new Zend_Service_WindowsAzure_Management_LocationInstance(
(string)$xmlServices[$i]->Name
@@ -2293,7 +2306,7 @@ public function listLocations()
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The List Operating Systems operation lists the versions of the guest operating system
* that are currently available in Windows Azure. The 2010-10-28 version of List Operating
@@ -2302,7 +2315,7 @@ public function listLocations()
* operating system that is substantially compatible with Windows Server 2008 SP2,
* and the Windows Azure guest operating system that is substantially compatible with
* Windows Server 2008 R2.
- *
+ *
* @return array Array of Zend_Service_WindowsAzure_Management_OperatingSystemInstance
* @throws Zend_Service_WindowsAzure_Management_Exception
*/
@@ -2312,7 +2325,7 @@ public function listOperatingSystems()
if ($response->isSuccessful()) {
$result = $this->_parseResponse($response);
-
+
if (!$result->OperatingSystem) {
return array();
}
@@ -2321,10 +2334,10 @@ public function listOperatingSystems()
} else {
$xmlServices = array($result->OperatingSystem);
}
-
+
$services = array();
- if (!is_null($xmlServices)) {
-
+ if (!is_null($xmlServices)) {
+
for ($i = 0; $i < count($xmlServices); $i++) {
$services[] = new Zend_Service_WindowsAzure_Management_OperatingSystemInstance(
(string)$xmlServices[$i]->Version,
@@ -2342,7 +2355,7 @@ public function listOperatingSystems()
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* The List OS Families operation lists the guest operating system families
* available in Windows Azure, and also lists the operating system versions
@@ -2351,7 +2364,7 @@ public function listOperatingSystems()
* substantially compatible with Windows Server 2008 SP2, and the Windows
* Azure guest operating system that is substantially compatible with
* Windows Server 2008 R2.
- *
+ *
* @return array Array of Zend_Service_WindowsAzure_Management_OperatingSystemFamilyInstance
* @throws Zend_Service_WindowsAzure_Management_Exception
*/
@@ -2361,7 +2374,7 @@ public function listOperatingSystemFamilies()
if ($response->isSuccessful()) {
$result = $this->_parseResponse($response);
-
+
if (!$result->OperatingSystemFamily) {
return array();
}
@@ -2370,24 +2383,24 @@ public function listOperatingSystemFamilies()
} else {
$xmlServices = array($result->OperatingSystemFamily);
}
-
+
$services = array();
- if (!is_null($xmlServices)) {
-
+ if (!is_null($xmlServices)) {
+
for ($i = 0; $i < count($xmlServices); $i++) {
$services[] = new Zend_Service_WindowsAzure_Management_OperatingSystemFamilyInstance(
(string)$xmlServices[$i]->Name,
(string)$xmlServices[$i]->Label
);
-
+
if (count($xmlServices[$i]->OperatingSystems->OperatingSystem) > 1) {
$xmlOperatingSystems = $xmlServices[$i]->OperatingSystems->OperatingSystem;
} else {
$xmlOperatingSystems = array($xmlServices[$i]->OperatingSystems->OperatingSystem);
}
-
+
$operatingSystems = array();
- if (!is_null($xmlOperatingSystems)) {
+ if (!is_null($xmlOperatingSystems)) {
// require_once 'Zend/Service/WindowsAzure/Management/OperatingSystemInstance.php';
for ($i = 0; $i < count($xmlOperatingSystems); $i++) {
$operatingSystems[] = new Zend_Service_WindowsAzure_Management_OperatingSystemInstance(
@@ -2409,10 +2422,10 @@ public function listOperatingSystemFamilies()
throw new Zend_Service_WindowsAzure_Management_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Clean configuration
- *
+ *
* @param string $configuration Configuration to clean.
* @return string
*/
@@ -2420,7 +2433,7 @@ public function _cleanConfiguration($configuration) {
$configuration = str_replace('?', '', $configuration);
$configuration = str_replace("\r", "", $configuration);
$configuration = str_replace("\n", "", $configuration);
-
+
return $configuration;
}
}
diff --git a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage.php b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage.php
index 7eb25ee3c..d369199b3 100644
--- a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage.php
+++ b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage.php
@@ -1,4 +1,7 @@
_host = $host;
$this->_accountName = $accountName;
$this->_accountKey = $accountKey;
$this->_usePathStyleUri = $usePathStyleUri;
-
+
// Using local storage?
if (!$this->_usePathStyleUri
&& ($this->_host == self::URL_DEV_BLOB
@@ -192,17 +197,17 @@ public function __construct(
// Local storage
$this->_usePathStyleUri = true;
}
-
+
if (is_null($this->_credentials)) {
$this->_credentials = new Zend_Service_WindowsAzure_Credentials_SharedKey(
$this->_accountName, $this->_accountKey, $this->_usePathStyleUri);
}
-
+
$this->_retryPolicy = $retryPolicy;
if (is_null($this->_retryPolicy)) {
$this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
}
-
+
// Setup default Zend_Http_Client channel
$options = array(
'adapter' => 'Zend_Http_Client_Adapter_Proxy'
@@ -216,43 +221,45 @@ public function __construct(
}
$this->_httpClientChannel = new Zend_Http_Client(null, $options);
}
-
+
/**
* Set the HTTP client channel to use
- *
+ *
* @param Zend_Http_Client_Adapter_Interface|string $adapterInstance Adapter instance or adapter class name.
*/
public function setHttpClientChannel($adapterInstance = 'Zend_Http_Client_Adapter_Proxy')
{
$this->_httpClientChannel->setAdapter($adapterInstance);
}
-
+
/**
* Retrieve HTTP client channel
- *
+ *
* @return Zend_Http_Client_Adapter_Interface
*/
public function getHttpClientChannel()
{
return $this->_httpClientChannel;
}
-
+
/**
* Set retry policy to use when making requests
*
- * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
+ * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract|null $retryPolicy Retry policy to use when making requests
*/
- public function setRetryPolicy(Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
+ public function setRetryPolicy($retryPolicy = null)
{
+ Types::isNullable('retryPolicy', $retryPolicy, 'Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract');
+
$this->_retryPolicy = $retryPolicy;
if (is_null($this->_retryPolicy)) {
$this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
}
}
-
+
/**
* Set proxy
- *
+ *
* @param boolean $useProxy Use proxy?
* @param string $proxyUrl Proxy URL
* @param int $proxyPort Proxy port
@@ -264,10 +271,10 @@ public function setProxy($useProxy = false, $proxyUrl = '', $proxyPort = 80, $pr
$this->_proxyUrl = $proxyUrl;
$this->_proxyPort = $proxyPort;
$this->_proxyCredentials = $proxyCredentials;
-
+
if ($this->_useProxy) {
$credentials = explode(':', $this->_proxyCredentials);
-
+
$this->_httpClientChannel->setConfig(array(
'proxy_host' => $this->_proxyUrl,
'proxy_port' => $this->_proxyPort,
@@ -283,17 +290,17 @@ public function setProxy($useProxy = false, $proxyUrl = '', $proxyPort = 80, $pr
));
}
}
-
+
/**
* Returns the Windows Azure account name
- *
+ *
* @return string
*/
public function getAccountName()
{
return $this->_accountName;
}
-
+
/**
* Get base URL for creating requests
*
@@ -307,10 +314,10 @@ public function getBaseUrl()
return 'http://' . $this->_accountName . '.' . $this->_host;
}
}
-
+
/**
* Set Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
- *
+ *
* @param Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $credentials Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance to use for request signing.
*/
public function setCredentials(Zend_Service_WindowsAzure_Credentials_CredentialsAbstract $credentials)
@@ -320,17 +327,17 @@ public function setCredentials(Zend_Service_WindowsAzure_Credentials_Credentials
$this->_credentials->setAccountkey($this->_accountKey);
$this->_credentials->setUsePathStyleUri($this->_usePathStyleUri);
}
-
+
/**
* Get Zend_Service_WindowsAzure_Credentials_CredentialsAbstract instance
- *
+ *
* @return Zend_Service_WindowsAzure_Credentials_CredentialsAbstract
*/
public function getCredentials()
{
return $this->_credentials;
}
-
+
/**
* Perform request using Zend_Http_Client channel
*
@@ -358,12 +365,12 @@ protected function _performRequest(
if (strpos($path, '/') !== 0) {
$path = '/' . $path;
}
-
+
// Clean headers
if (is_null($headers)) {
$headers = array();
}
-
+
// Ensure cUrl will also work correctly:
// - disable Content-Type if required
// - disable Expect: 100 Continue
@@ -374,7 +381,7 @@ protected function _performRequest(
// Add version header
$headers['x-ms-version'] = $this->_apiVersion;
-
+
// URL encoding
$path = self::urlencode($path);
$queryString = self::urlencode($queryString);
@@ -385,55 +392,57 @@ protected function _performRequest(
$requestHeaders = $this->_credentials
->signRequestHeaders($httpVerb, $path, $queryString, $headers, $forTableStorage, $resourceType, $requiredPermission, $rawData);
- // Prepare request
+ // Prepare request
$this->_httpClientChannel->resetParameters(true);
$this->_httpClientChannel->setUri($requestUrl);
$this->_httpClientChannel->setHeaders($requestHeaders);
$this->_httpClientChannel->setRawData($rawData);
-
+
// Execute request
$response = $this->_retryPolicy->execute(
array($this->_httpClientChannel, 'request'),
array($httpVerb)
);
-
+
return $response;
}
-
- /**
+
+ /**
* Parse result from Zend_Http_Response
*
- * @param Zend_Http_Response $response Response from HTTP call
+ * @param Zend_Http_Response|null $response Response from HTTP call
* @return object
* @throws Zend_Service_WindowsAzure_Exception
*/
- protected function _parseResponse(Zend_Http_Response $response = null)
+ protected function _parseResponse($response = null)
{
+ Types::isNullable('response', $response, 'Zend_Http_Response');
+
if (is_null($response)) {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Response should not be null.');
}
-
+
$xml = Zend_Xml_Security::scan($response->getBody());
-
+
if ($xml !== false) {
- // Fetch all namespaces
- $namespaces = array_merge($xml->getNamespaces(true), $xml->getDocNamespaces(true));
-
+ // Fetch all namespaces
+ $namespaces = array_merge($xml->getNamespaces(true), $xml->getDocNamespaces(true));
+
// Register all namespace prefixes
- foreach ($namespaces as $prefix => $ns) {
+ foreach ($namespaces as $prefix => $ns) {
if ($prefix != '') {
$xml->registerXPathNamespace($prefix, $ns);
- }
- }
+ }
+ }
}
-
+
return $xml;
}
-
+
/**
* Generate metadata headers
- *
+ *
* @param array $metadata
* @return HTTP headers containing metadata
*/
@@ -443,7 +452,7 @@ protected function _generateMetadataHeaders($metadata = array())
if (!is_array($metadata)) {
return array();
}
-
+
// Return headers
$headers = array();
foreach ($metadata as $key => $value) {
@@ -451,20 +460,20 @@ protected function _generateMetadataHeaders($metadata = array())
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Metadata cannot contain newline characters.');
}
-
+
if (!self::isValidMetadataName($key)) {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Metadata name does not adhere to metadata naming conventions. See http://msdn.microsoft.com/en-us/library/aa664670(VS.71).aspx for more information.');
}
-
+
$headers["x-ms-meta-" . strtolower($key)] = $value;
}
return $headers;
}
-
+
/**
* Parse metadata headers
- *
+ *
* @param array $headers HTTP headers containing metadata
* @return array
*/
@@ -474,7 +483,7 @@ protected function _parseMetadataHeaders($headers = array())
if (!is_array($headers)) {
return array();
}
-
+
// Return metadata
$metadata = array();
foreach ($headers as $key => $value) {
@@ -484,10 +493,10 @@ protected function _parseMetadataHeaders($headers = array())
}
return $metadata;
}
-
+
/**
* Parse metadata XML
- *
+ *
* @param SimpleXMLElement $parentElement Element containing the Metadata element.
* @return array
*/
@@ -500,30 +509,30 @@ protected function _parseMetadataElement($element = null)
return array();
}
-
+
/**
* Generate ISO 8601 compliant date string in UTC time zone
- *
+ *
* @param int $timestamp
* @return string
*/
- public function isoDate($timestamp = null)
- {
+ public function isoDate($timestamp = null)
+ {
$tz = @date_default_timezone_get();
@date_default_timezone_set('UTC');
-
+
if (is_null($timestamp)) {
$timestamp = time();
}
-
+
$returnValue = str_replace('+00:00', '.0000000Z', @date('c', $timestamp));
@date_default_timezone_set($tz);
return $returnValue;
}
-
+
/**
* URL encode function
- *
+ *
* @param string $value Value to encode
* @return string Encoded value
*/
@@ -531,7 +540,7 @@ public static function urlencode($value)
{
return str_replace(' ', '%20', $value);
}
-
+
/**
* Is valid metadata name?
*
@@ -543,22 +552,22 @@ public static function isValidMetadataName($metadataName = '')
if (preg_match("/^[a-zA-Z0-9_@][a-zA-Z0-9_]*$/", $metadataName) === 0) {
return false;
}
-
+
if ($metadataName == '') {
return false;
}
return true;
}
-
+
/**
* Builds a query string from an array of elements
- *
+ *
* @param array Array of elements
* @return string Assembled query string
*/
public static function createQueryStringFromArray($queryString)
{
return count($queryString) > 0 ? '?' . implode('&', $queryString) : '';
- }
+ }
}
diff --git a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Batch.php b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Batch.php
index 0bf247a8e..d1ac89af8 100644
--- a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Batch.php
+++ b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Batch.php
@@ -1,4 +1,7 @@
_storageClient = $storageClient;
$this->_baseUrl = $baseUrl;
$this->_beginBatch();
}
-
+
/**
* Get base URL for creating requests
*
@@ -86,17 +91,17 @@ public function getBaseUrl()
{
return $this->_baseUrl;
}
-
+
/**
* Starts a new batch operation set
- *
+ *
* @throws Zend_Service_WindowsAzure_Exception
*/
protected function _beginBatch()
{
$this->_storageClient->setCurrentBatch($this);
}
-
+
/**
* Cleanup current batch
*/
@@ -124,7 +129,7 @@ public function enlistOperation($path = '/', $queryString = '', $httpVerb = Zend
if ($forTableStorage) {
$this->_forTableStorage = true;
}
-
+
// Set _isSingleSelect
if ($httpVerb == Zend_Http_Client::GET) {
if (count($this->_operations) > 0) {
@@ -133,29 +138,29 @@ public function enlistOperation($path = '/', $queryString = '', $httpVerb = Zend
}
$this->_isSingleSelect = true;
}
-
+
// Clean path
if (strpos($path, '/') !== 0) {
$path = '/' . $path;
}
-
+
// Clean headers
if (is_null($headers)) {
$headers = array();
}
-
+
// URL encoding
$path = Zend_Service_WindowsAzure_Storage::urlencode($path);
$queryString = Zend_Service_WindowsAzure_Storage::urlencode($queryString);
// Generate URL
$requestUrl = $this->getBaseUrl() . $path . $queryString;
-
+
// Generate $rawData
if (is_null($rawData)) {
$rawData = '';
}
-
+
// Add headers
if ($httpVerb != Zend_Http_Client::GET) {
$headers['Content-ID'] = count($this->_operations) + 1;
@@ -164,7 +169,7 @@ public function enlistOperation($path = '/', $queryString = '', $httpVerb = Zend
}
$headers['Content-Length'] = strlen($rawData);
}
-
+
// Generate $operation
$operation = '';
$operation .= $httpVerb . ' ' . $requestUrl . ' HTTP/1.1' . "\n";
@@ -173,42 +178,42 @@ public function enlistOperation($path = '/', $queryString = '', $httpVerb = Zend
$operation .= $key . ': ' . $value . "\n";
}
$operation .= "\n";
-
+
// Add data
$operation .= $rawData;
// Store operation
- $this->_operations[] = $operation;
+ $this->_operations[] = $operation;
}
-
+
/**
* Commit current batch
- *
+ *
* @return Zend_Http_Response
* @throws Zend_Service_WindowsAzure_Exception
*/
public function commit()
- {
+ {
// Perform batch
$response = $this->_storageClient->performBatch($this->_operations, $this->_forTableStorage, $this->_isSingleSelect);
-
+
// Dispose
$this->_clean();
-
+
// Parse response
$errors = null;
preg_match_all('/(.*)<\/message>/', $response->getBody(), $errors);
-
+
// Error?
if (count($errors[2]) > 0) {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('An error has occured while committing a batch: ' . $errors[2][0]);
}
-
+
// Return
return $response;
}
-
+
/**
* Rollback current batch
*/
@@ -217,20 +222,20 @@ public function rollback()
// Dispose
$this->_clean();
}
-
+
/**
* Get operation count
- *
+ *
* @return integer
*/
public function getOperationCount()
{
return count($this->_operations);
}
-
+
/**
* Is single select?
- *
+ *
* @return boolean
*/
public function isSingleSelect()
diff --git a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php
index a50072293..9c37da94e 100644
--- a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php
+++ b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/BatchStorageAbstract.php
@@ -1,4 +1,7 @@
isInBatch()) {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Only one batch can be active at a time.');
}
$this->_currentBatch = $batch;
}
-
+
/**
* Get current batch
- *
+ *
* @return Zend_Service_WindowsAzure_Storage_Batch
*/
public function getCurrentBatch()
{
return $this->_currentBatch;
}
-
+
/**
* Is there a current batch?
- *
+ *
* @return boolean
*/
public function isInBatch()
{
return !is_null($this->_currentBatch);
}
-
+
/**
* Starts a new batch operation set
- *
+ *
* @return Zend_Service_WindowsAzure_Storage_Batch
* @throws Zend_Service_WindowsAzure_Exception
*/
@@ -88,7 +93,7 @@ public function startBatch()
// require_once 'Zend/Service/WindowsAzure/Storage/Batch.php';
return new Zend_Service_WindowsAzure_Storage_Batch($this, $this->getBaseUrl());
}
-
+
/**
* Perform batch using Zend_Http_Client channel, combining all batch operations into one request
*
@@ -104,42 +109,42 @@ public function performBatch($operations = array(), $forTableStorage = false, $i
// Generate boundaries
$batchBoundary = 'batch_' . md5(time() . microtime());
$changesetBoundary = 'changeset_' . md5(time() . microtime());
-
+
// Set headers
$headers = array();
-
+
// Add version header
$headers['x-ms-version'] = $this->_apiVersion;
-
+
// Add dataservice headers
$headers['DataServiceVersion'] = '1.0;NetFx';
$headers['MaxDataServiceVersion'] = '1.0;NetFx';
-
+
// Add content-type header
$headers['Content-Type'] = 'multipart/mixed; boundary=' . $batchBoundary;
// Set path and query string
$path = '/$batch';
$queryString = '';
-
+
// Set verb
$httpVerb = Zend_Http_Client::POST;
-
+
// Generate raw data
$rawData = '';
-
+
// Single select?
if ($isSingleSelect) {
$operation = $operations[0];
$rawData .= '--' . $batchBoundary . "\n";
$rawData .= 'Content-Type: application/http' . "\n";
$rawData .= 'Content-Transfer-Encoding: binary' . "\n\n";
- $rawData .= $operation;
+ $rawData .= $operation;
$rawData .= '--' . $batchBoundary . '--';
} else {
$rawData .= '--' . $batchBoundary . "\n";
$rawData .= 'Content-Type: multipart/mixed; boundary=' . $changesetBoundary . "\n\n";
-
+
// Add operations
foreach ($operations as $operation)
{
@@ -149,7 +154,7 @@ public function performBatch($operations = array(), $forTableStorage = false, $i
$rawData .= $operation;
}
$rawData .= '--' . $changesetBoundary . '--' . "\n";
-
+
$rawData .= '--' . $batchBoundary . '--';
}
@@ -162,7 +167,7 @@ public function performBatch($operations = array(), $forTableStorage = false, $i
$this->_httpClientChannel->setUri($requestUrl);
$this->_httpClientChannel->setHeaders($requestHeaders);
$this->_httpClientChannel->setRawData($rawData);
-
+
// Execute request
$response = $this->_retryPolicy->execute(
array($this->_httpClientChannel, 'request'),
diff --git a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Blob.php b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Blob.php
index eef316591..f8e30949a 100644
--- a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Blob.php
+++ b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Blob.php
@@ -1,4 +1,7 @@
listContainers($containerName, 1);
foreach ($containers as $container) {
@@ -232,7 +237,7 @@ public function createContainer($containerName = '', $metadata = array())
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Meta data should be an array of key and value pairs.');
}
-
+
// Create metadata headers
$headers = array();
$headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
@@ -240,7 +245,7 @@ public function createContainer($containerName = '', $metadata = array())
// Perform request
$response = $this->_performRequest($containerName, '?restype=container', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
if ($response->isSuccessful()) {
-
+
return new Zend_Service_WindowsAzure_Storage_BlobContainer(
$containerName,
$response->getHeader('Etag'),
@@ -252,7 +257,7 @@ public function createContainer($containerName = '', $metadata = array())
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Create container if it does not exist
*
@@ -510,7 +515,7 @@ public function deleteContainer($containerName = '', $additionalHeaders = array(
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
}
-
+
// Additional headers?
$headers = array();
foreach ($additionalHeaders as $key => $value) {
@@ -553,7 +558,7 @@ public function listContainers($prefix = null, $maxResults = null, $marker = nul
$queryString[] = 'include=' . $include;
}
$queryString = self::createQueryStringFromArray($queryString);
-
+
// Perform request
$response = $this->_performRequest('', $queryString, Zend_Http_Client::GET, array(), false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_CONTAINER, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_LIST);
if ($response->isSuccessful()) {
@@ -563,7 +568,7 @@ public function listContainers($prefix = null, $maxResults = null, $marker = nul
$containers = array();
if (!is_null($xmlContainers)) {
for ($i = 0; $i < count($xmlContainers); $i++) {
-
+
$containers[] = new Zend_Service_WindowsAzure_Storage_BlobContainer(
(string)$xmlContainers[$i]->Name,
(string)$xmlContainers[$i]->Etag,
@@ -581,7 +586,7 @@ public function listContainers($prefix = null, $maxResults = null, $marker = nul
if (!is_null($maxResults) && count($containers) > $maxResults) {
$containers = array_slice($containers, 0, $maxResults);
}
-
+
return $containers;
} else {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
@@ -627,7 +632,7 @@ public function putBlob($containerName = '', $blobName = '', $localFileName = ''
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
}
-
+
// Check file size
if (filesize($localFileName) >= self::MAX_BLOB_SIZE) {
return $this->putLargeBlob($containerName, $blobName, $localFileName, $metadata, $leaseId, $additionalHeaders);
@@ -689,7 +694,7 @@ public function putBlobData($containerName = '', $blobName = '', $data = '', $me
// Perform request
$response = $this->_performRequest($resourceName, '', Zend_Http_Client::PUT, $headers, false, $data, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
if ($response->isSuccessful()) {
-
+
return new Zend_Service_WindowsAzure_Storage_BlobInstance(
$containerName,
$blobName,
@@ -748,12 +753,12 @@ public function putLargeBlob($containerName = '', $blobName = '', $localFileName
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Blobs stored in the root container can not have a name containing a forward slash (/).');
}
-
+
// Check file size
if (filesize($localFileName) < self::MAX_BLOB_SIZE) {
return $this->putBlob($containerName, $blobName, $localFileName, $metadata, $leaseId, $additionalHeaders);
}
-
+
// Determine number of parts
$numberOfParts = ceil( filesize($localFileName) / self::MAX_BLOB_TRANSFER_SIZE );
@@ -769,18 +774,18 @@ public function putLargeBlob($containerName = '', $blobName = '', $localFileName
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Could not open local file.');
}
-
+
// Upload parts
for ($i = 0; $i < $numberOfParts; $i++) {
// Seek position in file
fseek($fp, $i * self::MAX_BLOB_TRANSFER_SIZE);
-
+
// Read contents
$fileContents = fread($fp, self::MAX_BLOB_TRANSFER_SIZE);
-
+
// Put block
$this->putBlock($containerName, $blobName, $blockIdentifiers[$i], $fileContents, $leaseId);
-
+
// Dispose file contents
$fileContents = null;
unset($fileContents);
@@ -795,7 +800,7 @@ public function putLargeBlob($containerName = '', $blobName = '', $localFileName
// Return information of the blob
return $this->getBlobInstance($containerName, $blobName, null, $leaseId);
}
-
+
/**
* Put large blob block
*
@@ -834,7 +839,7 @@ public function putBlock($containerName = '', $blobName = '', $identifier = '',
if (!is_null($leaseId)) {
$headers['x-ms-lease-id'] = $leaseId;
}
-
+
// Resource name
$resourceName = self::createResourceName($containerName , $blobName);
@@ -971,7 +976,7 @@ public function getBlockList($containerName = '', $blobName = '', $snapshotId =
// Resource name
$resourceName = self::createResourceName($containerName , $blobName);
-
+
// Perform request
$response = $this->_performRequest($resourceName, $queryString, Zend_Http_Client::GET, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_READ);
if ($response->isSuccessful()) {
@@ -1062,7 +1067,7 @@ public function createPageBlob($containerName = '', $blobName = '', $size = 0, $
// Perform request
$response = $this->_performRequest($resourceName, '', Zend_Http_Client::PUT, $headers, false, '', Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
if ($response->isSuccessful()) {
-
+
return new Zend_Service_WindowsAzure_Storage_BlobInstance(
$containerName,
$blobName,
@@ -1220,24 +1225,24 @@ public function getPageRegions($containerName = '', $blobName = '', $startByteOf
} else {
$xmlRanges = array($result->PageRange);
}
-
-
+
+
$ranges = array();
-
+
for ($i = 0; $i < count($xmlRanges); $i++) {
$ranges[] = new Zend_Service_WindowsAzure_Storage_PageRegionInstance(
(int)$xmlRanges[$i]->Start,
(int)$xmlRanges[$i]->End
);
}
-
+
return $ranges;
} else {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Copy blob
*
@@ -1312,7 +1317,7 @@ public function copyBlob($sourceContainerName = '', $sourceBlobName = '', $desti
// Perform request
$response = $this->_performRequest($destinationResourceName, '', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
if ($response->isSuccessful()) {
-
+
return new Zend_Service_WindowsAzure_Storage_BlobInstance(
$destinationContainerName,
$destinationBlobName,
@@ -1458,7 +1463,7 @@ public function getBlobInstance($containerName = '', $blobName = '', $snapshotId
$queryString[] = 'snapshot=' . $snapshotId;
}
$queryString = self::createQueryStringFromArray($queryString);
-
+
// Additional headers?
$headers = array();
if (!is_null($leaseId)) {
@@ -1476,7 +1481,7 @@ public function getBlobInstance($containerName = '', $blobName = '', $snapshotId
if ($response->isSuccessful()) {
// Parse metadata
$metadata = $this->_parseMetadataHeaders($response->getHeaders());
-
+
// Return blob
return new Zend_Service_WindowsAzure_Storage_BlobInstance(
$containerName,
@@ -1709,7 +1714,7 @@ public function deleteBlob($containerName = '', $blobName = '', $snapshotId = nu
$queryString[] = 'snapshot=' . $snapshotId;
}
$queryString = self::createQueryStringFromArray($queryString);
-
+
// Additional headers?
$headers = array();
if (!is_null($leaseId)) {
@@ -1819,9 +1824,9 @@ public function leaseBlob($containerName = '', $blobName = '', $leaseAction = se
// Perform request
$response = $this->_performRequest($resourceName, '?comp=lease', Zend_Http_Client::PUT, $headers, false, null, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB, Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::PERMISSION_WRITE);
-
-
-
+
+
+
if ($response->isSuccessful()) {
return new Zend_Service_WindowsAzure_Storage_LeaseInstance(
$containerName,
@@ -1857,7 +1862,7 @@ public function listBlobs($containerName = '', $prefix = '', $delimiter = '', $m
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Container name does not adhere to container naming conventions. See http://msdn.microsoft.com/en-us/library/dd135715.aspx for more information.');
}
-
+
// Build query string
$queryString = array('restype=container', 'comp=list');
if (!is_null($prefix)) {
@@ -1882,14 +1887,14 @@ public function listBlobs($containerName = '', $prefix = '', $delimiter = '', $m
if ($response->isSuccessful()) {
// Return value
$blobs = array();
-
+
// Blobs
$xmlBlobs = $this->_parseResponse($response)->Blobs->Blob;
if (!is_null($xmlBlobs)) {
-
+
for ($i = 0; $i < count($xmlBlobs); $i++) {
$properties = (array)$xmlBlobs[$i]->Properties;
-
+
$blobs[] = new Zend_Service_WindowsAzure_Storage_BlobInstance(
$containerName,
(string)$xmlBlobs[$i]->Name,
@@ -1909,12 +1914,12 @@ public function listBlobs($containerName = '', $prefix = '', $delimiter = '', $m
);
}
}
-
+
// Blob prefixes (folders)
$xmlBlobs = $this->_parseResponse($response)->Blobs->BlobPrefix;
-
+
if (!is_null($xmlBlobs)) {
-
+
for ($i = 0; $i < count($xmlBlobs); $i++) {
$blobs[] = new Zend_Service_WindowsAzure_Storage_BlobInstance(
$containerName,
@@ -1935,7 +1940,7 @@ public function listBlobs($containerName = '', $prefix = '', $delimiter = '', $m
);
}
}
-
+
// More blobs?
$xmlMarker = (string)$this->_parseResponse($response)->NextMarker;
$currentResultCount = $currentResultCount + count($blobs);
@@ -1947,7 +1952,7 @@ public function listBlobs($containerName = '', $prefix = '', $delimiter = '', $m
if (!is_null($maxResults) && count($blobs) > $maxResults) {
$blobs = array_slice($blobs, 0, $maxResults);
}
-
+
return $blobs;
} else {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
diff --git a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Queue.php b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Queue.php
index 220c9f109..4452b8c82 100644
--- a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Queue.php
+++ b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Queue.php
@@ -1,4 +1,7 @@
_apiVersion = '2009-09-19';
}
-
+
/**
* Check if a queue exists
- *
+ *
* @param string $queueName Queue name
* @return boolean
*/
@@ -87,7 +92,7 @@ public function queueExists($queueName = '')
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
}
-
+
// List queues
$queues = $this->listQueues($queueName, 1);
foreach ($queues as $queue) {
@@ -95,10 +100,10 @@ public function queueExists($queueName = '')
return true;
}
}
-
+
return false;
}
-
+
/**
* Create queue
*
@@ -117,15 +122,15 @@ public function createQueue($queueName = '', $metadata = array())
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
}
-
+
// Create metadata headers
$headers = array();
- $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-
+ $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+
// Perform request
- $response = $this->_performRequest($queueName, '', Zend_Http_Client::PUT, $headers);
+ $response = $this->_performRequest($queueName, '', Zend_Http_Client::PUT, $headers);
if ($response->isSuccessful()) {
-
+
return new Zend_Service_WindowsAzure_Storage_QueueInstance(
$queueName,
$metadata
@@ -135,7 +140,7 @@ public function createQueue($queueName = '', $metadata = array())
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Create queue if it does not exist
*
@@ -149,10 +154,10 @@ public function createQueueIfNotExists($queueName = '', $metadata = array())
$this->createQueue($queueName, $metadata);
}
}
-
+
/**
* Get queue
- *
+ *
* @param string $queueName Queue name
* @return Zend_Service_WindowsAzure_Storage_QueueInstance
* @throws Zend_Service_WindowsAzure_Exception
@@ -167,13 +172,13 @@ public function getQueue($queueName = '')
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
}
-
+
// Perform request
- $response = $this->_performRequest($queueName, '?comp=metadata', Zend_Http_Client::GET);
+ $response = $this->_performRequest($queueName, '?comp=metadata', Zend_Http_Client::GET);
if ($response->isSuccessful()) {
// Parse metadata
$metadata = $this->_parseMetadataHeaders($response->getHeaders());
-
+
// Return queue
$queue = new Zend_Service_WindowsAzure_Storage_QueueInstance(
$queueName,
@@ -186,10 +191,10 @@ public function getQueue($queueName = '')
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Get queue metadata
- *
+ *
* @param string $queueName Queue name
* @return array Key/value pairs of meta data
* @throws Zend_Service_WindowsAzure_Exception
@@ -204,13 +209,13 @@ public function getQueueMetadata($queueName = '')
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
}
-
+
return $this->getQueue($queueName)->Metadata;
}
-
+
/**
* Set queue metadata
- *
+ *
* Calling the Set Queue Metadata operation overwrites all existing metadata that is associated with the queue. It's not possible to modify an individual name/value pair.
*
* @param string $queueName Queue name
@@ -230,11 +235,11 @@ public function setQueueMetadata($queueName = '', $metadata = array())
if (count($metadata) == 0) {
return;
}
-
+
// Create metadata headers
$headers = array();
- $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
-
+ $headers = array_merge($headers, $this->_generateMetadataHeaders($metadata));
+
// Perform request
$response = $this->_performRequest($queueName, '?comp=metadata', Zend_Http_Client::PUT, $headers);
@@ -243,7 +248,7 @@ public function setQueueMetadata($queueName = '', $metadata = array())
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Delete queue
*
@@ -260,7 +265,7 @@ public function deleteQueue($queueName = '')
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Queue name does not adhere to queue naming conventions. See http://msdn.microsoft.com/en-us/library/dd179349.aspx for more information.');
}
-
+
// Perform request
$response = $this->_performRequest($queueName, '', Zend_Http_Client::DELETE);
if (!$response->isSuccessful()) {
@@ -268,7 +273,7 @@ public function deleteQueue($queueName = '')
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* List queues
*
@@ -297,16 +302,16 @@ public function listQueues($prefix = null, $maxResults = null, $marker = null, $
$queryString[] = 'include=' . $include;
}
$queryString = self::createQueryStringFromArray($queryString);
-
+
// Perform request
- $response = $this->_performRequest('', $queryString, Zend_Http_Client::GET);
+ $response = $this->_performRequest('', $queryString, Zend_Http_Client::GET);
if ($response->isSuccessful()) {
$xmlQueues = $this->_parseResponse($response)->Queues->Queue;
$xmlMarker = (string)$this->_parseResponse($response)->NextMarker;
$queues = array();
if (!is_null($xmlQueues)) {
-
+
for ($i = 0; $i < count($xmlQueues); $i++) {
$queues[] = new Zend_Service_WindowsAzure_Storage_QueueInstance(
(string)$xmlQueues[$i]->Name,
@@ -323,14 +328,14 @@ public function listQueues($prefix = null, $maxResults = null, $marker = null, $
if (!is_null($maxResults) && count($queues) > $maxResults) {
$queues = array_slice($queues, 0, $maxResults);
}
-
+
return $queues;
} else {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Put message into queue
*
@@ -361,20 +366,20 @@ public function putMessage($queueName = '', $message = '', $ttl = null)
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Message TTL is invalid. Maximal TTL is 7 days (' . self::MAX_MESSAGE_SIZE . ' seconds) and should be greater than zero.');
}
-
+
// Build query string
$queryString = array();
if (!is_null($ttl)) {
$queryString[] = 'messagettl=' . $ttl;
}
$queryString = self::createQueryStringFromArray($queryString);
-
+
// Build body
$rawData = '';
$rawData .= '';
$rawData .= ' ' . base64_encode($message) . '';
$rawData .= '';
-
+
// Perform request
$response = $this->_performRequest($queueName . '/messages', $queryString, Zend_Http_Client::POST, array(), false, $rawData);
@@ -383,7 +388,7 @@ public function putMessage($queueName = '', $message = '', $ttl = null)
throw new Zend_Service_WindowsAzure_Exception('Error putting message into queue.');
}
}
-
+
/**
* Get queue messages
*
@@ -412,7 +417,7 @@ public function getMessages($queueName = '', $numOfMessages = 1, $visibilityTime
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Visibility timeout is invalid. Maximum value is 2 hours (7200 seconds) and should be greater than zero.');
}
-
+
// Build query string
$queryString = array();
if ($peek) {
@@ -423,11 +428,11 @@ public function getMessages($queueName = '', $numOfMessages = 1, $visibilityTime
}
if (!$peek && !is_null($visibilityTimeout)) {
$queryString[] = 'visibilitytimeout=' . $visibilityTimeout;
- }
+ }
$queryString = self::createQueryStringFromArray($queryString);
-
+
// Perform request
- $response = $this->_performRequest($queueName . '/messages', $queryString, Zend_Http_Client::GET);
+ $response = $this->_performRequest($queueName . '/messages', $queryString, Zend_Http_Client::GET);
if ($response->isSuccessful()) {
// Parse results
$result = $this->_parseResponse($response);
@@ -441,7 +446,7 @@ public function getMessages($queueName = '', $numOfMessages = 1, $visibilityTime
} else {
$xmlMessages = array($result->QueueMessage);
}
-
+
$messages = array();
for ($i = 0; $i < count($xmlMessages); $i++) {
$messages[] = new Zend_Service_WindowsAzure_Storage_QueueMessage(
@@ -454,14 +459,14 @@ public function getMessages($queueName = '', $numOfMessages = 1, $visibilityTime
base64_decode((string)$xmlMessages[$i]->MessageText)
);
}
-
+
return $messages;
} else {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Peek queue messages
*
@@ -474,7 +479,7 @@ public function peekMessages($queueName = '', $numOfMessages = 1)
{
return $this->getMessages($queueName, $numOfMessages, null, true);
}
-
+
/**
* Checks to see if a given queue has messages
*
@@ -486,7 +491,7 @@ public function hasMessages($queueName = '')
{
return count($this->peekMessages($queueName)) > 0;
}
-
+
/**
* Clear queue messages
*
@@ -505,13 +510,13 @@ public function clearMessages($queueName = '')
}
// Perform request
- $response = $this->_performRequest($queueName . '/messages', '', Zend_Http_Client::DELETE);
+ $response = $this->_performRequest($queueName . '/messages', '', Zend_Http_Client::DELETE);
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Error clearing messages from queue.');
}
}
-
+
/**
* Delete queue message
*
@@ -535,13 +540,13 @@ public function deleteMessage($queueName, Zend_Service_WindowsAzure_Storage_Queu
}
// Perform request
- $response = $this->_performRequest($queueName . '/messages/' . $message->MessageId, '?popreceipt=' . urlencode($message->PopReceipt), Zend_Http_Client::DELETE);
+ $response = $this->_performRequest($queueName . '/messages/' . $message->MessageId, '?popreceipt=' . urlencode($message->PopReceipt), Zend_Http_Client::DELETE);
if (!$response->isSuccessful()) {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Is valid queue name?
*
@@ -553,29 +558,29 @@ public static function isValidQueueName($queueName = '')
if (preg_match("/^[a-z0-9][a-z0-9-]*$/", $queueName) === 0) {
return false;
}
-
+
if (strpos($queueName, '--') !== false) {
return false;
}
-
+
if (strtolower($queueName) != $queueName) {
return false;
}
-
+
if (strlen($queueName) < 3 || strlen($queueName) > 63) {
return false;
}
-
+
if (substr($queueName, -1) == '-') {
return false;
}
-
+
return true;
}
-
+
/**
* Get error message from Zend_Http_Response
- *
+ *
* @param Zend_Http_Response $response Repsonse
* @param string $alternativeError Alternative error message
* @return string
diff --git a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Table.php b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Table.php
index e8c5fe319..54163653f 100644
--- a/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Table.php
+++ b/packages/zend-service-windowsazure/library/Zend/Service/WindowsAzure/Storage/Table.php
@@ -1,4 +1,7 @@
_throwExceptionOnMissingData = $value;
}
-
+
/**
* Throw Zend_Service_WindowsAzure_Exception when a property is not specified in Windows Azure?
*/
@@ -81,7 +84,7 @@ public function getThrowExceptionOnMissingData()
{
return $this->_throwExceptionOnMissingData;
}
-
+
/**
* Creates a new Zend_Service_WindowsAzure_Storage_Table instance
*
@@ -89,22 +92,24 @@ public function getThrowExceptionOnMissingData()
* @param string $accountName Account name for Windows Azure
* @param string $accountKey Account key for Windows Azure
* @param boolean $usePathStyleUri Use path-style URI's
- * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
+ * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract|null $retryPolicy Retry policy to use when making requests
*/
- public function __construct($host = Zend_Service_WindowsAzure_Storage::URL_DEV_TABLE, $accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT, $accountKey = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY, $usePathStyleUri = false, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
+ public function __construct($host = Zend_Service_WindowsAzure_Storage::URL_DEV_TABLE, $accountName = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_ACCOUNT, $accountKey = Zend_Service_WindowsAzure_Credentials_CredentialsAbstract::DEVSTORE_KEY, $usePathStyleUri = false, $retryPolicy = null)
{
+ Types::isNullable('retryPolicy', $retryPolicy, 'Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract');
+
parent::__construct($host, $accountName, $accountKey, $usePathStyleUri, $retryPolicy);
// Always use SharedKeyLite authentication
$this->_credentials = new Zend_Service_WindowsAzure_Credentials_SharedKeyLite($accountName, $accountKey, $this->_usePathStyleUri);
-
+
// API version
$this->_apiVersion = '2009-09-19';
}
-
+
/**
* Check if a table exists
- *
+ *
* @param string $tableName Table name
* @return boolean
*/
@@ -114,7 +119,7 @@ public function tableExists($tableName = '')
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Table name is not specified.');
}
-
+
// List tables
$tables = $this->listTables(); // 2009-09-19 does not support $this->listTables($tableName); all of a sudden...
foreach ($tables as $table) {
@@ -122,10 +127,10 @@ public function tableExists($tableName = '')
return true;
}
}
-
+
return false;
}
-
+
/**
* List tables
*
@@ -141,17 +146,17 @@ public function listTables($nextTableName = '')
$queryString[] = 'NextTableName=' . $nextTableName;
}
$queryString = self::createQueryStringFromArray($queryString);
-
+
// Perform request
$response = $this->_performRequest('Tables', $queryString, Zend_Http_Client::GET, null, true);
- if ($response->isSuccessful()) {
+ if ($response->isSuccessful()) {
// Parse result
- $result = $this->_parseResponse($response);
-
+ $result = $this->_parseResponse($response);
+
if (!$result || !$result->entry) {
return array();
}
-
+
$entries = null;
if (count($result->entry) > 1) {
$entries = $result->entry;
@@ -160,11 +165,11 @@ public function listTables($nextTableName = '')
}
// Create return value
- $returnValue = array();
+ $returnValue = array();
foreach ($entries as $entry) {
$tableName = $entry->xpath('.//m:properties/d:TableName');
$tableName = (string)$tableName[0];
-
+
$returnValue[] = new Zend_Service_WindowsAzure_Storage_TableInstance(
(string)$entry->id,
$tableName,
@@ -172,7 +177,7 @@ public function listTables($nextTableName = '')
(string)$entry->updated
);
}
-
+
// More tables?
if (!is_null($response->getHeader('x-ms-continuation-NextTableName'))) {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
@@ -184,7 +189,7 @@ public function listTables($nextTableName = '')
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Create table
*
@@ -197,7 +202,7 @@ public function createTable($tableName = '')
if ($tableName === '') {
throw new Zend_Service_WindowsAzure_Exception('Table name is not specified.');
}
-
+
// Generate request body
$requestBody = '
';
-
+
$requestBody = $this->_fillTemplate($requestBody, array(
'BaseUrl' => $this->getBaseUrl(),
'TableName' => htmlspecialchars($tableName),
'Updated' => $this->isoDate(),
'AccountName' => $this->_accountName
));
-
+
// Add header information
$headers = array();
$headers['Content-Type'] = 'application/atom+xml';
$headers['DataServiceVersion'] = '1.0;NetFx';
- $headers['MaxDataServiceVersion'] = '1.0;NetFx';
+ $headers['MaxDataServiceVersion'] = '1.0;NetFx';
// Perform request
$response = $this->_performRequest('Tables', '', Zend_Http_Client::POST, $headers, true, $requestBody);
if ($response->isSuccessful()) {
// Parse response
$entry = $this->_parseResponse($response);
-
+
$tableName = $entry->xpath('.//m:properties/d:TableName');
$tableName = (string)$tableName[0];
-
-
+
+
return new Zend_Service_WindowsAzure_Storage_TableInstance(
(string)$entry->id,
$tableName,
@@ -251,7 +256,7 @@ public function createTable($tableName = '')
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Create table if it does not exist
*
@@ -264,7 +269,7 @@ public function createTableIfNotExists($tableName = '')
$this->createTable($tableName);
}
}
-
+
/**
* Delete table
*
@@ -289,17 +294,19 @@ public function deleteTable($tableName = '')
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Insert entity into table
- *
+ *
* @param string $tableName Table name
- * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity Entity to insert
+ * @param Zend_Service_WindowsAzure_Storage_TableEntity|null $entity Entity to insert
* @return Zend_Service_WindowsAzure_Storage_TableEntity
* @throws Zend_Service_WindowsAzure_Exception
*/
- public function insertEntity($tableName = '', Zend_Service_WindowsAzure_Storage_TableEntity $entity = null)
+ public function insertEntity($tableName = '', $entity = null)
{
+ Types::isNullable('entity', $entity, 'Zend_Service_WindowsAzure_Storage_TableEntity');
+
if ($tableName === '') {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Table name is not specified.');
@@ -308,7 +315,7 @@ public function insertEntity($tableName = '', Zend_Service_WindowsAzure_Storage_
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Entity is not specified.');
}
-
+
// Generate request body
$requestBody = '
@@ -324,7 +331,7 @@ public function insertEntity($tableName = '', Zend_Service_WindowsAzure_Storage_
';
-
+
$requestBody = $this->_fillTemplate($requestBody, array(
'Updated' => $this->isoDate(),
'Properties' => $this->_generateAzureRepresentation($entity)
@@ -345,13 +352,13 @@ public function insertEntity($tableName = '', Zend_Service_WindowsAzure_Storage_
if ($response->isSuccessful()) {
// Parse result
$result = $this->_parseResponse($response);
-
+
$timestamp = $result->xpath('//m:properties/d:Timestamp');
$timestamp = $this->_convertToDateTime( (string)$timestamp[0] );
$etag = $result->attributes('http://schemas.microsoft.com/ado/2007/08/dataservices/metadata');
$etag = (string)$etag['etag'];
-
+
// Update properties
$entity->setTimestamp($timestamp);
$entity->setEtag($etag);
@@ -362,17 +369,19 @@ public function insertEntity($tableName = '', Zend_Service_WindowsAzure_Storage_
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Delete entity from table
- *
+ *
* @param string $tableName Table name
- * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity Entity to delete
+ * @param Zend_Service_WindowsAzure_Storage_TableEntity|null $entity Entity to delete
* @param boolean $verifyEtag Verify etag of the entity (used for concurrency)
* @throws Zend_Service_WindowsAzure_Exception
*/
- public function deleteEntity($tableName = '', Zend_Service_WindowsAzure_Storage_TableEntity $entity = null, $verifyEtag = false)
+ public function deleteEntity($tableName = '', $entity = null, $verifyEtag = false)
{
+ Types::isNullable('entity', $entity, 'Zend_Service_WindowsAzure_Storage_TableEntity');
+
if ($tableName === '') {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Table name is not specified.');
@@ -381,7 +390,7 @@ public function deleteEntity($tableName = '', Zend_Service_WindowsAzure_Storage_
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Entity is not specified.');
}
-
+
// Add header information
$headers = array();
if (!$this->isInBatch()) {
@@ -408,14 +417,14 @@ public function deleteEntity($tableName = '', Zend_Service_WindowsAzure_Storage_
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Retrieve entity from table, by id
- *
+ *
* @param string $tableName Table name
* @param string $partitionKey Partition key
* @param string $rowKey Row key
- * @param string $entityClass Entity class name*
+ * @param string $entityClass Entity class name*
* @return Zend_Service_WindowsAzure_Storage_TableEntity
* @throws Zend_Service_WindowsAzure_Exception
*/
@@ -438,7 +447,7 @@ public function retrieveEntityById($tableName, $partitionKey, $rowKey, $entityCl
throw new Zend_Service_WindowsAzure_Exception('Entity class is not specified.');
}
-
+
// Check for combined size of partition key and row key
// http://msdn.microsoft.com/en-us/library/dd179421.aspx
if (strlen($partitionKey . $rowKey) >= 256) {
@@ -447,10 +456,10 @@ public function retrieveEntityById($tableName, $partitionKey, $rowKey, $entityCl
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Entity cannot be retrieved. A transaction is required to retrieve the entity, but another transaction is already active.');
}
-
+
$this->startBatch();
}
-
+
// Fetch entities from Azure
$result = $this->retrieveEntities(
$this->select()
@@ -460,29 +469,29 @@ public function retrieveEntityById($tableName, $partitionKey, $rowKey, $entityCl
'',
$entityClass
);
-
+
// Return
if (count($result) == 1) {
return $result[0];
}
-
+
return null;
}
-
+
/**
* Create a new Zend_Service_WindowsAzure_Storage_TableEntityQuery
- *
+ *
* @return Zend_Service_WindowsAzure_Storage_TableEntityQuery
*/
public function select()
{
-
+
return new Zend_Service_WindowsAzure_Storage_TableEntityQuery();
}
-
+
/**
* Retrieve entities from table
- *
+ *
* @param string $tableName|Zend_Service_WindowsAzure_Storage_TableEntityQuery Table name -or- Zend_Service_WindowsAzure_Storage_TableEntityQuery instance
* @param string $filter Filter condition (not applied when $tableName is a Zend_Service_WindowsAzure_Storage_TableEntityQuery instance)
* @param string $entityClass Entity class name
@@ -507,27 +516,27 @@ public function retrieveEntities($tableName = '', $filter = '', $entityClass = '
$entityClass = $filter;
$filter = '';
}
-
+
// Query string
$queryString = '';
// Determine query
if (is_string($tableName)) {
// Option 1: $tableName is a string
-
+
// Append parentheses
if (strpos($tableName, '()') === false) {
$tableName .= '()';
}
-
+
// Build query
$query = array();
-
+
// Filter?
if ($filter !== '') {
$query[] = '$filter=' . Zend_Service_WindowsAzure_Storage_TableEntityQuery::encodeQuery($filter);
}
-
+
// Build queryString
if (count($query) > 0) {
$queryString = '?' . implode('&', $query);
@@ -544,7 +553,7 @@ public function retrieveEntities($tableName = '', $filter = '', $entityClass = '
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Invalid argument: $tableName');
}
-
+
// Add continuation querystring parameters?
if (!is_null($nextPartitionKey) && !is_null($nextRowKey)) {
if ($queryString !== '') {
@@ -552,7 +561,7 @@ public function retrieveEntities($tableName = '', $filter = '', $entityClass = '
} else {
$queryString .= '?';
}
-
+
$queryString .= 'NextPartitionKey=' . rawurlencode($nextPartitionKey) . '&NextRowKey=' . rawurlencode($nextRowKey);
}
@@ -561,7 +570,7 @@ public function retrieveEntities($tableName = '', $filter = '', $entityClass = '
if ($this->isInBatch() && $this->getCurrentBatch()->getOperationCount() == 0) {
$this->getCurrentBatch()->enlistOperation($tableName, $queryString, Zend_Http_Client::GET, array(), true, null);
$response = $this->getCurrentBatch()->commit();
-
+
// Get inner response (multipart)
$innerResponse = $response->getBody();
$innerResponse = substr($innerResponse, strpos($innerResponse, 'HTTP/1.1 200 OK'));
@@ -596,19 +605,19 @@ public function retrieveEntities($tableName = '', $filter = '', $entityClass = '
}
// Create return value
- $returnValue = array();
+ $returnValue = array();
foreach ($entries as $entry) {
// Parse properties
$properties = $entry->xpath('.//m:properties');
$properties = $properties[0]->children('http://schemas.microsoft.com/ado/2007/08/dataservices');
-
+
// Create entity
$entity = new $entityClass('', '');
$entity->setAzureValues((array)$properties, $this->_throwExceptionOnMissingData);
-
+
// If we have a Zend_Service_WindowsAzure_Storage_DynamicTableEntity, make sure all property types are set
if ($entity instanceof Zend_Service_WindowsAzure_Storage_DynamicTableEntity) {
- foreach ($properties as $key => $value) {
+ foreach ($properties as $key => $value) {
$attributes = $value->attributes('http://schemas.microsoft.com/ado/2007/08/dataservices/metadata');
$type = (string)$attributes['type'];
if ($type !== '') {
@@ -616,12 +625,12 @@ public function retrieveEntities($tableName = '', $filter = '', $entityClass = '
}
}
}
-
+
// Update etag
$etag = $entry->attributes('http://schemas.microsoft.com/ado/2007/08/dataservices/metadata');
$etag = (string)$etag['etag'];
$entity->setEtag($etag);
-
+
// Add to result
$returnValue[] = $entity;
}
@@ -632,7 +641,7 @@ public function retrieveEntities($tableName = '', $filter = '', $entityClass = '
$returnValue = array_merge($returnValue, $this->retrieveEntities($tableName, $filter, $entityClass, $response->getHeader('x-ms-continuation-NextPartitionKey'), $response->getHeader('x-ms-continuation-NextRowKey')));
}
}
-
+
// Return
return $returnValue;
} else {
@@ -640,37 +649,41 @@ public function retrieveEntities($tableName = '', $filter = '', $entityClass = '
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Update entity by replacing it
- *
+ *
* @param string $tableName Table name
- * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity Entity to update
+ * @param Zend_Service_WindowsAzure_Storage_TableEntity|null $entity Entity to update
* @param boolean $verifyEtag Verify etag of the entity (used for concurrency)
* @throws Zend_Service_WindowsAzure_Exception
*/
- public function updateEntity($tableName = '', Zend_Service_WindowsAzure_Storage_TableEntity $entity = null, $verifyEtag = false)
+ public function updateEntity($tableName = '', $entity = null, $verifyEtag = false)
{
+ Types::isNullable('entity', $entity, 'Zend_Service_WindowsAzure_Storage_TableEntity');
+
return $this->_changeEntity(Zend_Http_Client::PUT, $tableName, $entity, $verifyEtag);
}
-
+
/**
* Update entity by adding or updating properties
- *
+ *
* @param string $tableName Table name
- * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity Entity to update
+ * @param Zend_Service_WindowsAzure_Storage_TableEntity|null $entity Entity to update
* @param boolean $verifyEtag Verify etag of the entity (used for concurrency)
* @param array $properties Properties to merge. All properties will be used when omitted.
* @throws Zend_Service_WindowsAzure_Exception
*/
- public function mergeEntity($tableName = '', Zend_Service_WindowsAzure_Storage_TableEntity $entity = null, $verifyEtag = false, $properties = array())
+ public function mergeEntity($tableName = '', $entity = null, $verifyEtag = false, $properties = array())
{
+ Types::isNullable('entity', $entity, 'Zend_Service_WindowsAzure_Storage_TableEntity');
+
$mergeEntity = null;
if (is_array($properties) && count($properties) > 0) {
-
+
// Build a new object
$mergeEntity = new Zend_Service_WindowsAzure_Storage_DynamicTableEntity($entity->getPartitionKey(), $entity->getRowKey());
-
+
// Keep only values mentioned in $properties
$azureValues = $entity->getAzureValues();
foreach ($azureValues as $key => $value) {
@@ -681,16 +694,16 @@ public function mergeEntity($tableName = '', Zend_Service_WindowsAzure_Storage_T
} else {
$mergeEntity = $entity;
}
-
- // Ensure entity timestamp matches updated timestamp
+
+ // Ensure entity timestamp matches updated timestamp
$entity->setTimestamp(new DateTime());
-
+
return $this->_changeEntity(Zend_Http_Client::MERGE, $tableName, $mergeEntity, $verifyEtag);
}
-
+
/**
* Get error message from Zend_Http_Response
- *
+ *
* @param Zend_Http_Response $response Repsonse
* @param string $alternativeError Alternative error message
* @return string
@@ -704,27 +717,29 @@ protected function _getErrorMessage(Zend_Http_Response $response, $alternativeEr
return $alternativeError;
}
}
-
+
/**
* Update entity / merge entity
- *
+ *
* @param string $httpVerb HTTP verb to use (PUT = update, MERGE = merge)
* @param string $tableName Table name
- * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity Entity to update
+ * @param Zend_Service_WindowsAzure_Storage_TableEntity|null $entity Entity to update
* @param boolean $verifyEtag Verify etag of the entity (used for concurrency)
* @throws Zend_Service_WindowsAzure_Exception
*/
- protected function _changeEntity($httpVerb = Zend_Http_Client::PUT, $tableName = '', Zend_Service_WindowsAzure_Storage_TableEntity $entity = null, $verifyEtag = false)
+ protected function _changeEntity($httpVerb = Zend_Http_Client::PUT, $tableName = '', $entity = null, $verifyEtag = false)
{
+ Types::isNullable('entity', $entity, 'Zend_Service_WindowsAzure_Storage_TableEntity');
+
if ($tableName === '') {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Table name is not specified.');
}
- if (is_null($entity)) {
+ if (is_null($entity)) {
// require_once 'Zend/Service/WindowsAzure/Exception.php';
throw new Zend_Service_WindowsAzure_Exception('Entity is not specified.');
}
-
+
// Add header information
$headers = array();
$headers['Content-Type'] = 'application/atom+xml';
@@ -750,10 +765,10 @@ protected function _changeEntity($httpVerb = Zend_Http_Client::PUT, $tableName =
';
-
+
// Attempt to get timestamp from entity
$timestamp = $entity->getTimestamp();
-
+
$requestBody = $this->_fillTemplate($requestBody, array(
'Updated' => $this->_convertToEdmDateTime($timestamp),
'Properties' => $this->_generateAzureRepresentation($entity)
@@ -767,7 +782,7 @@ protected function _changeEntity($httpVerb = Zend_Http_Client::PUT, $tableName =
} else {
$headers['If-Match'] = $entity->getEtag();
}
-
+
// Perform request
$response = null;
if ($this->isInBatch()) {
@@ -787,20 +802,20 @@ protected function _changeEntity($httpVerb = Zend_Http_Client::PUT, $tableName =
throw new Zend_Service_WindowsAzure_Exception($this->_getErrorMessage($response, 'Resource could not be accessed.'));
}
}
-
+
/**
* Generate RFC 1123 compliant date string
- *
+ *
* @return string
*/
protected function _rfcDate()
{
return gmdate('D, d M Y H:i:s', time()) . ' GMT'; // RFC 1123
}
-
+
/**
* Fill text template with variables from key/value array
- *
+ *
* @param string $templateText Template text
* @param array $variables Array containing key/value pairs
* @return string
@@ -812,15 +827,17 @@ protected function _fillTemplate($templateText, $variables = array())
}
return $templateText;
}
-
+
/**
* Generate Azure representation from entity (creates atompub markup from properties)
- *
- * @param Zend_Service_WindowsAzure_Storage_TableEntity $entity
+ *
+ * @param Zend_Service_WindowsAzure_Storage_TableEntity|null $entity
* @return string
*/
- protected function _generateAzureRepresentation(Zend_Service_WindowsAzure_Storage_TableEntity $entity = null)
+ protected function _generateAzureRepresentation($entity = null)
{
+ Types::isNullable('entity', $entity, 'Zend_Service_WindowsAzure_Storage_TableEntity');
+
// Generate Azure representation from entity
$azureRepresentation = array();
$azureValues = $entity->getAzureValues();
@@ -831,10 +848,10 @@ protected function _generateAzureRepresentation(Zend_Service_WindowsAzure_Storag
$value[] = ' m:type="' . $azureValue->Type . '"';
}
if (is_null($azureValue->Value)) {
- $value[] = ' m:null="true"';
+ $value[] = ' m:null="true"';
}
$value[] = '>';
-
+
if (!is_null($azureValue->Value)) {
if (strtolower($azureValue->Type) == 'edm.boolean') {
$value[] = ($azureValue->Value == true ? '1' : '0');
@@ -844,14 +861,14 @@ protected function _generateAzureRepresentation(Zend_Service_WindowsAzure_Storag
$value[] = htmlspecialchars($azureValue->Value);
}
}
-
+
$value[] = 'Name . '>';
$azureRepresentation[] = implode('', $value);
}
return implode('', $azureRepresentation);
}
-
+
/**
* Perform request using Zend_Http_Client channel
*
@@ -890,20 +907,20 @@ protected function _performRequest(
$resourceType,
$requiredPermission
);
- }
-
+ }
+
/**
* Converts a string to a DateTime object. Returns false on failure.
- *
+ *
* @param string $value The string value to parse
* @return DateTime|boolean
*/
- protected function _convertToDateTime($value = '')
+ protected function _convertToDateTime($value = '')
{
if ($value instanceof DateTime) {
return $value;
}
-
+
try {
if (substr($value, -1) == 'Z') {
$value = substr($value, 0, strlen($value) - 1);
@@ -914,15 +931,15 @@ protected function _convertToDateTime($value = '')
return false;
}
}
-
+
/**
* Converts a DateTime object into an Edm.DaeTime value in UTC timezone,
* represented as a string.
- *
+ *
* @param DateTime $value
* @return string
*/
- protected function _convertToEdmDateTime(DateTime $value)
+ protected function _convertToEdmDateTime(DateTime $value)
{
$cloned = clone $value;
$cloned->setTimezone(new DateTimeZone('UTC'));
diff --git a/packages/zend-soap/library/Zend/Soap/Server.php b/packages/zend-soap/library/Zend/Soap/Server.php
index 84c8114bc..175552307 100644
--- a/packages/zend-soap/library/Zend/Soap/Server.php
+++ b/packages/zend-soap/library/Zend/Soap/Server.php
@@ -1,4 +1,7 @@
_wsiCompliant) {
$options['wsi_compliant'] = $this->_wsiCompliant;
}
-
+
return $options;
}
/**
* Set WS-I compliant
- *
+ *
* @param boolean $value
- * @return Zend_Soap_Server
+ * @return Zend_Soap_Server
*/
public function setWsiCompliant($value)
{
@@ -297,10 +302,10 @@ public function setWsiCompliant($value)
}
/**
* Gt WS-I compliant
- *
+ *
* @return boolean
*/
- public function getWsiCompliant()
+ public function getWsiCompliant()
{
return $this->_wsiCompliant;
}
@@ -640,7 +645,7 @@ public function setObject($object)
$this->_object = new Zend_Soap_Server_Proxy($object);
} else {
$this->_object = $object;
- }
+ }
return $this;
}
@@ -823,7 +828,7 @@ protected function _getSoap()
if ($this->_wsiCompliant) {
// require_once 'Zend/Soap/Server/Proxy.php';
array_unshift($args, 'Zend_Soap_Server_Proxy');
- }
+ }
call_user_func_array(array($server, 'setClass'), $args);
}
@@ -876,7 +881,7 @@ public function handle($request = null)
} catch (Zend_Soap_Server_Exception $e) {
$setRequestException = $e;
}
-
+
$soap = $this->_getSoap();
$fault = false;
@@ -1011,12 +1016,14 @@ public function fault($fault = null, $code = "Receiver")
* @param string $errstr
* @param string $errfile
* @param int $errline
- * @param array $errcontext
+ * @param array|null $errcontext
* @return void
* @throws SoapFault
*/
- public function handlePhpErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null)
+ public function handlePhpErrors($errno, $errstr, $errfile = null, $errline = null, $errcontext = null)
{
+ Types::isNullable('errcontext', $errcontext, 'array');
+
throw $this->fault($errstr, "Receiver");
}
}
diff --git a/packages/zend-tag/library/Zend/Tag/Cloud/Decorator/HtmlTag.php b/packages/zend-tag/library/Zend/Tag/Cloud/Decorator/HtmlTag.php
index e2fc46377..58139318d 100644
--- a/packages/zend-tag/library/Zend/Tag/Cloud/Decorator/HtmlTag.php
+++ b/packages/zend-tag/library/Zend/Tag/Cloud/Decorator/HtmlTag.php
@@ -1,4 +1,7 @@
_assertType) {
case self::ASSERT_CONTENT_CONTAINS:
diff --git a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/DomQuery41.php b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/DomQuery41.php
index 50b82845a..c4c949bfc 100644
--- a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/DomQuery41.php
+++ b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/DomQuery41.php
@@ -1,4 +1,7 @@
_assertType) {
case self::ASSERT_CONTENT_CONTAINS:
diff --git a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/Redirect37.php b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/Redirect37.php
index deb5dbd60..5b896eae2 100644
--- a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/Redirect37.php
+++ b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/Redirect37.php
@@ -1,4 +1,7 @@
_assertType) {
case self::ASSERT_REDIRECT_TO:
diff --git a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/Redirect41.php b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/Redirect41.php
index 4e4efe3e7..0e913ab0f 100644
--- a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/Redirect41.php
+++ b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/Redirect41.php
@@ -1,4 +1,7 @@
_assertType) {
case self::ASSERT_REDIRECT_TO:
diff --git a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/ResponseHeader37.php b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/ResponseHeader37.php
index 886ebb390..c10ebef11 100644
--- a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/ResponseHeader37.php
+++ b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/ResponseHeader37.php
@@ -1,4 +1,7 @@
_assertType) {
case self::ASSERT_RESPONSE_CODE:
diff --git a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/ResponseHeader41.php b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/ResponseHeader41.php
index 52f016c7d..f239a64d0 100644
--- a/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/ResponseHeader41.php
+++ b/packages/zend-test/library/Zend/Test/PHPUnit/Constraint/ResponseHeader41.php
@@ -1,4 +1,7 @@
_assertType) {
case self::ASSERT_RESPONSE_CODE:
diff --git a/packages/zend-text/library/Zend/Text/Table/Row.php b/packages/zend-text/library/Zend/Text/Table/Row.php
index 75ccc4a43..13fc19998 100644
--- a/packages/zend-text/library/Zend/Text/Table/Row.php
+++ b/packages/zend-text/library/Zend/Text/Table/Row.php
@@ -1,4 +1,7 @@
$resourceData) {
diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Module.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Module.php
index 5eae905d3..b97fbcf65 100644
--- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Module.php
+++ b/packages/zend-tool/library/Zend/Tool/Project/Provider/Module.php
@@ -1,4 +1,7 @@
_loadedProfile);
-
+
$resources = self::createResources($this->_loadedProfile, $name);
$response = $this->_registry->getResponse();
diff --git a/packages/zend-validate/library/Zend/Validate/EmailAddress.php b/packages/zend-validate/library/Zend/Validate/EmailAddress.php
index 8b2fed065..872b5b6c2 100644
--- a/packages/zend-validate/library/Zend/Validate/EmailAddress.php
+++ b/packages/zend-validate/library/Zend/Validate/EmailAddress.php
@@ -1,4 +1,7 @@
view = $view;
return $this;
}
diff --git a/packages/zend-view/library/Zend/View/Helper/FormCheckbox.php b/packages/zend-view/library/Zend/View/Helper/FormCheckbox.php
index 7887cffab..e6f0f52b3 100644
--- a/packages/zend-view/library/Zend/View/Helper/FormCheckbox.php
+++ b/packages/zend-view/library/Zend/View/Helper/FormCheckbox.php
@@ -1,4 +1,7 @@
_getInfo($name, $value, $attribs);
extract($info); // name, id, value, attribs, options, listsep, disable
@@ -113,8 +118,10 @@ public function formCheckbox($name, $value = null, $attribs = null, array $check
* @param array|null $checkedOptions
* @return array
*/
- public static function determineCheckboxInfo($value, $checked, array $checkedOptions = null)
+ public static function determineCheckboxInfo($value, $checked, $checkedOptions = null)
{
+ Types::isNullable('$checkedOptions', $checkedOptions, 'array');
+
// Checked/unchecked values
$checkedValue = null;
$uncheckedValue = null;
diff --git a/packages/zend-view/library/Zend/View/Helper/FormErrors.php b/packages/zend-view/library/Zend/View/Helper/FormErrors.php
index 9e594aa99..73c418c9d 100644
--- a/packages/zend-view/library/Zend/View/Helper/FormErrors.php
+++ b/packages/zend-view/library/Zend/View/Helper/FormErrors.php
@@ -1,4 +1,7 @@
_getInfo($name, $value, $attribs);
extract($info); // name, value, attribs, options, listsep, disable
if (isset($id)) {
diff --git a/packages/zend-view/library/Zend/View/Helper/FormLabel.php b/packages/zend-view/library/Zend/View/Helper/FormLabel.php
index 7f45d78f5..70b7480c6 100644
--- a/packages/zend-view/library/Zend/View/Helper/FormLabel.php
+++ b/packages/zend-view/library/Zend/View/Helper/FormLabel.php
@@ -1,4 +1,7 @@
_getInfo($name, $value, $attribs);
extract($info); // name, value, attribs, options, listsep, disable, escape
diff --git a/packages/zend-view/library/Zend/View/Helper/HeadLink.php b/packages/zend-view/library/Zend/View/Helper/HeadLink.php
index 615117ed9..f9cc9a0c7 100644
--- a/packages/zend-view/library/Zend/View/Helper/HeadLink.php
+++ b/packages/zend-view/library/Zend/View/Helper/HeadLink.php
@@ -1,4 +1,7 @@
createData($attributes);
switch ($placement) {
diff --git a/packages/zend-view/library/Zend/View/Helper/Navigation.php b/packages/zend-view/library/Zend/View/Helper/Navigation.php
index de514b394..0345b10d5 100644
--- a/packages/zend-view/library/Zend/View/Helper/Navigation.php
+++ b/packages/zend-view/library/Zend/View/Helper/Navigation.php
@@ -1,4 +1,7 @@
setContainer($container);
}
@@ -164,11 +169,11 @@ public function findHelper($proxy, $strict = true)
// Add navigation helper path at the beginning
$paths = $this->view->getHelperPaths();
$this->view->setHelperPath(null);
-
+
$this->view->addHelperPath(
str_replace('_', '/', self::NS),
self::NS);
-
+
foreach ($paths as $ns => $path) {
$this->view->addHelperPath($path, $ns);
}
@@ -332,7 +337,7 @@ public function getInjectTranslator()
/**
* Renders helper
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* render. Default is to
* render the container
* registered in the helper.
@@ -342,8 +347,10 @@ public function getInjectTranslator()
* the interface specified in
* {@link findHelper()}
*/
- public function render(Zend_Navigation_Container $container = null)
+ public function render($container = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
$helper = $this->findHelper($this->getDefaultProxy());
return $helper->render($container);
}
diff --git a/packages/zend-view/library/Zend/View/Helper/Navigation/Breadcrumbs.php b/packages/zend-view/library/Zend/View/Helper/Navigation/Breadcrumbs.php
index b347d1c2d..d71d7a3d3 100644
--- a/packages/zend-view/library/Zend/View/Helper/Navigation/Breadcrumbs.php
+++ b/packages/zend-view/library/Zend/View/Helper/Navigation/Breadcrumbs.php
@@ -1,4 +1,7 @@
setContainer($container);
}
@@ -174,14 +179,16 @@ public function getPartial()
* Renders breadcrumbs by chaining 'a' elements with the separator
* registered in the helper
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* render. Default is to
* render the container
* registered in the helper.
* @return string helper output
*/
- public function renderStraight(Zend_Navigation_Container $container = null)
+ public function renderStraight($container = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
if (null === $container) {
$container = $this->getContainer();
}
@@ -230,7 +237,7 @@ public function renderStraight(Zend_Navigation_Container $container = null)
* The container will simply be passed on as a model to the view script,
* so in the script it will be available in $this->container.
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* pass to view script.
* Default is to use the
* container registered in the
@@ -247,9 +254,11 @@ public function renderStraight(Zend_Navigation_Container $container = null)
* be found.
* @return string helper output
*/
- public function renderPartial(Zend_Navigation_Container $container = null,
+ public function renderPartial($container = null,
$partial = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
if (null === $container) {
$container = $this->getContainer();
}
@@ -314,14 +323,16 @@ public function renderPartial(Zend_Navigation_Container $container = null,
*
* Implements {@link Zend_View_Helper_Navigation_Helper::render()}.
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* render. Default is to
* render the container
* registered in the helper.
* @return string helper output
*/
- public function render(Zend_Navigation_Container $container = null)
+ public function render($container = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
if ($partial = $this->getPartial()) {
return $this->renderPartial($container, $partial);
} else {
diff --git a/packages/zend-view/library/Zend/View/Helper/Navigation/Helper.php b/packages/zend-view/library/Zend/View/Helper/Navigation/Helper.php
index e7d587816..6b5b5941b 100644
--- a/packages/zend-view/library/Zend/View/Helper/Navigation/Helper.php
+++ b/packages/zend-view/library/Zend/View/Helper/Navigation/Helper.php
@@ -34,7 +34,7 @@ interface Zend_View_Helper_Navigation_Helper
/**
* Sets navigation container the helper should operate on by default
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* operate on. Default is
* null, which indicates that
* the container should be
@@ -42,7 +42,7 @@ interface Zend_View_Helper_Navigation_Helper
* @return Zend_View_Helper_Navigation_Helper fluent interface, returns
* self
*/
- public function setContainer(Zend_Navigation_Container $container = null);
+ public function setContainer($container = null);
/**
* Returns the navigation container the helper operates on by default
@@ -74,11 +74,11 @@ public function getTranslator();
/**
* Sets ACL to use when iterating pages
*
- * @param Zend_Acl $acl [optional] ACL instance
+ * @param Zend_Acl|null $acl [optional] ACL instance
* @return Zend_View_Helper_Navigation_Helper fluent interface, returns
* self
*/
- public function setAcl(Zend_Acl $acl = null);
+ public function setAcl($acl = null);
/**
* Returns ACL or null if it isn't set using {@link setAcl()} or
@@ -199,7 +199,7 @@ public function __toString();
/**
* Renders helper
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* render. Default is null,
* which indicates that the
* helper should render the
@@ -208,5 +208,5 @@ public function __toString();
* @return string helper output
* @throws Zend_View_Exception if unable to render
*/
- public function render(Zend_Navigation_Container $container = null);
+ public function render($container = null);
}
diff --git a/packages/zend-view/library/Zend/View/Helper/Navigation/HelperAbstract.php b/packages/zend-view/library/Zend/View/Helper/Navigation/HelperAbstract.php
index f9ff316d5..706ff42e6 100644
--- a/packages/zend-view/library/Zend/View/Helper/Navigation/HelperAbstract.php
+++ b/packages/zend-view/library/Zend/View/Helper/Navigation/HelperAbstract.php
@@ -1,4 +1,7 @@
_container = $container;
return $this;
}
@@ -438,13 +443,15 @@ public function getTranslator()
*
* Implements {@link Zend_View_Helper_Navigation_Helper::setAcl()}.
*
- * @param Zend_Acl $acl [optional] ACL object.
+ * @param Zend_Acl|null $acl [optional] ACL object.
* Default is null.
* @return Zend_View_Helper_Navigation_HelperAbstract fluent interface,
* returns self
*/
- public function setAcl(Zend_Acl $acl = null)
+ public function setAcl($acl = null)
{
+ Types::isNullable('acl', $acl, 'Zend_Acl');
+
$this->_acl = $acl;
return $this;
}
@@ -922,7 +929,7 @@ protected function _htmlAttribs($attribs)
* @return string Normalized ID
*/
protected function _normalizeId($value)
- {
+ {
if (false === $this->_skipPrefixForId) {
$prefix = $this->getPrefixForId();
@@ -939,12 +946,14 @@ protected function _normalizeId($value)
/**
* Sets default ACL to use if another ACL is not explicitly set
*
- * @param Zend_Acl $acl [optional] ACL object. Default is null, which
+ * @param Zend_Acl|null $acl [optional] ACL object. Default is null, which
* sets no ACL object.
* @return void
*/
- public static function setDefaultAcl(Zend_Acl $acl = null)
+ public static function setDefaultAcl($acl = null)
{
+ Types::isNullable('acl', $acl, 'Zend_Acl');
+
self::$_defaultAcl = $acl;
}
diff --git a/packages/zend-view/library/Zend/View/Helper/Navigation/Links.php b/packages/zend-view/library/Zend/View/Helper/Navigation/Links.php
index cd608dd4a..ea18b6dd3 100644
--- a/packages/zend-view/library/Zend/View/Helper/Navigation/Links.php
+++ b/packages/zend-view/library/Zend/View/Helper/Navigation/Links.php
@@ -1,4 +1,7 @@
setContainer($container);
}
@@ -741,14 +746,16 @@ public function renderLink(Zend_Navigation_Page $page, $attrib, $relation)
*
* Implements {@link Zend_View_Helper_Navigation_Helper::render()}.
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* render. Default is to
* render the container
* registered in the helper.
* @return string helper output
*/
- public function render(Zend_Navigation_Container $container = null)
+ public function render($container = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
if (null === $container) {
$container = $this->getContainer();
}
diff --git a/packages/zend-view/library/Zend/View/Helper/Navigation/Menu.php b/packages/zend-view/library/Zend/View/Helper/Navigation/Menu.php
index 15e26e94b..a65de6c16 100644
--- a/packages/zend-view/library/Zend/View/Helper/Navigation/Menu.php
+++ b/packages/zend-view/library/Zend/View/Helper/Navigation/Menu.php
@@ -1,4 +1,7 @@
setContainer($container);
}
@@ -285,10 +290,10 @@ public function getOnlyActiveBranch()
{
return $this->_onlyActiveBranch;
}
-
+
/**
* Sets a flag indicating whether to expand all sibling nodes of the active branch
- *
+ *
* @param bool $flag [optional] expand all siblings of
* nodes in the active branch. Default is true.
* @return Zend_View_Helper_Navigation_Menu fluent interface, returns self
@@ -311,7 +316,7 @@ public function getExpandSiblingNodesOfActiveBranch()
{
return $this->_expandSiblingNodesOfActiveBranch;
}
-
+
/**
* Enables/disables rendering of parents when only rendering active branch
*
@@ -890,7 +895,7 @@ protected function _renderMenu(Zend_Navigation_Container $container,
* Available $options:
*
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* create menu from. Default
* is to use the container
* retrieved from
@@ -899,9 +904,11 @@ protected function _renderMenu(Zend_Navigation_Container $container,
* controlling rendering
* @return string rendered menu
*/
- public function renderMenu(Zend_Navigation_Container $container = null,
+ public function renderMenu($container = null,
array $options = array())
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
if (null === $container) {
$container = $this->getContainer();
}
@@ -958,7 +965,7 @@ public function renderMenu(Zend_Navigation_Container $container = null,
* ));
*
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* render. Default is to render
* the container registered in
* the helper.
@@ -982,13 +989,15 @@ public function renderMenu(Zend_Navigation_Container $container = null,
* {@link getInnerIndent()}.
* @return string rendered content
*/
- public function renderSubMenu(Zend_Navigation_Container $container = null,
+ public function renderSubMenu($container = null,
$ulClass = null,
$indent = null,
$ulId = null,
$addPageClassToLi = false,
$innerIndent = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
return $this->renderMenu($container, array(
'indent' => $indent,
'innerIndent' => $innerIndent,
@@ -1009,7 +1018,7 @@ public function renderSubMenu(Zend_Navigation_Container $container = null,
* as-is, and will be available in the partial script as 'container', e.g.
* echo 'Number of pages: ', count($this->container);.
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* pass to view script. Default
* is to use the container
* registered in the helper.
@@ -1026,9 +1035,11 @@ public function renderSubMenu(Zend_Navigation_Container $container = null,
*
* @throws Zend_View_Exception When no partial script is set
*/
- public function renderPartial(Zend_Navigation_Container $container = null,
+ public function renderPartial($container = null,
$partial = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
if (null === $container) {
$container = $this->getContainer();
}
@@ -1082,14 +1093,16 @@ public function renderPartial(Zend_Navigation_Container $container = null,
* @see renderPartial()
* @see renderMenu()
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* render. Default is to
* render the container
* registered in the helper.
* @return string helper output
*/
- public function render(Zend_Navigation_Container $container = null)
+ public function render($container = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
if ($partial = $this->getPartial()) {
return $this->renderPartial($container, $partial);
} else {
diff --git a/packages/zend-view/library/Zend/View/Helper/Navigation/Sitemap.php b/packages/zend-view/library/Zend/View/Helper/Navigation/Sitemap.php
index 287054014..cd8daca77 100644
--- a/packages/zend-view/library/Zend/View/Helper/Navigation/Sitemap.php
+++ b/packages/zend-view/library/Zend/View/Helper/Navigation/Sitemap.php
@@ -1,4 +1,7 @@
setContainer($container);
}
@@ -275,7 +280,7 @@ public function url(Zend_Navigation_Page $page)
/**
* Returns a DOMDocument containing the Sitemap XML for the given container
*
- * @param Zend_Navigation_Container $container [optional] container to get
+ * @param Zend_Navigation_Container|null $container [optional] container to get
* breadcrumbs from, defaults
* to what is registered in the
* helper
@@ -288,8 +293,10 @@ public function url(Zend_Navigation_Page $page)
* validators are used and the
* loc element fails validation
*/
- public function getDomSitemap(Zend_Navigation_Container $container = null)
+ public function getDomSitemap($container = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
if (null === $container) {
$container = $this->getContainer();
}
@@ -423,15 +430,17 @@ public function getDomSitemap(Zend_Navigation_Container $container = null)
*
* Implements {@link Zend_View_Helper_Navigation_Helper::render()}.
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* render. Default is to
* render the container
* registered in the helper.
* @throws Zend_View_Exception
* @return string helper output
*/
- public function render(Zend_Navigation_Container $container = null)
+ public function render($container = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
$dom = $this->getDomSitemap($container);
$xml = $this->getUseXmlDeclaration() ?
diff --git a/packages/zend-view/library/Zend/View/Helper/PaginationControl.php b/packages/zend-view/library/Zend/View/Helper/PaginationControl.php
index 0f865fd28..898582b57 100644
--- a/packages/zend-view/library/Zend/View/Helper/PaginationControl.php
+++ b/packages/zend-view/library/Zend/View/Helper/PaginationControl.php
@@ -1,4 +1,7 @@
view->paginator) and $this->view->paginator !== null and $this->view->paginator instanceof Zend_Paginator) {
$paginator = $this->view->paginator;
diff --git a/packages/zend-view/library/Zend/View/Helper/UserAgent.php b/packages/zend-view/library/Zend/View/Helper/UserAgent.php
index 470f0f403..17dc53e9e 100644
--- a/packages/zend-view/library/Zend/View/Helper/UserAgent.php
+++ b/packages/zend-view/library/Zend/View/Helper/UserAgent.php
@@ -1,4 +1,7 @@
setUserAgent($userAgent);
}
diff --git a/packages/zend-xml/library/Zend/Xml/Security.php b/packages/zend-xml/library/Zend/Xml/Security.php
index 1a052cf1b..ca9bef4f2 100644
--- a/packages/zend-xml/library/Zend/Xml/Security.php
+++ b/packages/zend-xml/library/Zend/Xml/Security.php
@@ -1,4 +1,7 @@
_httpClient = new Zend_Http_Client();
} else {
diff --git a/tests/Zend/Acl/_files/AssertionZF7973.php b/tests/Zend/Acl/_files/AssertionZF7973.php
index 8a58d6f39..bb0a25371 100644
--- a/tests/Zend/Acl/_files/AssertionZF7973.php
+++ b/tests/Zend/Acl/_files/AssertionZF7973.php
@@ -1,12 +1,18 @@
_roleDFSVisitAllPrivileges($role, $resource, $dfs);
}
- public function roleDFSOnePrivilege(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null,
+ public function roleDFSOnePrivilege(Zend_Acl_Role_Interface $role, $resource = null,
$privilege = null)
{
+ Types::isNullable('resource', $resource, 'Zend_Acl_Resource_Interface');
+
return $this->_roleDFSOnePrivilege($role, $resource, $privilege);
}
- public function roleDFSVisitOnePrivilege(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null,
+ public function roleDFSVisitOnePrivilege(Zend_Acl_Role_Interface $role, $resource = null,
$privilege = null, &$dfs = null)
{
+ Types::isNullable('resource', $resource, 'Zend_Acl_Resource_Interface');
+
return $this->_roleDFSVisitOnePrivilege($role, $resource, $privilege, $dfs);
}
}
\ No newline at end of file
diff --git a/tests/Zend/Acl/_files/MockAssertion.php b/tests/Zend/Acl/_files/MockAssertion.php
index dc496cb4b..423790a7a 100644
--- a/tests/Zend/Acl/_files/MockAssertion.php
+++ b/tests/Zend/Acl/_files/MockAssertion.php
@@ -1,5 +1,7 @@
_returnValue = (bool) $returnValue;
}
- public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null,
+ public function assert(Zend_Acl $acl, $role = null, $resource = null,
$privilege = null)
{
+ Types::isNullable('role', $role, 'Zend_Acl_Role_Interface');
+ Types::isNullable('resource', $resource, 'Zend_Acl_Resource_Interface');
+
return $this->_returnValue;
}
}
\ No newline at end of file
diff --git a/tests/Zend/Acl/_files/UseCase1/UserIsBlogPostOwnerAssertion.php b/tests/Zend/Acl/_files/UseCase1/UserIsBlogPostOwnerAssertion.php
index e8acd7d99..0841e1b09 100644
--- a/tests/Zend/Acl/_files/UseCase1/UserIsBlogPostOwnerAssertion.php
+++ b/tests/Zend/Acl/_files/UseCase1/UserIsBlogPostOwnerAssertion.php
@@ -1,5 +1,7 @@
lastAssertRole = $user;
$this->lastAssertResource = $blogPost;
$this->lastAssertPrivilege = $privilege;
diff --git a/tests/Zend/Db/Table/_files/My/ZendDbTable/Row/TestMockRow.php b/tests/Zend/Db/Table/_files/My/ZendDbTable/Row/TestMockRow.php
index 27a5c4ef1..9ee031c75 100644
--- a/tests/Zend/Db/Table/_files/My/ZendDbTable/Row/TestMockRow.php
+++ b/tests/Zend/Db/Table/_files/My/ZendDbTable/Row/TestMockRow.php
@@ -1,4 +1,7 @@
dependentTable = $dependentTable;
$this->ruleKey = $ruleKey;
}
- public function findParentRow($parentTable, $ruleKey = null, Zend_Db_Table_Select $select = null)
+ public function findParentRow($parentTable, $ruleKey = null, $select = null)
{
+ Types::isNullable('select', $select, 'Zend_Db_Table_Select');
+
$this->parentTable = $parentTable;
$this->ruleKey = $ruleKey;
}
public function findManyToManyRowset($matchTable, $intersectionTable, $callerRefRule = null,
- $matchRefRule = null, Zend_Db_Table_Select $select = null)
+ $matchRefRule = null, $select = null)
{
+ Types::isNullable('select', $select, 'Zend_Db_Table_Select');
+
$this->matchTable = $matchTable;
$this->intersectionTable = $intersectionTable;
$this->callerRefRuleKey = $callerRefRule;
diff --git a/tests/Zend/EventManager/TestAsset/ClassWithEvents.php b/tests/Zend/EventManager/TestAsset/ClassWithEvents.php
index 3e84fe431..472ce4007 100644
--- a/tests/Zend/EventManager/TestAsset/ClassWithEvents.php
+++ b/tests/Zend/EventManager/TestAsset/ClassWithEvents.php
@@ -1,4 +1,7 @@
events = $events;
}
diff --git a/tests/Zend/Oauth/Oauth/ConsumerTest.php b/tests/Zend/Oauth/Oauth/ConsumerTest.php
index 255f633d5..a26a33744 100644
--- a/tests/Zend/Oauth/Oauth/ConsumerTest.php
+++ b/tests/Zend/Oauth/Oauth/ConsumerTest.php
@@ -1,4 +1,7 @@
getMock('Zend_Oauth_Client', array(), array(), '', false);
$client->expects($this->any())->method('resetParameters')
->will($this->returnValue($client));
diff --git a/tests/Zend/View/Helper/Navigation/_files/helpers/Menu.php b/tests/Zend/View/Helper/Navigation/_files/helpers/Menu.php
index 2f1fdabba..c71def67c 100644
--- a/tests/Zend/View/Helper/Navigation/_files/helpers/Menu.php
+++ b/tests/Zend/View/Helper/Navigation/_files/helpers/Menu.php
@@ -1,5 +1,7 @@
setContainer($container);
}
@@ -26,14 +30,16 @@ public function menu(Zend_Navigation_Container $container = null)
*
* Implements {@link Zend_View_Helper_Navigation_Helper::render()}.
*
- * @param Zend_Navigation_Container $container [optional] container to
+ * @param Zend_Navigation_Container|null $container [optional] container to
* render. Default is to
* render the container
* registered in the helper.
* @return string helper output
*/
- public function render(Zend_Navigation_Container $container = null)
+ public function render($container = null)
{
+ Types::isNullable('container', $container, 'Zend_Navigation_Container');
+
return '';
}
}
\ No newline at end of file