From 56d9dd485825ca958fdf0d79c22c435f4549d2ac Mon Sep 17 00:00:00 2001 From: ines_paul Date: Mon, 18 Mar 2019 13:29:03 +0100 Subject: [PATCH 001/121] PHPUnit 8 and Backward Incompatible Changes --- library/Zend/Test/PHPUnit/ControllerTestCase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Zend/Test/PHPUnit/ControllerTestCase.php b/library/Zend/Test/PHPUnit/ControllerTestCase.php index 69976f0d93..e0afbc35b0 100644 --- a/library/Zend/Test/PHPUnit/ControllerTestCase.php +++ b/library/Zend/Test/PHPUnit/ControllerTestCase.php @@ -37,14 +37,14 @@ /** * Functional testing scaffold for MVC applications * - * @uses PHPUnit_Framework_TestCase + * @uses PHPUnit\Framework\TestCase * @category Zend * @package Zend_Test * @subpackage PHPUnit * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class Zend_Test_PHPUnit_ControllerTestCase extends PHPUnit_Framework_TestCase +abstract class Zend_Test_PHPUnit_ControllerTestCase extends PHPUnit\Framework\TestCase { /** * @var mixed Bootstrap file path or callback @@ -120,7 +120,7 @@ public function __get($name) * * Calls {@link bootstrap()} by default */ - protected function setUp() + protected function setUp(): void { $this->bootstrap(); } From 84c2dfdf49e8a0e0534b894a4caedd888e628076 Mon Sep 17 00:00:00 2001 From: ines_paul Date: Wed, 27 Mar 2019 16:34:26 +0100 Subject: [PATCH 002/121] Avoid error-logs full of PHP Warnings due to autoloads from class-exists()-checks. --- library/Zend/Loader.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/Zend/Loader.php b/library/Zend/Loader.php index 40da3bfaa2..d5a28753b4 100644 --- a/library/Zend/Loader.php +++ b/library/Zend/Loader.php @@ -130,10 +130,14 @@ public static function loadFile($filename, $dirs = null, $once = false) /** * Try finding for the plain filename in the include_path. */ + // "@": + // - Avoid error-logs full of PHP Warnings due to autoloads from class-exists()-checks. + // - If a class does not exist that we really need, error will be thrown anyway. + // - Fatal errors from the included files are still thrown anyway. if ($once) { - include_once $filename; + @include_once $filename; } else { - include $filename; + @include $filename; } /** From 6a6ead36b3b57ee4def1648a03e57b8b222dcc4f Mon Sep 17 00:00:00 2001 From: Thomas Lauria Date: Tue, 16 Apr 2019 15:20:19 +0200 Subject: [PATCH 003/121] fix php 7 session issues --- library/Zend/Session.php | 1 + library/Zend/Session/SaveHandler/DbTable.php | 17 +++++------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index d1118db29b..eabc25f4dd 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -278,6 +278,7 @@ public static function setSaveHandler(Zend_Session_SaveHandler_Interface $saveHa array(&$saveHandler, 'destroy'), array(&$saveHandler, 'gc') ); + register_shutdown_function('session_write_close'); if (!$result) { throw new Zend_Session_Exception('Unable to set session handler'); diff --git a/library/Zend/Session/SaveHandler/DbTable.php b/library/Zend/Session/SaveHandler/DbTable.php index e423a18d4c..facc224886 100644 --- a/library/Zend/Session/SaveHandler/DbTable.php +++ b/library/Zend/Session/SaveHandler/DbTable.php @@ -337,8 +337,6 @@ public function read($id) */ public function write($id, $data) { - $return = false; - $data = array($this->_modifiedColumn => time(), $this->_dataColumn => (string) $data); @@ -348,17 +346,17 @@ public function write($id, $data) $data[$this->_lifetimeColumn] = $this->_getLifetime($rows->current()); if ($this->update($data, $this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE))) { - $return = true; + return true; } } else { $data[$this->_lifetimeColumn] = $this->_lifetime; if ($this->insert(array_merge($this->_getPrimary($id, self::PRIMARY_TYPE_ASSOC), $data))) { - $return = true; + return true; } } - return $return; + return false; } /** @@ -369,13 +367,8 @@ public function write($id, $data) */ public function destroy($id) { - $return = false; - - if ($this->delete($this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE))) { - $return = true; - } - - return $return; + $this->delete($this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE)); + return true; //always return true, since if nothing can be deleted, it is already deleted and thats OK. } /** From 540e1c1a935a7343a10189b00720ddd7e07eabd7 Mon Sep 17 00:00:00 2001 From: Thomas Lauria Date: Tue, 16 Apr 2019 17:37:33 +0200 Subject: [PATCH 004/121] fix for error with session_set_cookie_params() --- library/Zend/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index eabc25f4dd..5c9f48a4fc 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -368,7 +368,7 @@ public static function rememberUntil($seconds = 0) return; } - if (!self::sessionExists()) { // session_set_cookie_params(): Cannot change session cookie parameters when session is active + if (!self::$_sessionStarted) { // session_set_cookie_params(): Cannot change session cookie parameters when session is active $cookieParams = session_get_cookie_params(); session_set_cookie_params( $seconds, From e84c47128937729030258025cf7335075c3e7a92 Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 17 May 2019 16:46:59 +0100 Subject: [PATCH 005/121] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1b04849b84..e8b2ca9e06 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potentially future versions If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. + +Installable through git clone or through composer `install zf1-future` https://packagist.org/packages/shardj/zf1-future From 2ad936d718824f0bcc4c8a46f486fbb759ff7d82 Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 17 May 2019 16:47:20 +0100 Subject: [PATCH 006/121] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e8b2ca9e06..e3f8654c08 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potent If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. -Installable through git clone or through composer `install zf1-future` https://packagist.org/packages/shardj/zf1-future +Installable through git clone or through `composer install zf1-future` https://packagist.org/packages/shardj/zf1-future From 4c7092339c249d83994212535d3a1427b736be64 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 15 Jul 2019 14:49:34 +0100 Subject: [PATCH 007/121] issue#8 - fixes php7.3 warning continue in switch statement --- library/Zend/Pdf/FileParser/Font/OpenType.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/library/Zend/Pdf/FileParser/Font/OpenType.php b/library/Zend/Pdf/FileParser/Font/OpenType.php index 05a1d96ba4..76e833cac8 100644 --- a/library/Zend/Pdf/FileParser/Font/OpenType.php +++ b/library/Zend/Pdf/FileParser/Font/OpenType.php @@ -890,7 +890,6 @@ protected function _parseCmapTable() $cmapOffset = $baseOffset + $offset; $this->moveToOffset($cmapOffset); $format = $this->readUInt(2); - $language = -1; switch ($format) { case 0x0: $cmapLength = $this->readUInt(2); @@ -898,7 +897,7 @@ protected function _parseCmapTable() if ($language != 0) { $this->_debugLog('Type 0 cmap tables must be language-independent;' . ' language: %d; skipping', $language); - continue; + continue 2; } break; @@ -917,7 +916,7 @@ protected function _parseCmapTable() case 0xa: // break intentionally omitted case 0xc: $this->_debugLog('Format: 0x%x currently unsupported; skipping', $format); - continue; + continue 2; //$this->skipBytes(2); //$cmapLength = $this->readUInt(4); //$language = $this->readUInt(4); @@ -929,7 +928,7 @@ protected function _parseCmapTable() default: $this->_debugLog('Unknown subtable format: 0x%x; skipping', $format); - continue; + continue 2; } $cmapType = $format; break; From 7b15f33d9fe20e13d59501f14a121a6e514837b6 Mon Sep 17 00:00:00 2001 From: Shardj Date: Thu, 1 Aug 2019 10:17:47 +0100 Subject: [PATCH 008/121] fixes countable error --- library/Zend/Validate/File/Count.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Validate/File/Count.php b/library/Zend/Validate/File/Count.php index aa822dfb14..6243927de7 100644 --- a/library/Zend/Validate/File/Count.php +++ b/library/Zend/Validate/File/Count.php @@ -254,7 +254,7 @@ public function isValid($value, $file = null) $this->addFile($value); } - $this->_count = count($this->_files); + $this->_count = count($this->_files ?? []); if (($this->_max !== null) && ($this->_count > $this->_max)) { return $this->_throw($file, self::TOO_MANY); } From 58a9fb04f16a15178256a8798e609793086da1a4 Mon Sep 17 00:00:00 2001 From: Andreas Malecki Date: Mon, 5 Aug 2019 15:21:53 +0200 Subject: [PATCH 009/121] Allow unit testing with PHP 7.2 --- library/Zend/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index da4f8830a3..ce5836a84a 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -199,7 +199,7 @@ protected function __construct() public static function setOptions(array $userOptions = array()) { // set default options on first run only (before applying user settings) - if (!self::$_defaultOptionsSet) { + if (!self::$_defaultOptionsSet && !self::$_unitTestEnabled) { foreach (self::$_defaultOptions as $defaultOptionName => $defaultOptionValue) { if (isset(self::$_defaultOptions[$defaultOptionName])) { ini_set("session.$defaultOptionName", $defaultOptionValue); From 5c0857b7ba4a1348979ace46109f4f4693dc5e8a Mon Sep 17 00:00:00 2001 From: Dave Jennings Date: Tue, 6 Aug 2019 13:02:59 +0100 Subject: [PATCH 010/121] Count all keys with strictly non-null values Cater for values like empty strings and zeros when checking scalar types. --- library/Zend/Db/Table/Abstract.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Db/Table/Abstract.php b/library/Zend/Db/Table/Abstract.php index 2f2f60a3c8..cbd27db2fc 100644 --- a/library/Zend/Db/Table/Abstract.php +++ b/library/Zend/Db/Table/Abstract.php @@ -1307,7 +1307,7 @@ public function find() if (is_array($keyValues) || $keyValues instanceof Countable) { $keyValuesCount = count($keyValues); } else { - $keyValuesCount = $keyValues == null ? 0 : 1; + $keyValuesCount = $keyValues === null ? 0 : 1; } // Coerce the values to an array. // Don't simply typecast to array, because the values From b74aef304933837798ae8a69cb035504937e96ea Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 11 Sep 2019 15:56:52 +0100 Subject: [PATCH 011/121] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e3f8654c08..6d71e8fea3 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,5 @@ Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potent If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. Installable through git clone or through `composer install zf1-future` https://packagist.org/packages/shardj/zf1-future + +Recently https://github.com/Shardj/zf1-extras-future has been created for those who need it. From 2bceb8c792832a02b8d78bb837008fffe3d65a69 Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 11 Sep 2019 16:00:07 +0100 Subject: [PATCH 012/121] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d71e8fea3..7ac66ec942 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,6 @@ Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potent If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. -Installable through git clone or through `composer install zf1-future` https://packagist.org/packages/shardj/zf1-future +Installable through git clone or through `composer require shardj/zf1-future` https://packagist.org/packages/shardj/zf1-future Recently https://github.com/Shardj/zf1-extras-future has been created for those who need it. From e9f3dd85a7b89aa287a6cbff52301ce182d5689c Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Sat, 21 Sep 2019 10:21:21 +0100 Subject: [PATCH 013/121] Update Date::setOptions() -> fix phpdoc @return Options is invalid (no such class etc). Method either returns an array or void. --- library/Zend/Date.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Date.php b/library/Zend/Date.php index 48bc906f9b..756107b225 100644 --- a/library/Zend/Date.php +++ b/library/Zend/Date.php @@ -233,7 +233,7 @@ public function __construct($date = null, $part = null, $locale = null) * * @param array $options Options to set * @throws Zend_Date_Exception - * @return Options array if no option was given + * @return array|void if no option was given */ public static function setOptions(array $options = array()) { From 66cbd6f5cded45e9feceda53f9fe63625baeee60 Mon Sep 17 00:00:00 2001 From: Dalm Date: Mon, 23 Sep 2019 09:13:07 +0200 Subject: [PATCH 014/121] Fix count() Warnings during bin/zf create issue #15 --- library/Zend/Tool/Project/Profile/Resource/Container.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Tool/Project/Profile/Resource/Container.php b/library/Zend/Tool/Project/Profile/Resource/Container.php index 4f06f6f55d..ffbee3ebc0 100644 --- a/library/Zend/Tool/Project/Profile/Resource/Container.php +++ b/library/Zend/Tool/Project/Profile/Resource/Container.php @@ -383,7 +383,7 @@ public function valid() */ public function hasChildren() { - return (count($this->_subResources > 0)) ? true : false; + return (count($this->_subResources) > 0) ? true : false; } /** From 75dc2887b17f21ac806da6c8f0a3d8fd9b995366 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 23 Sep 2019 12:27:59 +0100 Subject: [PATCH 015/121] Fixes typo causing yaml.php to break --- library/Zend/Config/Yaml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Config/Yaml.php b/library/Zend/Config/Yaml.php index 9811fda862..565036712a 100755 --- a/library/Zend/Config/Yaml.php +++ b/library/Zend/Config/Yaml.php @@ -289,7 +289,7 @@ protected static function _decodeYaml($currentIndent, &$lines) { $config = array(); $inIndent = false; - foreach ($line as $n => $line) { + foreach ($lines as $n => $line) { $lineno = $n + 1; $line = rtrim(preg_replace("/#.*$/", "", $line)); From b74c432fbbddfbf61bb6f84b49840126180be0df Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 4 Oct 2019 16:50:11 +0100 Subject: [PATCH 016/121] Fixes yaml.php --- library/Zend/Config/Yaml.php | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/library/Zend/Config/Yaml.php b/library/Zend/Config/Yaml.php index 565036712a..3d0dbe3395 100755 --- a/library/Zend/Config/Yaml.php +++ b/library/Zend/Config/Yaml.php @@ -274,7 +274,6 @@ protected function _processExtends(array $data, $section, array $config = array( public static function decode($yaml) { $lines = explode("\n", $yaml); - reset($lines); return self::_decodeYaml(0, $lines); } @@ -285,29 +284,29 @@ public static function decode($yaml) * @param array $lines YAML lines * @return array|string */ - protected static function _decodeYaml($currentIndent, &$lines) + protected static function _decodeYaml($currentIndent, &$lines, &$pointer = -1) { - $config = array(); + $config = array(); $inIndent = false; - foreach ($lines as $n => $line) { - $lineno = $n + 1; + while (++$pointer < count($lines)) { + $lineno = $pointer + 1; - $line = rtrim(preg_replace("/#.*$/", "", $line)); - if (strlen($line) == 0) { + $lines[$pointer] = rtrim(preg_replace("/#.*$/", "", $lines[$pointer])); + if (strlen($lines[$pointer]) == 0) { continue; } - $indent = strspn($line, " "); + $indent = strspn($lines[$pointer], " "); // line without the spaces - $line = trim($line); - if (strlen($line) == 0) { + $lines[$pointer] = trim($lines[$pointer]); + if (strlen($lines[$pointer]) == 0) { continue; } if ($indent < $currentIndent) { // this level is done - prev($lines); + $pointer--; return $config; } @@ -316,7 +315,7 @@ protected static function _decodeYaml($currentIndent, &$lines) $inIndent = true; } - if (preg_match("/(?!-)([\w\-]+):\s*(.*)/", $line, $m)) { + if (preg_match("/(?!-)([\w\-]+):\s*(.*)/", $lines[$pointer], $m)) { // key: value if (strlen($m[2])) { // simple key: value @@ -324,27 +323,27 @@ protected static function _decodeYaml($currentIndent, &$lines) $value = self::_parseValue($value); } else { // key: and then values on new lines - $value = self::_decodeYaml($currentIndent + 1, $lines); + $value = self::_decodeYaml($currentIndent + 1, $lines, $pointer); if (is_array($value) && !count($value)) { $value = ""; } } $config[$m[1]] = $value; - } elseif ($line[0] == "-") { + } elseif ($lines[$pointer][0] == "-") { // item in the list: // - FOO - if (strlen($line) > 2) { - $value = substr($line, 2); + if (strlen($lines[$pointer]) > 2) { + $value = substr($lines[$pointer], 2); $config[] = self::_parseValue($value); } else { - $config[] = self::_decodeYaml($currentIndent + 1, $lines); + $config[] = self::_decodeYaml($currentIndent + 1, $lines, $pointer); } } else { require_once 'Zend/Config/Exception.php'; throw new Zend_Config_Exception(sprintf( 'Error parsing YAML at line %d - unsupported syntax: "%s"', - $lineno, $line + $lineno, $lines[$pointer] )); } } From 25ab01b013a9d4960310c74a0c1df46ce574f5a3 Mon Sep 17 00:00:00 2001 From: Mark Gregan Date: Sat, 5 Oct 2019 00:19:42 +0200 Subject: [PATCH 017/121] Zend_Config_Yaml now handles multiple subkeys --- library/Zend/Config/Yaml.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/Zend/Config/Yaml.php b/library/Zend/Config/Yaml.php index 3d0dbe3395..be69d1c5f2 100755 --- a/library/Zend/Config/Yaml.php +++ b/library/Zend/Config/Yaml.php @@ -282,9 +282,10 @@ public static function decode($yaml) * * @param int $currentIndent Current indent level * @param array $lines YAML lines + * @param int $pointer The current line being parsed * @return array|string */ - protected static function _decodeYaml($currentIndent, &$lines, &$pointer = -1) + protected static function _decodeYaml($currentIndent, $lines, &$pointer = -1) { $config = array(); $inIndent = false; From ce4d3e611553291192adf29a0f70ba78e82750ee Mon Sep 17 00:00:00 2001 From: Dringho Date: Mon, 21 Oct 2019 09:11:43 -0300 Subject: [PATCH 018/121] Mute warning Zend_Session_SaveHandler_DbTable Mute warning when using Zend_Session_SaveHandler_DbTable. --- library/Zend/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index ce5836a84a..ef46417268 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -733,7 +733,7 @@ public static function writeClose($readonly = true) parent::$_writable = false; } - session_write_close(); + @session_write_close(); self::$_writeClosed = true; } From 17416b28d6e997afaf0ce8fb4e3a2a29ca329329 Mon Sep 17 00:00:00 2001 From: Dringho Date: Mon, 21 Oct 2019 13:26:12 -0300 Subject: [PATCH 019/121] Revert Revert --- library/Zend/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Session.php b/library/Zend/Session.php index ef46417268..ce5836a84a 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -733,7 +733,7 @@ public static function writeClose($readonly = true) parent::$_writable = false; } - @session_write_close(); + session_write_close(); self::$_writeClosed = true; } From 9175301058d324bcdcdca0d091b2e6c394273a95 Mon Sep 17 00:00:00 2001 From: Dringho Date: Mon, 21 Oct 2019 13:31:35 -0300 Subject: [PATCH 020/121] Fix when the date is the same as stored update returns 0 if the data being updated matches the one in the database, which produces a `false` return, which in turn triggers a warning in Zend_Session::writeClose - session_write_close() --- library/Zend/Session/SaveHandler/DbTable.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/library/Zend/Session/SaveHandler/DbTable.php b/library/Zend/Session/SaveHandler/DbTable.php index e423a18d4c..69c2cf2326 100644 --- a/library/Zend/Session/SaveHandler/DbTable.php +++ b/library/Zend/Session/SaveHandler/DbTable.php @@ -346,10 +346,8 @@ public function write($id, $data) if (count($rows)) { $data[$this->_lifetimeColumn] = $this->_getLifetime($rows->current()); - - if ($this->update($data, $this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE))) { - $return = true; - } + $this->update($data, $this->_getPrimary($id, self::PRIMARY_TYPE_WHERECLAUSE)); + $return = true; } else { $data[$this->_lifetimeColumn] = $this->_lifetime; From 29c2e4bccbf8f532431e5e0c30cd2384586a390d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20W=C3=B3jcicki?= Date: Thu, 7 Nov 2019 10:21:16 +0100 Subject: [PATCH 021/121] Fixed return value for isValid() method in Zend_Validate_File_FilesSize and Zend_Validate_File_ImageSize. --- library/Zend/Validate/File/FilesSize.php | 2 +- library/Zend/Validate/File/ImageSize.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Zend/Validate/File/FilesSize.php b/library/Zend/Validate/File/FilesSize.php index 0c80079b78..6fdb57cae7 100644 --- a/library/Zend/Validate/File/FilesSize.php +++ b/library/Zend/Validate/File/FilesSize.php @@ -155,6 +155,6 @@ public function isValid($value, $file = null) } } - return !empty($this->_messages); + return empty($this->_messages); } } diff --git a/library/Zend/Validate/File/ImageSize.php b/library/Zend/Validate/File/ImageSize.php index b9e68dff5d..1f1796109f 100644 --- a/library/Zend/Validate/File/ImageSize.php +++ b/library/Zend/Validate/File/ImageSize.php @@ -338,7 +338,7 @@ public function isValid($value, $file = null) $this->_throw($file, self::HEIGHT_TOO_BIG); } - return !empty($this->_messages); + return empty($this->_messages); } /** From 6a5534f319c9030f0d58271516d04068f44ab8f1 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 11 Nov 2019 09:12:15 +0000 Subject: [PATCH 022/121] Fixes relative url check failing for uppercase url schemas --- library/Zend/Controller/Action/Helper/Redirector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Controller/Action/Helper/Redirector.php b/library/Zend/Controller/Action/Helper/Redirector.php index 8c81646224..5bd727c634 100644 --- a/library/Zend/Controller/Action/Helper/Redirector.php +++ b/library/Zend/Controller/Action/Helper/Redirector.php @@ -363,7 +363,7 @@ public function setGotoUrl($url, array $options = array()) } // If relative URL, decide if we should prepend base URL - if (!preg_match('|^[a-z]+://|', $url)) { + if (!preg_match('|^[a-z]+://|i', $url)) { $url = $this->_prependBase($url); } From a518b235a24a9ed64607632dbf8a246c9c52b06e Mon Sep 17 00:00:00 2001 From: HellFirePvP <7419378+HellFirePvP@users.noreply.github.com> Date: Wed, 13 Nov 2019 18:02:16 +0100 Subject: [PATCH 023/121] Update Atom.php Break from switch-case to retry redirected URI regarding deletion. --- library/Zend/Feed/Entry/Atom.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Feed/Entry/Atom.php b/library/Zend/Feed/Entry/Atom.php index 83fd8f1d06..3c3a0a8469 100644 --- a/library/Zend/Feed/Entry/Atom.php +++ b/library/Zend/Feed/Entry/Atom.php @@ -103,7 +103,7 @@ public function delete() // Redirect case 3: $deleteUri = $response->getHeader('Location'); - continue; + break; // Error default: /** From abb38276407046478ee24f7aeb5bc62fd781da16 Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 15 Nov 2019 10:11:37 +0000 Subject: [PATCH 024/121] Delete PULL_REQUEST_TEMPLATE --- PULL_REQUEST_TEMPLATE | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 PULL_REQUEST_TEMPLATE diff --git a/PULL_REQUEST_TEMPLATE b/PULL_REQUEST_TEMPLATE deleted file mode 100644 index f0289361e5..0000000000 --- a/PULL_REQUEST_TEMPLATE +++ /dev/null @@ -1,4 +0,0 @@ -Zend Framework 1 reaches its End of Life (EOL) and is no longer maintained. -No Pull Requests will be accepted. - -https://framework.zend.com/blog/2016-06-28-zf1-eol.html From d2220779d7ea7e90cc96c7985d2366a758cbee1d Mon Sep 17 00:00:00 2001 From: "francesco.loreti" Date: Wed, 27 Nov 2019 14:03:42 +0100 Subject: [PATCH 025/121] Replace d.adsrc that it's removed into postgresql 12 #28 --- library/Zend/Db/Adapter/Pdo/Pgsql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Db/Adapter/Pdo/Pgsql.php b/library/Zend/Db/Adapter/Pdo/Pgsql.php index abd5e637b0..efb74cd145 100644 --- a/library/Zend/Db/Adapter/Pdo/Pgsql.php +++ b/library/Zend/Db/Adapter/Pdo/Pgsql.php @@ -156,7 +156,7 @@ public function describeTable($tableName, $schemaName = null) t.typname AS type, a.atttypmod, FORMAT_TYPE(a.atttypid, a.atttypmod) AS complete_type, - d.adsrc AS default_value, + pg_get_expr(d.adbin, d.adrelid) AS default_value, a.attnotnull AS notnull, a.attlen AS length, co.contype, From 9f49d09a10434ffec3bb217f5c8a5f1647d13647 Mon Sep 17 00:00:00 2001 From: Bloafer Date: Mon, 2 Dec 2019 11:23:52 +0000 Subject: [PATCH 026/121] Bump version to 1.15.2 --- library/Zend/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Version.php b/library/Zend/Version.php index ea3df6f7f0..099a1176b9 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.12.21dev'; + const VERSION = '1.15.2'; /** * The latest stable version Zend Framework available From c488fa1f9df9e6ce190199fdce4163be8337e17a Mon Sep 17 00:00:00 2001 From: Stephan Eicher Date: Tue, 3 Dec 2019 19:37:32 +0100 Subject: [PATCH 027/121] Fix php 7.4 deprecation curly brakets access on strings --- library/Zend/Barcode/Object/Upce.php | 8 ++++---- library/Zend/Filter/Compress/Zip.php | 2 +- library/Zend/Json/Decoder.php | 2 +- library/Zend/Json/Encoder.php | 14 +++++++------- .../Project/Context/Zf/ApplicationConfigFile.php | 2 +- library/Zend/View/Helper/Navigation/Sitemap.php | 4 ++-- library/Zend/Wildfire/Plugin/FirePhp.php | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/library/Zend/Barcode/Object/Upce.php b/library/Zend/Barcode/Object/Upce.php index cbb5b9bd3e..8302b698f1 100644 --- a/library/Zend/Barcode/Object/Upce.php +++ b/library/Zend/Barcode/Object/Upce.php @@ -84,8 +84,8 @@ protected function _getDefaultOptions() public function getText() { $text = parent::getText(); - if ($text{0} != 1) { - $text{0} = 0; + if ($text[0] != 1) { + $text[0] = 0; } return $text; } @@ -222,8 +222,8 @@ protected function _validateText($value, $options = array()) public function getChecksum($text) { $text = $this->_addLeadingZeros($text, true); - if ($text{0} != 1) { - $text{0} = 0; + if ($text[0] != 1) { + $text[0] = 0; } return parent::getChecksum($text); } diff --git a/library/Zend/Filter/Compress/Zip.php b/library/Zend/Filter/Compress/Zip.php index 9921fe9648..9c71a88444 100644 --- a/library/Zend/Filter/Compress/Zip.php +++ b/library/Zend/Filter/Compress/Zip.php @@ -237,7 +237,7 @@ public function decompress($content) for ($i = 0; $i < $zip->numFiles; $i++) { $statIndex = $zip->statIndex($i); $currName = $statIndex['name']; - if (($currName{0} == '/') || + if (($currName[0] == '/') || (substr($currName, 0, 2) == '..') || (substr($currName, 0, 4) == './..') ) diff --git a/library/Zend/Json/Decoder.php b/library/Zend/Json/Decoder.php index 8a79f0cdd2..cc83115199 100644 --- a/library/Zend/Json/Decoder.php +++ b/library/Zend/Json/Decoder.php @@ -552,7 +552,7 @@ protected static function _utf162utf8($utf16) return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); } - $bytes = (ord($utf16{0}) << 8) | ord($utf16{1}); + $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]); switch (true) { case ((0x7F & $bytes) == $bytes): diff --git a/library/Zend/Json/Encoder.php b/library/Zend/Json/Encoder.php index fbf5b53cca..9013b285c3 100644 --- a/library/Zend/Json/Encoder.php +++ b/library/Zend/Json/Encoder.php @@ -558,17 +558,17 @@ protected static function _utf82utf16($utf8) case 2: // return a UTF-16 character from a 2-byte UTF-8 char // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr(0x07 & (ord($utf8{0}) >> 2)) - . chr((0xC0 & (ord($utf8{0}) << 6)) - | (0x3F & ord($utf8{1}))); + return chr(0x07 & (ord($utf8[0]) >> 2)) + . chr((0xC0 & (ord($utf8[0]) << 6)) + | (0x3F & ord($utf8[1]))); case 3: // return a UTF-16 character from a 3-byte UTF-8 char // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - return chr((0xF0 & (ord($utf8{0}) << 4)) - | (0x0F & (ord($utf8{1}) >> 2))) - . chr((0xC0 & (ord($utf8{1}) << 6)) - | (0x7F & ord($utf8{2}))); + return chr((0xF0 & (ord($utf8[0]) << 4)) + | (0x0F & (ord($utf8[1]) >> 2))) + . chr((0xC0 & (ord($utf8[1]) << 6)) + | (0x7F & ord($utf8[2]))); } // ignoring UTF-32 for now, sorry diff --git a/library/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php b/library/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php index da74e4dbec..0f4c5a5c2f 100644 --- a/library/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php +++ b/library/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php @@ -139,7 +139,7 @@ public function addStringItem($key, $value, $section = 'production', $quoteValue $newLines[] = $contentLine; if ($insideSection) { // if its blank, or a section heading - if (isset($contentLines[$contentLineIndex + 1]{0}) && $contentLines[$contentLineIndex + 1]{0} == '[') { + if (isset($contentLines[$contentLineIndex + 1][0]) && $contentLines[$contentLineIndex + 1][0] == '[') { $newLines[] = $key . ' = ' . $value; $insideSection = null; } else if (!isset($contentLines[$contentLineIndex + 1])){ diff --git a/library/Zend/View/Helper/Navigation/Sitemap.php b/library/Zend/View/Helper/Navigation/Sitemap.php index b93808a2c6..4df6dc38d1 100644 --- a/library/Zend/View/Helper/Navigation/Sitemap.php +++ b/library/Zend/View/Helper/Navigation/Sitemap.php @@ -253,10 +253,10 @@ public function url(Zend_Navigation_Page $page) { $href = $page->getHref(); - if (!isset($href{0})) { + if (!isset($href[0])) { // no href return ''; - } elseif ($href{0} == '/') { + } elseif ($href[0] == '/') { // href is relative to root; use serverUrl helper $url = $this->getServerUrl() . $href; } elseif (preg_match('/^[a-z]+:/im', (string) $href)) { diff --git a/library/Zend/Wildfire/Plugin/FirePhp.php b/library/Zend/Wildfire/Plugin/FirePhp.php index b0e3d5e87a..727d7daaaf 100644 --- a/library/Zend/Wildfire/Plugin/FirePhp.php +++ b/library/Zend/Wildfire/Plugin/FirePhp.php @@ -742,7 +742,7 @@ protected function _encodeObject($object, $objectDepth = 1, $arrayDepth = 1) $name = $raw_name = $just_name; - if ($name{0} == "\0") { + if ($name[0] == "\0") { $parts = explode("\0", $name); $name = $parts[2]; } From f5fd9dd4bca5de6c283ba2c4359a3574ba226a92 Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 4 Dec 2019 12:11:47 +0000 Subject: [PATCH 028/121] Restores php 5 compatibility to count.php --- library/Zend/Validate/File/Count.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Validate/File/Count.php b/library/Zend/Validate/File/Count.php index 6243927de7..95876f337b 100644 --- a/library/Zend/Validate/File/Count.php +++ b/library/Zend/Validate/File/Count.php @@ -254,7 +254,7 @@ public function isValid($value, $file = null) $this->addFile($value); } - $this->_count = count($this->_files ?? []); + $this->_count = count($this->_files === null ? [] : $this->_files); if (($this->_max !== null) && ($this->_count > $this->_max)) { return $this->_throw($file, self::TOO_MANY); } From fe715327ed6ed1ce0d6ec120317524225c9e02bd Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 4 Dec 2019 12:15:25 +0000 Subject: [PATCH 029/121] Bumping version for new release of first php 7.4 compatibility patches --- library/Zend/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Version.php b/library/Zend/Version.php index 099a1176b9..116e93ef9a 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.15.2'; + const VERSION = '1.16.0'; /** * The latest stable version Zend Framework available From da7cc642955f913836df5c6c24b619522c5ffc9a Mon Sep 17 00:00:00 2001 From: Shardj Date: Wed, 4 Dec 2019 12:19:51 +0000 Subject: [PATCH 030/121] Changes descriptions to be less specific about the currently supported php versions as we move to support php 7.4 --- README.md | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ac66ec942..f2dedb62cf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Post end of life changes for zf1 to allow compatibility with PHP 7.3, and potentially future versions +Post end of life changes for zf1 to allow compatibility with the latest PHP versions. If you have any requests for tags, releases, or anything else. Feel free to raise an issue and I'll get it sorted. diff --git a/composer.json b/composer.json index 15a5198258..1e5ad7d335 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "shardj/zf1-future", - "description": "Zend Framework 1 PHP 7.2 and 7.3 compatible", + "description": "Zend Framework 1 PHP 5.2.11+ compatible. The aim is to keep ZF1 working with the latest PHP versions", "type": "library", "keywords": [ "framework", From 59fa1a8fc952443b30ab2a5b1be4ea1c8506d7c2 Mon Sep 17 00:00:00 2001 From: aforster Date: Fri, 6 Dec 2019 10:54:10 +0100 Subject: [PATCH 031/121] Remove offsetExists from Zend_Registry to silence array_key_exists on object deprecation warning The method offsetExists was a workaround for a SPL bug which was fixed in April 2007, see http://bugs.php.net/bug.php?id=40442 --- library/Zend/Registry.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/library/Zend/Registry.php b/library/Zend/Registry.php index 837b05ae50..4a15a4d18f 100644 --- a/library/Zend/Registry.php +++ b/library/Zend/Registry.php @@ -195,15 +195,4 @@ public function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS) parent::__construct($array, $flags); } - /** - * @param string $index - * @returns mixed - * - * Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960). - */ - public function offsetExists($index) - { - return array_key_exists($index, $this); - } - } From 1403a5dd81637ad18e0a70df439bb843486dc6ac Mon Sep 17 00:00:00 2001 From: Shardj Date: Fri, 6 Dec 2019 15:06:07 +0000 Subject: [PATCH 032/121] Updated the minimum version to 5.4 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 1e5ad7d335..3d09685608 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "shardj/zf1-future", - "description": "Zend Framework 1 PHP 5.2.11+ compatible. The aim is to keep ZF1 working with the latest PHP versions", + "description": "Zend Framework 1 PHP 5.4+ compatible. The aim is to keep ZF1 working with the latest PHP versions", "type": "library", "keywords": [ "framework", @@ -9,7 +9,7 @@ "homepage": "http://framework.zend.com/", "license": "BSD-3-Clause", "require": { - "php": ">=5.2.11" + "php": ">=5.4" }, "autoload": { "psr-0": { From 3c230c8f7d152cd6c240030f4c339bad67ed605b Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 16 Dec 2019 16:00:58 +0000 Subject: [PATCH 033/121] Delete ISSUE_TEMPLATE --- ISSUE_TEMPLATE | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 ISSUE_TEMPLATE diff --git a/ISSUE_TEMPLATE b/ISSUE_TEMPLATE deleted file mode 100644 index f0289361e5..0000000000 --- a/ISSUE_TEMPLATE +++ /dev/null @@ -1,4 +0,0 @@ -Zend Framework 1 reaches its End of Life (EOL) and is no longer maintained. -No Pull Requests will be accepted. - -https://framework.zend.com/blog/2016-06-28-zf1-eol.html From efca2e2c637373e64b4c67c0acd1a620bb6b4c27 Mon Sep 17 00:00:00 2001 From: Guilherme Padilha Date: Mon, 16 Dec 2019 17:34:53 -0300 Subject: [PATCH 034/121] feat: pdo_sqlsrv by Akrabat --- library/Zend/Db/Adapter/Pdo/Sqlsrv.php | 382 +++++++++++++++ library/Zend/Db/Schema/AbstractChange.php | 41 ++ library/Zend/Db/Schema/Exception.php | 3 + library/Zend/Db/Schema/Manager.php | 384 +++++++++++++++ library/Zend/Tool/DatabaseSchemaProvider.php | 471 +++++++++++++++++++ 5 files changed, 1281 insertions(+) create mode 100644 library/Zend/Db/Adapter/Pdo/Sqlsrv.php create mode 100644 library/Zend/Db/Schema/AbstractChange.php create mode 100644 library/Zend/Db/Schema/Exception.php create mode 100644 library/Zend/Db/Schema/Manager.php create mode 100644 library/Zend/Tool/DatabaseSchemaProvider.php diff --git a/library/Zend/Db/Adapter/Pdo/Sqlsrv.php b/library/Zend/Db/Adapter/Pdo/Sqlsrv.php new file mode 100644 index 0000000000..ec507256f5 --- /dev/null +++ b/library/Zend/Db/Adapter/Pdo/Sqlsrv.php @@ -0,0 +1,382 @@ + Zend_Db::INT_TYPE, + Zend_Db::BIGINT_TYPE => Zend_Db::BIGINT_TYPE, + Zend_Db::FLOAT_TYPE => Zend_Db::FLOAT_TYPE, + 'INT' => Zend_Db::INT_TYPE, + 'SMALLINT' => Zend_Db::INT_TYPE, + 'TINYINT' => Zend_Db::INT_TYPE, + 'BIGINT' => Zend_Db::BIGINT_TYPE, + 'DECIMAL' => Zend_Db::FLOAT_TYPE, + 'FLOAT' => Zend_Db::FLOAT_TYPE, + 'MONEY' => Zend_Db::FLOAT_TYPE, + 'NUMERIC' => Zend_Db::FLOAT_TYPE, + 'REAL' => Zend_Db::FLOAT_TYPE, + 'SMALLMONEY' => Zend_Db::FLOAT_TYPE + ); + + /** + * Creates a PDO DSN for the adapter from $this->_config settings. + * + * @return string + */ + protected function _dsn() + { + // baseline of DSN parts + $dsn = $this->_config; + + if (isset($dsn['name'])) { + $dsn = $this->_pdoType . ':' . $dsn['name']; + } else { + + if(isset($dsn['dbname'])) { + $dsn['Database'] = $dsn['dbname']; + unset($dsn['dbname']); + } + + if(isset($dsn['host'])) { + if($dsn['host'] == '127.0.0.1') { + $dsn['host'] = '(local)'; + } + $dsn['Server'] = $dsn['host']; + unset($dsn['host']); + } + + unset($dsn['username']); + unset($dsn['password']); + unset($dsn['options']); + unset($dsn['charset']); + unset($dsn['persistent']); + unset($dsn['driver_options']); + if (isset($dsn['ReturnDatesAsStrings'])) { + // common sqlsrv setting but not supported by pdo_sqlsrv + unset($dsn['ReturnDatesAsStrings']); + } + + + foreach ($dsn as $key => $val) { + $dsn[$key] = "$key=$val"; + } + + $dsn = $this->_pdoType . ':' . implode(';', $dsn); + } + + return $dsn; + } + + /** + * @return void + */ + protected function _connect() + { + if ($this->_connection) { + return; + } + parent::_connect(); + $this->_connection->exec('SET QUOTED_IDENTIFIER ON'); + } + + /** + * Set the transaction isoltion level. + * + * @param integer|null $level A fetch mode from SQLSRV_TXN_*. + * @return true + * @throws Zend_Db_Adapter_Sqlsrv_Exception + */ + public function setTransactionIsolationLevel($level = null) + { + $this->_connect(); + $sql = null; + + // Default transaction level in sql server + if ($level === null) + { + $level = SQLSRV_TXN_READ_COMMITTED; + } + + switch ($level) { + case SQLSRV_TXN_READ_UNCOMMITTED: + $sql = "READ UNCOMMITTED"; + break; + case SQLSRV_TXN_READ_COMMITTED: + $sql = "READ COMMITTED"; + break; + case SQLSRV_TXN_REPEATABLE_READ: + $sql = "REPEATABLE READ"; + break; + case SQLSRV_TXN_SNAPSHOT: + $sql = "SNAPSHOT"; + break; + case SQLSRV_TXN_SERIALIZABLE: + $sql = "SERIALIZABLE"; + break; + default: + require_once 'Zend/Db/Adapter/Exception.php'; + throw new Zend_Db_Adapter_Exception("Invalid transaction isolation level mode '$level' specified"); + } + + if (!$this->_connection->exec("SET TRANSACTION ISOLATION LEVEL $sql;")) { + require_once 'Zend/Db/Adapter/Exception.php'; + throw new Zend_Db_Adapter_Exception("Transaction cannot be changed to '$level'"); + } + + return true; + } + + + /** + * Returns a list of the tables in the database. + * + * @return array + */ + public function listTables() + { + $sql = "SELECT name FROM sysobjects WHERE type = 'U' ORDER BY name"; + return $this->fetchCol($sql); + } + + /** + * Returns the column descriptions for a table. + * + * The return value is an associative array keyed by the column name, + * as returned by the RDBMS. + * + * The value of each array element is an associative array + * with the following keys: + * + * SCHEMA_NAME => string; name of database or schema + * TABLE_NAME => string; + * COLUMN_NAME => string; column name + * COLUMN_POSITION => number; ordinal position of column in table + * DATA_TYPE => string; SQL datatype name of column + * DEFAULT => string; default expression of column, null if none + * NULLABLE => boolean; true if column can have nulls + * LENGTH => number; length of CHAR/VARCHAR + * SCALE => number; scale of NUMERIC/DECIMAL + * PRECISION => number; precision of NUMERIC/DECIMAL + * UNSIGNED => boolean; unsigned property of an integer type + * PRIMARY => boolean; true if column is part of the primary key + * PRIMARY_POSITION => integer; position of column in primary key + * PRIMARY_AUTO => integer; position of auto-generated column in primary key + * + * @todo Discover column primary key position. + * @todo Discover integer unsigned property. + * + * @param string $tableName + * @param string $schemaName OPTIONAL + * @return array + */ + public function describeTable($tableName, $schemaName = null) + { + if ($schemaName != null) { + if (strpos($schemaName, '.') !== false) { + $result = explode('.', $schemaName); + $schemaName = $result[1]; + } + } + /** + * Discover metadata information about this table. + */ + $sql = "exec sp_columns @table_name = " . $this->quoteIdentifier($tableName, true); + if ($schemaName != null) { + $sql .= ", @table_owner = " . $this->quoteIdentifier($schemaName, true); + } + + $stmt = $this->query($sql); + $result = $stmt->fetchAll(Zend_Db::FETCH_NUM); + + $table_name = 2; + $column_name = 3; + $type_name = 5; + $precision = 6; + $length = 7; + $scale = 8; + $nullable = 10; + $column_def = 12; + $column_position = 16; + + /** + * Discover primary key column(s) for this table. + */ + $sql = "exec sp_pkeys @table_name = " . $this->quoteIdentifier($tableName, true); + if ($schemaName != null) { + $sql .= ", @table_owner = " . $this->quoteIdentifier($schemaName, true); + } + + $stmt = $this->query($sql); + $primaryKeysResult = $stmt->fetchAll(Zend_Db::FETCH_NUM); + $primaryKeyColumn = array(); + $pkey_column_name = 3; + $pkey_key_seq = 4; + foreach ($primaryKeysResult as $pkeysRow) { + $primaryKeyColumn[$pkeysRow[$pkey_column_name]] = $pkeysRow[$pkey_key_seq]; + } + + $desc = array(); + $p = 1; + foreach ($result as $key => $row) { + $identity = false; + $words = explode(' ', $row[$type_name], 2); + if (isset($words[0])) { + $type = $words[0]; + if (isset($words[1])) { + $identity = (bool) preg_match('/identity/', $words[1]); + } + } + + $isPrimary = array_key_exists($row[$column_name], $primaryKeyColumn); + if ($isPrimary) { + $primaryPosition = $primaryKeyColumn[$row[$column_name]]; + } else { + $primaryPosition = null; + } + + $desc[$this->foldCase($row[$column_name])] = array( + 'SCHEMA_NAME' => null, // @todo + 'TABLE_NAME' => $this->foldCase($row[$table_name]), + 'COLUMN_NAME' => $this->foldCase($row[$column_name]), + 'COLUMN_POSITION' => (int) $row[$column_position], + 'DATA_TYPE' => $type, + 'DEFAULT' => $row[$column_def], + 'NULLABLE' => (bool) $row[$nullable], + 'LENGTH' => $row[$length], + 'SCALE' => $row[$scale], + 'PRECISION' => $row[$precision], + 'UNSIGNED' => null, // @todo + 'PRIMARY' => $isPrimary, + 'PRIMARY_POSITION' => $primaryPosition, + 'IDENTITY' => $identity + ); + } + return $desc; + } + + /** + * Adds an adapter-specific LIMIT clause to the SELECT statement. + * + * @param string $sql + * @param integer $count + * @param integer $offset OPTIONAL + * @return string + * @throws Zend_Db_Adapter_Exceptions + */ + public function limit($sql, $count, $offset = 0) + { + $count = intval($count); + if ($count <= 0) { + require_once 'Zend/Db/Adapter/Exception.php'; + throw new Zend_Db_Adapter_Exception("LIMIT argument count=$count is not valid"); + } + + $offset = intval($offset); + if ($offset < 0) { + /** @see Zend_Db_Adapter_Exception */ + require_once 'Zend/Db/Adapter/Exception.php'; + throw new Zend_Db_Adapter_Exception("LIMIT argument offset=$offset is not valid"); + } + + if ($offset == 0) { + $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . $count . ' ', $sql); + } else { + $orderby = stristr($sql, 'ORDER BY'); + if ($orderby !== false) { + $sort = (stripos($orderby, ' desc') !== false) ? 'desc' : 'asc'; + $order = str_ireplace('ORDER BY', '', $orderby); + $order = trim(preg_replace('/\bASC\b|\bDESC\b/i', '', $order)); + } + + $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . ($count+$offset) . ' ', $sql); + + $sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl'; + if ($orderby !== false) { + $innerOrder = preg_replace('/\".*\".\"(.*)\"/i', '"inner_tbl"."$1"', $order); + $sql .= ' ORDER BY ' . $innerOrder . ' '; + $sql .= (stripos($sort, 'asc') !== false) ? 'DESC' : 'ASC'; + } + $sql .= ') AS outer_tbl'; + if ($orderby !== false) { + $outerOrder = preg_replace('/\".*\".\"(.*)\"/i', '"outer_tbl"."$1"', $order); + $sql .= ' ORDER BY ' . $outerOrder . ' ' . $sort; + } + } + + return $sql; + } + + /** + * Retrieve server version in PHP style + * Pdo_Mssql doesn't support getAttribute(PDO::ATTR_SERVER_VERSION) + * @return string + */ + public function getServerVersion() + { + try { + $stmt = $this->query("SELECT SERVERPROPERTY('productversion')"); + $result = $stmt->fetchAll(Zend_Db::FETCH_NUM); + if (count($result)) { + return $result[0][0]; + } + return null; + } catch (PDOException $e) { + return null; + } + } +} \ No newline at end of file diff --git a/library/Zend/Db/Schema/AbstractChange.php b/library/Zend/Db/Schema/AbstractChange.php new file mode 100644 index 0000000000..16590ea095 --- /dev/null +++ b/library/Zend/Db/Schema/AbstractChange.php @@ -0,0 +1,41 @@ +_db = $db; + $this->_tablePrefix = $tablePrefix; + } + + /** + * Changes to be applied in this change + * + * @return null + */ + abstract function up(); + + /** + * Rollback changes made in up() + * + * @return null + */ + abstract function down(); + +} \ No newline at end of file diff --git a/library/Zend/Db/Schema/Exception.php b/library/Zend/Db/Schema/Exception.php new file mode 100644 index 0000000000..38e996cc90 --- /dev/null +++ b/library/Zend/Db/Schema/Exception.php @@ -0,0 +1,3 @@ + prefix string to place before table names + * 'schema_version_table_name' => name of table to use for holding the schema version number + * + * + * @param string $dir Directory where migrations files are stored + * @param Zend_Db_Adapter_Abstract $db Database adapter + * @param string $tablePrefix Table prefix to be used by change files + */ + public function __construct($dir, Zend_Db_Adapter_Abstract $db, $tablePrefix='') + { + $this->_dir = realpath($dir); + $this->_db = $db; + $this->_tablePrefix = $tablePrefix; + } + + /** + * Retrieves the current database schema version from the database + * + * If the table does not exist, it will be created and the version will + * be set to 0. + * + * @return int + */ + public function getCurrentSchemaVersion() + { + // Ensure we have valid connection to the database + if (!$this->_db->isConnected()) { + $this->_db->getServerVersion(); + } + $schemaVersionTableName = $this->getPrefixedSchemaVersionTableName(); + + $sql = "SELECT version FROM " . $schemaVersionTableName; + try { + $version = $this->_db->fetchOne($sql); + } catch (Zend_Db_Exception $e) { + // exception means that the schema version table doesn't exist, so create it + $createSql = "CREATE TABLE $schemaVersionTableName ( + version bigint NOT NULL, + PRIMARY KEY (version) + )"; + $this->_db->query($createSql); + $insertSql = "INSERT INTO $schemaVersionTableName (version) VALUES (0)"; + $this->_db->query($insertSql); + $version = $this->_db->fetchOne($sql); + } + + return $version; + } + + /** + * Updates the database schema to a specified version. If upgrading (increasing + * version number) the schema version will be the largest available version + * that is less than or equal to the specified version. ie, if the highest version + * is 050 and 7000 is specified for $version, the resulting version will be + * 050. If downgrading (decreasing version number) the ending version will be + * the highest version that is less than or equal to the specified version + * number. i.e, if versions 10, 15 and 20 exist and the version is updated + * to 19, the resulting version will be 15 since version 20 will be downgraded. + * + * The method automatcally determines the direction of the migration by comparing + * the current version (from the database) and the desired version. If they + * are the same, no migration will be performed and the version will remain + * the same. + * + * @param string $version + * + * @return string + */ + public function updateTo($version = null) + { + if (is_null($version)) { + $version = PHP_INT_MAX; + } + $version = (int)$version; + $currentVersion = $this->getCurrentSchemaVersion(); + if($currentVersion == $version) { + return self::RESULT_AT_CURRENT_VERSION; + } + + $migrations = $this->_getMigrationFiles($currentVersion, $version); + if(empty($migrations)) { + if ($version == PHP_INT_MAX) { + return self::RESULT_AT_CURRENT_VERSION; + } + return self::RESULT_NO_MIGRATIONS_FOUND; + } + + $direction = 'up'; + if ($currentVersion > $version) { + $direction = 'down'; + } + foreach ($migrations as $migration) { + $this->_processFile($migration, $direction); + } + + // figure out what the real version we're going to is if going down + // TODO: make this more efficient by caching file information instead + // of fetching it again. + if ($direction == 'down') { + $files = $this->_getMigrationFiles($version, 0); + if (empty($files)) { + $realVersion = 0; + } else { + $versionFile = array_shift($files); + $realVersion = $versionFile['version']; + } + // update the database to the version we're actually at + $this->_updateSchemaVersion($realVersion); + } + + return self::RESULT_OK; + } + + /** + * Increments the database version a specified number of upgrades. For instance, + * if $versions is 1, it will update to the next highest version of the database. + * + * If $versions is provided and less than 1, it will assume 1 and update + * a single version. If a number higher than the available upgradable versions + * is specified, it will update to the highest version number. + * + * If the database is already at the highest version number available, it will + * not do anything and indicate it is at the maximum version number via + * the return value. + * + * @param int $versions Number of versions to increment. Must be 1 or greater + * + * @return string + */ + public function incrementVersion($versions) + { + $versions = (int)$versions; + if ($versions < 1) { + $versions = 1; + } + $currentVersion = $this->getCurrentSchemaVersion(); + + $files = $this->_getMigrationFiles($currentVersion, PHP_INT_MAX); + if (empty($files)) { + return self::RESULT_AT_MAXIMUM_VERSION; + } + + $files = array_slice($files, 0, $versions); + + $nextFile = array_pop($files); + $nextVersion = $nextFile['version']; + + return $this->updateTo($nextVersion); + } + + /** + * Decrements the version of the database by the specified number of versions. + * + * If the database is already at the lowest version number, it will indicate + * this through the return value. + * + * @param int $versions Number of versions to decrement. + * + * @return string + */ + public function decrementVersion($versions) + { + $versions = (int)$versions; + if ($versions < 1) { + $versions = 1; + } + $currentVersion = $this->getCurrentSchemaVersion(); + + $files = $this->_getMigrationFiles($currentVersion, 0); + if (empty($files)) { + return self::RESULT_AT_MINIMUM_VERSION; + } + + $files = array_slice($files, 0, $versions+1); + $nextFile = array_pop($files); + $nextVersion = $nextFile['version']; + + return $this->updateTo($nextVersion); + } + + /** + * Retrieves the migration files that are needed to take the database from + * its a specified version (current version) to the desired version. It + * will also determine the direction of the migration and sort the files + * accordingly. + * + * @param string $currentVersion Version to migrate database from + * @param string $stopVersion Version to migrate database to + * @param string $dir Directory containing migration files + * + * @throws Zend_Db_Schema_Exception + * + * @return array of file name, version and class name + */ + protected function _getMigrationFiles($currentVersion, $stopVersion, $dir = null) + { + if ($dir === null) { + $dir = $this->_dir; + } + + $direction = 'up'; + $from = $currentVersion; + $to = $stopVersion; + if($stopVersion < $currentVersion) { + $direction = 'down'; + $from = $stopVersion; + $to = $currentVersion; + } + + $files = array(); + if (!is_dir($dir) || !is_readable($dir)) { + return $files; + } + + $d = dir($dir); + $seen = array(); + while (false !== ($entry = $d->read())) { + if (preg_match('/^([0-9]+)\-(.*)\.php/i', $entry, $matches) ) { + $versionNumber = (int)$matches[1]; + if (isset($seen[$versionNumber])) { + throw new Zend_Db_Schema_Exception("version $versionNumber is used for multiple migrations."); + } + $seen[$versionNumber] = true; + $className = $matches[2]; + if ($versionNumber > $from && $versionNumber <= $to) { + $path = $this->_relativePath($this->_dir, $dir); + $files["v{$matches[1]}"] = array( + 'path'=>$path, + 'filename'=>$entry, + 'version'=>$versionNumber, + 'classname'=>$className); + } + } elseif ($entry != '.' && $entry != '..') { + $subdir = $dir . '/' . $entry; + if (is_dir($subdir) && is_readable($subdir)) { + $files = array_merge( + $files, + $this->_getMigrationFiles( + $currentVersion, $stopVersion, $subdir + ) + ); + } + } + } + $d->close(); + + if($direction == 'up') { + ksort($files); + } else { + krsort($files); + } + + return $files; + } + + /** + * Runs a migration file according to the information provided. The + * migration parameter is an array or object allowing ArrayAccess with the + * following fields: + * + * version - The version of the migration this file represents + * filename - The name of the file containing the code to upgrade or downgrade the database + * classname - The name of the class contained in the file + * + * The direction parameter should be one of either "up" or "down" and indicates + * which of the migration class methods should be executed. The up method is + * assumed to move the database schema to the next version while down is + * assumed to undo whatever up did. + * + * @param array|ArrayAccess $migration Information about the migration file + * @param string $direction "up" or "down" + * + * @throws Zend_Db_Schema_Exception + * + * @return null + * + * @todo I think there may be a problem with different migration files using + * the same class name. -- Confirmed. If you migrate single versions at a time, + * i.e. using increment or decrement then you will have no problems. If you + * try to migrate through files where there are more than one file with a + * particular class name, it will fail because it tries to redeclare a class + * that already exists. + */ + protected function _processFile($migration, $direction) + { + $path = $migration['path']; + $version = $migration['version']; + $filename = $migration['filename']; + $classname = $migration['classname']; + require_once($this->_dir.'/'.$path.'/'.$filename); + if (!class_exists($classname, false)) { + throw new Zend_Db_Schema_Exception("Could not find class '$classname' in file '$filename'"); + } + $class = new $classname($this->_db, $this->_tablePrefix); + $class->$direction(); + + if($direction == 'down') { + // current version is actually one lower than this version now + $version--; + } + $this->_updateSchemaVersion($version); + } + + /** + * Updates the schema version in the database. + * + * @param int $version Version to update into database + * + * @return null + */ + protected function _updateSchemaVersion($version) + { + $schemaVersionTableName = $this->getPrefixedSchemaVersionTableName(); + $sql = "UPDATE $schemaVersionTableName SET version = " . (int)$version; + $this->_db->query($sql); + } + + /** + * Retrieves the prefixed version of the schema version table. + * + * @return string + */ + public function getPrefixedSchemaVersionTableName() + { + return $this->_tablePrefix . $this->_schemaVersionTableName; + } + + /** + * Returns a relative path from one directory to another + * + * @param string $from Directory to start from + * @param string $to Directory to end at + * @param string $ps Path seperator + * + * @return string + */ + protected function _relativePath($from, $to, $ps = DIRECTORY_SEPARATOR) + { + $arFrom = explode($ps, rtrim($from, $ps)); + $arTo = explode($ps, rtrim($to, $ps)); + while (count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0])) { + array_shift($arFrom); + array_shift($arTo); + } + return str_pad("", count($arFrom) * 3, '..'.$ps).implode($ps, $arTo); + } +} + diff --git a/library/Zend/Tool/DatabaseSchemaProvider.php b/library/Zend/Tool/DatabaseSchemaProvider.php new file mode 100644 index 0000000000..bdbe9b1127 --- /dev/null +++ b/library/Zend/Tool/DatabaseSchemaProvider.php @@ -0,0 +1,471 @@ +updateTo(null, $env, $dir); + } + + /** + * Allows you to change the database schema version by specifying the desired version. If you are + * upgrading (choosing a higher version), it will update to the highest version that is available. + * If you are downgrading, it will go to the highest version that is equal to or lower than the + * version you specified. + * + * @param string $version Version to change to + * @param string $env Environment to retrieve database credentials from, default is development + * @param string $dir Directory containing migration files, default is ./scripts/migrations + * + * @return boolean + */ + public function updateTo($version, $env='development', $dir='./scripts/migrations') + { + $this->_init($env); + $response = $this->_registry->getResponse(); + try { + $db = $this->_getDbAdapter(); + $manager = new Zend_Db_Schema_Manager($dir, $db, $this->getTablePrefix()); + + $result = $manager->updateTo($version); + + switch ($result) { + case Zend_Db_Schema_Manager::RESULT_AT_CURRENT_VERSION: + if (!$version) { + $version = $manager->getCurrentSchemaVersion(); + } + $response->appendContent("Already at version $version"); + break; + + case Zend_Db_Schema_Manager::RESULT_NO_MIGRATIONS_FOUND : + $response->appendContent("No migration files found to migrate from {$manager->getCurrentSchemaVersion()} to $version"); + break; + + default: + $response->appendContent('Schema updated to version ' . $manager->getCurrentSchemaVersion()); + } + + return true; + } catch (Exception $e) { + $response->appendContent('AN ERROR HAS OCCURED:'); + $response->appendContent($e->getMessage()); + $response->appendContent($e->getTraceAsString()); + return false; + } + } + + /** + * Decrements the database schema version to the next version or if specified + * down a specified number of versions. + * + * @param int $versions Number of versions to decrement. Default is 1 + * @param string $env Environment to read database credentials from + * @param string $dir Directory containing migration files + * + * @return boolean + */ + public function decrement($versions=1, $env='development', $dir='./scripts/migrations') + { + $this->_init($env); + $response = $this->_registry->getResponse(); + try { + $db = $this->_getDbAdapter(); + $manager = new Zend_Db_Schema_Manager($dir, $db, $this->getTablePrefix()); + + $result = $manager->decrementVersion($versions); + + switch ($result) { + case Zend_Db_Schema_Manager::RESULT_AT_MINIMUM_VERSION: + $response->appendContent("Already at minimum version " . $manager->getCurrentSchemaVersion()); + break; + + default: + $response->appendContent('Schema updated to version ' . $manager->getCurrentSchemaVersion()); + } + + return true; + } catch (Exception $e) { + $response->appendContent('AN ERROR HAS OCCURRED: '); + $response->appendContent($e->getMessage()); + $response->appendContent($e->getTraceAsString()); + return false; + } + } + + /** + * Increments the datbase schema version to the next version or up a specified + * number of versions + * + * @param int $versions Number of versions to increment. Default is 1 + * @param string $env Environment to read database conguration from + * @param string $dir Directory containing migration scripts + * + * @return booolean + */ + public function increment($versions=1,$env='development', $dir='./scripts/migrations') + { + $this->_init($env); + $response = $this->_registry->getResponse(); + try { + $db = $this->_getDbAdapter(); + $manager = new Zend_Db_Schema_Manager($dir, $db, $this->getTablePrefix()); + + $result = $manager->incrementVersion($versions); + + switch ($result) { + case Zend_Db_Schema_Manager::RESULT_AT_MAXIMUM_VERSION: + $response->appendContent("Already at maximum version " . $manager->getCurrentSchemaVersion()); + break; + + default: + $response->appendContent('Schema updated to version ' . $manager->getCurrentSchemaVersion()); + } + + return true; + } catch (Exception $e) { + $response->appendContent('AN ERROR HAS OCCURED:'); + $response->appendContent($e->getMessage()); + $response->appendContent($e->getTraceAsString()); + return false; + } + } + + /** + * Provide the current schema version number + * + * @return boolean + */ + public function current($env='development', $dir='./migrations') + { + $this->_init($env); + try { + + // Initialize and retrieve DB resource + $db = $this->_getDbAdapter(); + $manager = new Zend_Db_Schema_Manager($dir, $db, $this->getTablePrefix()); + echo 'Current schema version is ' . $manager->getCurrentSchemaVersion() . PHP_EOL; + + return true; + } catch (Exception $e) { + echo 'AN ERROR HAS OCCURED:' . PHP_EOL; + echo $e->getMessage() . PHP_EOL; + echo $e->getTraceAsString() . PHP_EOL; + return false; + } + } + + /** + * Retrieves the realpath for ./scripts/migrations. Does not appear to be + * used anywhere. Possible candidate for removal. + * + * @return string + * @deprecated + */ + protected function _getDirectory() + { + $dir = './scripts/migrations'; + return realpath($dir); + } + + /** + * Initializes the Akrabat functionality and adds it to Zend_Tool (zf) + * + * @param string $env Environment to initialize for + * + * @return null + * + * @throws Zend_Tool_Project_Exception + */ + protected function _init($env) + { + $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); + $appConfigFileResource = $profile->search('applicationConfigFile'); + + if ($appConfigFileResource == false) { + throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.'); + } + $appConfigFilePath = $appConfigFileResource->getPath(); + + // Base config, normally the application.ini in the configs dir of your app + $this->_config = $this->_createConfig($appConfigFilePath, $env, true); + + // Are there any override config files? + foreach($this->_getAppConfigOverridePathList($appConfigFilePath) as $path) { + $overrideConfig = $this->_createConfig($path); + if (isset($overrideConfig->$env)) { + $this->_config->merge($overrideConfig->$env); + } + } + + require_once 'Zend/Loader/Autoloader.php'; + $autoloader = Zend_Loader_Autoloader::getInstance(); + $autoloader->registerNamespace('Zend_'); + } + + /** + * Pull the akrabat section of the zf.ini + * + * @return Zend_Config_Ini|false Fasle if not set + */ + protected function _getUserConfig() + { + $userConfig = false; + if (isset($this->_registry->getConfig()->akrabat)) { + $userConfig = $this->_registry->getConfig()->akrabat; + } + return $userConfig; + } + + /** + * Create new Zend_Config object based on a filename + * + * Mostly a copy and paste from Zend_Application::_loadConfig + * + * @param string $filename File to create the object from + * @param string $section If not null, pull this sestion of the config + * file only. Doesn't apply to .php and .inc file + * @param string $allowModifications Should the object be mutable or not + * + * @throws Zend_Db_Schema_Exception + * + * @return Zend_Config + */ + protected function _createConfig($filename, $section = null, $allowModifications = false) { + + $options = false; + if ($allowModifications) { + $options = array('allowModifications' => true); + } + + $suffix = pathinfo($filename, PATHINFO_EXTENSION); + $suffix = ($suffix === 'dist') + ? pathinfo(basename($filename, ".$suffix"), PATHINFO_EXTENSION) + : $suffix; + + switch (strtolower($suffix)) { + case 'ini': + $config = new Zend_Config_Ini($filename, $section, $options); + break; + + case 'xml': + $config = new Zend_Config_Xml($filename, $section, $options); + break; + + case 'json': + $config = new Zend_Config_Json($filename, $section, $options); + break; + + case 'yaml': + case 'yml': + $config = new Zend_Config_Yaml($filename, $section, $options); + break; + + case 'php': + case 'inc': + $config = include $filename; + if (!is_array($config)) { + throw new Zend_Db_Schema_Exception( + 'Invalid configuration file provided; PHP file does not return array value' + ); + } + $config = new Zend_Config($config, $allowModifications); + break; + + default: + throw new Zend_Db_Schema_Exception( + 'Invalid configuration file provided; unknown config type' + ); + } + return $config; + } + + /** + * Will pull a list of file paths to application config overrides + * + * There is a deliberate attempt to be very forgiving. If a file doesn't exist, + * it won't be included in the list. If a the file doesn't have a section that + * corresponds the current target environment it don't be merged. + * + * The config files should be standalone, they will not be able to extend + * sections from the base config file. + * + * The ini, xml, json, yaml and php config file types are supported + * + * By default we will look for a "local.ini" in the applications configs + * directory. + * + * Config files are added with an order, the order run from lowest to highest. + * The "local.ini" file in this case will be given the order of 100 + * + * This can be disabled with the following in your .zf.ini: + * + * akrabat.appConfigOverride.skipLocal = true + * + * You can have add to the list of file names to look for in the configs + * directory by adding the following to the .zf.ini: + * + * akrabat.appConfigOverride.name = 'override.ini' + * + * You can only add one name with this approach and it will be added with the + * order of 200 + * + * To add mutiple names to be checked use the following in the .zf.ini: + * + * akrabat.appConfigOverride.name.60 = 'dev.ini' + * akrabat.appConfigOverride.name.50 = 'override.ini.ini' + * + * Where the last part of the config key is the order to merge the files. + * + * To add a path to be include, do the following in your .zf.ini: + * + * akrabat.appConfigOverride.path = '/home/user/projects/account/configs/local.ini' + * + * You can only add one path with this approach and it will be added with the + * order of 300 + * + * To add mutiple path use the following in the .zf.ini: + * + * akrabat.appConfigOverride.path.1 = './application/configs/dev.ini' + * akrabat.appConfigOverride.path.4 = '/home/user/projects/account/configs/local.ini' + * + * Where the last part of the config key is the order to merge the files. + * + * If a path is added with an order that clashes with another file then the + * path will be added the end of the queue + * + * @param string $appConfigFilePath + * + * @return array + */ + protected function _getAppConfigOverridePathList($appConfigFilePath) + { + $pathList = array(); + $appConfigDir = dirname($appConfigFilePath); + $userConfig = false; + + if ($this->_getUserConfig() !== false + && isset($this->_getUserConfig()->appConfigOverride) + ) { + $userConfig = $this->_getUserConfig()->appConfigOverride; + } + + $skipLocal = false; + if ($userConfig !== false && isset($userConfig->skipLocal)) { + $skipLocal = (bool)$userConfig->skipLocal; + } + + // The convention over configuration option + if ($skipLocal === false) { + $appConfigFilePathLocal = realpath($appConfigDir.'/local.ini'); + if ($appConfigFilePathLocal) { + $pathList[100] = $appConfigFilePathLocal; + } + } + + if ($userConfig === false) { + return $pathList; + } + + // Look for file names in the app configs dir + if (isset($userConfig->name)) { + if ($userConfig->name instanceof Zend_Config) { + $fileNameList = $userConfig->name->toArray(); + } else { + $fileNameList = array(200 => $userConfig->name); + } + + foreach($fileNameList as $order => $fileName) { + $path = realpath($appConfigDir.'/'.$fileName); + if ($path) { + $pathList[$order] = $appConfigDir.'/'.$fileName; + } + } + } + + // A full or relative path, app dir will not be prefixed + if (isset($userConfig->path)) { + if ($userConfig->path instanceof Zend_Config) { + $filePathList = $userConfig->path->toArray(); + } else { + $filePathList = array(300 => $userConfig->path); + } + + foreach($filePathList as $order => $filePath) { + if (file_exists($filePath) === false) { + continue; + } + if (isset($pathList[$order])) { + $pathList[] = $filePath; + } else { + $pathList[$order] = $filePath; + } + } + } + + ksort($pathList); + return $pathList; + } + + /** + * Retrieve initialized DB connection + * + * @return Zend_Db_Adapter_Interface + */ + protected function _getDbAdapter() + { + if ((null === $this->_db)) { + if($this->_config->resources->db){ + $dbConfig = $this->_config->resources->db; + $this->_db = Zend_Db::factory($dbConfig->adapter, $dbConfig->params); + } elseif($this->_config->resources->multidb){ + foreach ($this->_config->resources->multidb as $db) { + if($db->default){ + $this->_db = Zend_Db::factory($db->adapter, $db); + } + } + } + if($this->_db instanceof Zend_Db_Adapter_Interface) { + throw new Zend_Db_Schema_Exception('Database was not initialized'); + } + } + return $this->_db; + } + + /** + * Retrieve table prefix + * + * @return string + */ + public function getTablePrefix() + { + if ((null === $this->_tablePrefix)) { + $prefix = ''; + if (isset($this->_config->resources->db->table_prefix)) { + $prefix = $this->_config->resources->db->table_prefix . '_'; + } + $this->_tablePrefix = $prefix; + } + return $this->_tablePrefix; + } + +} From 5f6ddecd7ba0093a7eeae3a20c51cafe9b3339ca Mon Sep 17 00:00:00 2001 From: Shardj Date: Thu, 19 Dec 2019 15:09:23 +0000 Subject: [PATCH 035/121] version bump to 1.16.1 --- library/Zend/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Version.php b/library/Zend/Version.php index 116e93ef9a..5a6c252064 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.16.0'; + const VERSION = '1.16.1'; /** * The latest stable version Zend Framework available From f7d48ee6a6d74568b7603af72e897891eeff92ae Mon Sep 17 00:00:00 2001 From: Martijn Gastkemper Date: Wed, 8 Jan 2020 18:43:00 +0100 Subject: [PATCH 036/121] Replace curly brakets for PHP 7.4 compatibility --- .../license-agreement/generate-document-concat.php | 2 +- library/Zend/Amf/Util/BinaryStream.php | 2 +- library/Zend/Barcode/Object/Code25.php | 2 +- library/Zend/Barcode/Object/Ean13.php | 4 ++-- library/Zend/Barcode/Object/Ean5.php | 2 +- library/Zend/Barcode/Object/Ean8.php | 2 +- library/Zend/Barcode/Object/Identcode.php | 2 +- library/Zend/Barcode/Object/ObjectAbstract.php | 2 +- library/Zend/Barcode/Object/Upca.php | 2 +- library/Zend/Barcode/Object/Upce.php | 2 +- library/Zend/Db/Statement.php | 4 ++-- library/Zend/Json/Decoder.php | 10 +++++----- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php b/demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php index 5f33ba2152..50afd1f08e 100755 --- a/demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php +++ b/demos/Zend/Service/LiveDocx/MailMerge/license-agreement/generate-document-concat.php @@ -162,7 +162,7 @@ function randomString() for ($i = 0; $i < $stringLen; $i ++) { $pos = (rand() % $poolLen); - $ret .= $pool{$pos}; + $ret .= $pool[$pos]; } return $ret; diff --git a/library/Zend/Amf/Util/BinaryStream.php b/library/Zend/Amf/Util/BinaryStream.php index b56820a62f..2f5037a9cc 100644 --- a/library/Zend/Amf/Util/BinaryStream.php +++ b/library/Zend/Amf/Util/BinaryStream.php @@ -140,7 +140,7 @@ public function readByte() ); } - return ord($this->_stream{$this->_needle++}); + return ord($this->_stream[$this->_needle++]); } /** diff --git a/library/Zend/Barcode/Object/Code25.php b/library/Zend/Barcode/Object/Code25.php index 5ef4053eae..c55a4c5c04 100644 --- a/library/Zend/Barcode/Object/Code25.php +++ b/library/Zend/Barcode/Object/Code25.php @@ -132,7 +132,7 @@ public function getChecksum($text) $checksum = 0; for ($i = strlen($text); $i > 0; $i --) { - $checksum += intval($text{$i - 1}) * $factor; + $checksum += intval($text[$i - 1]) * $factor; $factor = 4 - $factor; } diff --git a/library/Zend/Barcode/Object/Ean13.php b/library/Zend/Barcode/Object/Ean13.php index 55a483b521..dfeb6782e7 100644 --- a/library/Zend/Barcode/Object/Ean13.php +++ b/library/Zend/Barcode/Object/Ean13.php @@ -166,7 +166,7 @@ public function getChecksum($text) $checksum = 0; for ($i = strlen($text); $i > 0; $i --) { - $checksum += intval($text{$i - 1}) * $factor; + $checksum += intval($text[$i - 1]) * $factor; $factor = 4 - $factor; } @@ -196,7 +196,7 @@ protected function _drawEan13Text() $leftPosition = $this->getQuietZone() - $characterWidth; for ($i = 0; $i < $this->_barcodeLength; $i ++) { $this->_addText( - $text{$i}, + $text[$i], $this->_fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Barcode/Object/Ean5.php b/library/Zend/Barcode/Object/Ean5.php index e0a93e0a23..1f074ba077 100644 --- a/library/Zend/Barcode/Object/Ean5.php +++ b/library/Zend/Barcode/Object/Ean5.php @@ -124,7 +124,7 @@ public function getChecksum($text) $checksum = 0; for ($i = 0 ; $i < $this->_barcodeLength; $i ++) { - $checksum += intval($text{$i}) * ($i % 2 ? 9 : 3); + $checksum += intval($text[$i]) * ($i % 2 ? 9 : 3); } return ($checksum % 10); diff --git a/library/Zend/Barcode/Object/Ean8.php b/library/Zend/Barcode/Object/Ean8.php index 53965d4c23..a3f9e4510c 100644 --- a/library/Zend/Barcode/Object/Ean8.php +++ b/library/Zend/Barcode/Object/Ean8.php @@ -123,7 +123,7 @@ protected function _drawText() $leftPosition = $this->getQuietZone() + (3 * $this->_barThinWidth) * $this->_factor; for ($i = 0; $i < $this->_barcodeLength; $i ++) { $this->_addText( - $text{$i}, + $text[$i], $this->_fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Barcode/Object/Identcode.php b/library/Zend/Barcode/Object/Identcode.php index a6f0081c05..69c1e126af 100644 --- a/library/Zend/Barcode/Object/Identcode.php +++ b/library/Zend/Barcode/Object/Identcode.php @@ -85,7 +85,7 @@ public function getChecksum($text) $checksum = 0; for ($i = strlen($text); $i > 0; $i --) { - $checksum += intval($text{$i - 1}) * (($i % 2) ? 4 : 9); + $checksum += intval($text[$i - 1]) * (($i % 2) ? 4 : 9); } $checksum = (10 - ($checksum % 10)) % 10; diff --git a/library/Zend/Barcode/Object/ObjectAbstract.php b/library/Zend/Barcode/Object/ObjectAbstract.php index e942a4ad1a..b40a5a8c6e 100644 --- a/library/Zend/Barcode/Object/ObjectAbstract.php +++ b/library/Zend/Barcode/Object/ObjectAbstract.php @@ -1322,7 +1322,7 @@ protected function _drawText() for ($i = 0; $i < $textLength; $i ++) { $leftPosition = $this->getQuietZone() + $space * ($i + 0.5); $this->_addText( - $text{$i}, + $text[$i], $this->_fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Barcode/Object/Upca.php b/library/Zend/Barcode/Object/Upca.php index b9eaae73fa..dd06705c5a 100644 --- a/library/Zend/Barcode/Object/Upca.php +++ b/library/Zend/Barcode/Object/Upca.php @@ -140,7 +140,7 @@ protected function _drawText() $fontSize *= 0.8; } $this->_addText( - $text{$i}, + $text[$i], $fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Barcode/Object/Upce.php b/library/Zend/Barcode/Object/Upce.php index 8302b698f1..5cccee53e3 100644 --- a/library/Zend/Barcode/Object/Upce.php +++ b/library/Zend/Barcode/Object/Upce.php @@ -158,7 +158,7 @@ protected function _drawText() $fontSize *= 0.8; } $this->_addText( - $text{$i}, + $text[$i], $fontSize * $this->_factor, $this->_rotate( $leftPosition, diff --git a/library/Zend/Db/Statement.php b/library/Zend/Db/Statement.php index be5e2d5912..ce0e64cf3c 100644 --- a/library/Zend/Db/Statement.php +++ b/library/Zend/Db/Statement.php @@ -191,9 +191,9 @@ protected function _stripQuoted($sql) if (!empty($q)) { $escapeChar = preg_quote($escapeChar); // this segfaults only after 65,000 characters instead of 9,000 - $sql = preg_replace("/$q([^$q{$escapeChar}]*|($qe)*)*$q/s", '', $sql); + $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" diff --git a/library/Zend/Json/Decoder.php b/library/Zend/Json/Decoder.php index cc83115199..6cc569c478 100644 --- a/library/Zend/Json/Decoder.php +++ b/library/Zend/Json/Decoder.php @@ -324,7 +324,7 @@ protected function _getNextToken() $i = $this->_offset; $start = $i; - switch ($str{$i}) { + switch ($str[$i]) { case '{': $this->_token = self::LBRACE; break; @@ -351,14 +351,14 @@ protected function _getNextToken() break; } - $chr = $str{$i}; + $chr = $str[$i]; if ($chr == '\\') { $i++; if ($i >= $str_length) { break; } - $chr = $str{$i}; + $chr = $str[$i]; switch ($chr) { case '"' : $result .= '"'; @@ -431,7 +431,7 @@ protected function _getNextToken() return($this->_token); } - $chr = $str{$i}; + $chr = $str[$i]; if ($chr == '-' || $chr == '.' || ($chr >= '0' && $chr <= '9')) { if (preg_match('/-?([0-9])*(\.[0-9]*)?((e|E)((-|\+)?)[0-9]+)?/s', $str, $matches, PREG_OFFSET_CAPTURE, $start) && $matches[0][1] == $start) { @@ -494,7 +494,7 @@ public static function decodeUnicodeString($chrs) $i += 5; break; case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): - $utf8 .= $chrs{$i}; + $utf8 .= $chrs[$i]; break; case ($ord_chrs_c & 0xE0) == 0xC0: // characters U-00000080 - U-000007FF, mask 110XXXXX From e7707b1618546d94058769bd200c6ac34402ea53 Mon Sep 17 00:00:00 2001 From: Martijn Gastkemper Date: Thu, 9 Jan 2020 13:51:40 +0100 Subject: [PATCH 037/121] fixup! Replace curly brakets for PHP 7.4 compatibility --- library/Zend/Db/Statement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Db/Statement.php b/library/Zend/Db/Statement.php index ce0e64cf3c..f544dfc8a2 100644 --- a/library/Zend/Db/Statement.php +++ b/library/Zend/Db/Statement.php @@ -191,7 +191,7 @@ protected function _stripQuoted($sql) if (!empty($q)) { $escapeChar = preg_quote($escapeChar); // this segfaults only after 65,000 characters instead of 9,000 - $sql = preg_replace("/$q([^$q[$escapeChar]]*|($qe)*)*$q/s", '', $sql); + $sql = preg_replace("/$q([^$q{$escapeChar}]*|($qe)*)*$q/s", '', $sql); } // get a version of the SQL statement with all quoted From 86da9b52c90bd6f8ec65b0c65de93e954e80f986 Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 13 Jan 2020 11:26:18 +0000 Subject: [PATCH 038/121] corrects docblock return typehint --- library/Zend/Db/Adapter/Abstract.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Db/Adapter/Abstract.php b/library/Zend/Db/Adapter/Abstract.php index 9f857c6a54..728bbbba52 100644 --- a/library/Zend/Db/Adapter/Abstract.php +++ b/library/Zend/Db/Adapter/Abstract.php @@ -727,7 +727,7 @@ public function getFetchMode() * @param string|Zend_Db_Select $sql An SQL SELECT statement. * @param mixed $bind Data to bind into SELECT placeholders. * @param mixed $fetchMode Override current fetch mode. - * @return array + * @return array|null */ public function fetchAll($sql, $bind = array(), $fetchMode = null) { From 5621e192aaad3191bb7bf0b3921d69e95837330c Mon Sep 17 00:00:00 2001 From: Shardj Date: Mon, 13 Jan 2020 11:29:24 +0000 Subject: [PATCH 039/121] version bump --- library/Zend/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Version.php b/library/Zend/Version.php index 5a6c252064..6ce2680fc3 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.16.1'; + const VERSION = '1.16.2'; /** * The latest stable version Zend Framework available From 943f136b0eeb9c6635748d6f2a892bfbe924848e Mon Sep 17 00:00:00 2001 From: gdiamantg Date: Mon, 3 Feb 2020 15:03:33 +0000 Subject: [PATCH 040/121] Address iconv_substr incompatibility between php 5.x and 7.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (PHP 5, PHP 7) iconv_substr — Cut out part of a string Description iconv_substr ( string $str , int $offset [, int $length = iconv_strlen($str, $charset) [, string $charset = ini_get("iconv.internal_encoding") ]] ) : string ... Version Description 7.0.11 If str is equal to offset characters long, an empty string will be returned. Prior to this version, FALSE was returned in this case. Because of the above change, ZF1 fails to successfully initialise a DateTime object when necessary information is missing from the value provided leading to unhandled exception. --- library/Zend/Locale/Format.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/Zend/Locale/Format.php b/library/Zend/Locale/Format.php index 517dcbb415..c520ffe9a0 100644 --- a/library/Zend/Locale/Format.php +++ b/library/Zend/Locale/Format.php @@ -925,7 +925,7 @@ private static function _parseDate($date, $options) $result['day'] = $splitted[0][$cnt]; } } else { - $result['day'] = iconv_substr($splitted[0][0], $split, 2); + $result['day'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt; @@ -936,7 +936,7 @@ private static function _parseDate($date, $options) $result['month'] = $splitted[0][$cnt]; } } else { - $result['month'] = iconv_substr($splitted[0][0], $split, 2); + $result['month'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt; @@ -953,7 +953,7 @@ private static function _parseDate($date, $options) $result['year'] = $splitted[0][$cnt]; } } else { - $result['year'] = iconv_substr($splitted[0][0], $split, $length); + $result['year'] = (iconv_substr($splitted[0][0], $split, $length)?: false); $split += $length; } @@ -965,7 +965,7 @@ private static function _parseDate($date, $options) $result['hour'] = $splitted[0][$cnt]; } } else { - $result['hour'] = iconv_substr($splitted[0][0], $split, 2); + $result['hour'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt; @@ -976,7 +976,7 @@ private static function _parseDate($date, $options) $result['minute'] = $splitted[0][$cnt]; } } else { - $result['minute'] = iconv_substr($splitted[0][0], $split, 2); + $result['minute'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt; @@ -987,7 +987,7 @@ private static function _parseDate($date, $options) $result['second'] = $splitted[0][$cnt]; } } else { - $result['second'] = iconv_substr($splitted[0][0], $split, 2); + $result['second'] = (iconv_substr($splitted[0][0], $split, 2)?: false); $split += 2; } ++$cnt; From 24f4fc360fd64f9f42202c31781d87cf2556eb45 Mon Sep 17 00:00:00 2001 From: Kay Stenschke Date: Mon, 10 Feb 2020 13:06:43 +0100 Subject: [PATCH 041/121] Correct argument type annotation argument 2 of Zend_Pdf_Canvas_Interface::setLineDashingPattern() was annotated as array but expects float --- library/Zend/Pdf/Canvas/Interface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Pdf/Canvas/Interface.php b/library/Zend/Pdf/Canvas/Interface.php index d81b35d807..253f5a1d23 100644 --- a/library/Zend/Pdf/Canvas/Interface.php +++ b/library/Zend/Pdf/Canvas/Interface.php @@ -132,7 +132,7 @@ public function setLineWidth($width); * Phase is shift from the beginning of line. * * @param mixed $pattern - * @param array $phase + * @param float $phase * @return Zend_Pdf_Canvas_Interface */ public function setLineDashingPattern($pattern, $phase = 0); From dd6559a8c6357f8f46aa672e61dd84461c258c9b Mon Sep 17 00:00:00 2001 From: Shardj Date: Thu, 20 Feb 2020 10:14:29 +0000 Subject: [PATCH 042/121] Raises required php version --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3d09685608..d32e0df882 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "shardj/zf1-future", - "description": "Zend Framework 1 PHP 5.4+ compatible. The aim is to keep ZF1 working with the latest PHP versions", + "description": "Zend Framework 1. The aim is to keep ZF1 working with the latest PHP versions", "type": "library", "keywords": [ "framework", @@ -9,7 +9,7 @@ "homepage": "http://framework.zend.com/", "license": "BSD-3-Clause", "require": { - "php": ">=5.4" + "php": ">=7.1" }, "autoload": { "psr-0": { From 439acb1da8b5efd6e349addcf7442fd0319600ab Mon Sep 17 00:00:00 2001 From: Shardj Date: Thu, 20 Feb 2020 10:17:01 +0000 Subject: [PATCH 043/121] version bump --- library/Zend/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Version.php b/library/Zend/Version.php index 6ce2680fc3..07bc95ca59 100644 --- a/library/Zend/Version.php +++ b/library/Zend/Version.php @@ -32,7 +32,7 @@ final class Zend_Version /** * Zend Framework version identification - see compareVersion() */ - const VERSION = '1.16.2'; + const VERSION = '1.17.0'; /** * The latest stable version Zend Framework available From 7d5f57f27746847efe48228081959162c1c8e649 Mon Sep 17 00:00:00 2001 From: Bryan Phillips Date: Thu, 20 Feb 2020 13:58:37 -0600 Subject: [PATCH 044/121] added 2-series BIN for MasterCard --- library/Zend/Validate/CreditCard.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/Zend/Validate/CreditCard.php b/library/Zend/Validate/CreditCard.php index 170b622507..a0783407c2 100644 --- a/library/Zend/Validate/CreditCard.php +++ b/library/Zend/Validate/CreditCard.php @@ -110,7 +110,10 @@ class Zend_Validate_CreditCard extends Zend_Validate_Abstract self::JCB => array('3528', '3529', '353', '354', '355', '356', '357', '358'), self::LASER => array('6304', '6706', '6771', '6709'), self::MAESTRO => array('5018', '5020', '5038', '6304', '6759', '6761', '6763'), - self::MASTERCARD => array('51', '52', '53', '54', '55'), + self::MASTERCARD => array('51', '52', '53', '54', '55', '2221', '2222', '2223', + '2224', '2225', '2226', '2227', '2228', '2229', '223', + '224', '225', '226', '227', '228', '229', '23', '24', + '25', '26', '271', '2720'), self::SOLO => array('6334', '6767'), self::UNIONPAY => array('622126', '622127', '622128', '622129', '62213', '62214', '62215', '62216', '62217', '62218', '62219', '6222', '6223', From e2519c8dc571948dc1b12b2b09f2cc374233050c Mon Sep 17 00:00:00 2001 From: Piotr Niziniecki Date: Mon, 24 Feb 2020 23:31:35 +0100 Subject: [PATCH 045/121] Adds support for meta property tags for html5 --- library/Zend/View/Helper/HeadMeta.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Zend/View/Helper/HeadMeta.php b/library/Zend/View/Helper/HeadMeta.php index de58edd5dc..a767738887 100644 --- a/library/Zend/View/Helper/HeadMeta.php +++ b/library/Zend/View/Helper/HeadMeta.php @@ -222,8 +222,8 @@ protected function _isValid($item) return false; } - // is only supported with doctype RDFa - if ( !is_null($this->view) && !$this->view->doctype()->isRdfa() + // is only supported with doctype RDFa and html5 + if ( !is_null($this->view) && !$this->view->doctype()->isRdfa() && !$isHtml5 && $item->type === 'property') { return false; } From 7522b063c8193d7fd978326041a4bf235a390adc Mon Sep 17 00:00:00 2001 From: Piotr Niziniecki Date: Mon, 24 Feb 2020 23:46:06 +0100 Subject: [PATCH 046/121] The type attribute is unnecessary for JavaScript resources. --- library/Zend/View/Helper/HeadScript.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Zend/View/Helper/HeadScript.php b/library/Zend/View/Helper/HeadScript.php index 062bed1b0c..801db64992 100644 --- a/library/Zend/View/Helper/HeadScript.php +++ b/library/Zend/View/Helper/HeadScript.php @@ -433,7 +433,12 @@ public function itemToString($item, $indent, $escapeStart, $escapeEnd) $addScriptEscape = !(isset($item->attributes['noescape']) && filter_var($item->attributes['noescape'], FILTER_VALIDATE_BOOLEAN)); $type = ($this->_autoEscape) ? $this->_escape($item->type) : $item->type; - $html = '', @@ -1120,7 +1120,7 @@ protected function _renderLayers() */ protected function _renderExtras() { - $js = array(); + $js = []; $modulePaths = $this->getModulePaths(); if (!empty($modulePaths)) { foreach ($modulePaths as $module => $path) { @@ -1135,7 +1135,7 @@ protected function _renderExtras() } } - $onLoadActions = array(); + $onLoadActions = []; // Get Zend specific onLoad actions; these will always be first to // ensure that dijits are created in the correct order foreach ($this->_getZendLoadActions() as $callback) { diff --git a/library/Zend/Dojo/View/Helper/Editor.php b/library/Zend/Dojo/View/Helper/Editor.php index c31179bc9e..92f214d67e 100644 --- a/library/Zend/Dojo/View/Helper/Editor.php +++ b/library/Zend/Dojo/View/Helper/Editor.php @@ -50,7 +50,7 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit /** * @var array Maps non-core plugin to module basename */ - protected $_pluginsModules = array( + protected $_pluginsModules = [ 'createLink' => 'LinkDialog', 'insertImage' => 'LinkDialog', 'fontName' => 'FontChoice', @@ -65,13 +65,13 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit 'tabIndent' => 'TabIndent', 'toggleDir' => 'ToggleDir', 'viewSource' => 'ViewSource' - ); + ]; /** * JSON-encoded parameters * @var array */ - protected $_jsonParams = array('captureEvents', 'events', 'plugins', 'extraPlugins'); + protected $_jsonParams = ['captureEvents', 'events', 'plugins', 'extraPlugins']; /** * dijit.Editor @@ -82,7 +82,7 @@ class Zend_Dojo_View_Helper_Editor extends Zend_Dojo_View_Helper_Dijit * @param array $attribs * @return string */ - public function editor($id, $value = null, $params = array(), $attribs = array()) + public function editor($id, $value = null, $params = [], $attribs = []) { if (isset($params['plugins'])) { foreach ($this->_getRequiredModules($params['plugins']) as $module) { @@ -108,12 +108,12 @@ public function editor($id, $value = null, $params = array(), $attribs = array() $textareaName = $this->_normalizeEditorName($hiddenName); $textareaId = $hiddenId . '-Editor'; - $hiddenAttribs = array( + $hiddenAttribs = [ 'id' => $hiddenId, 'name' => $hiddenName, 'value' => $value, 'type' => 'hidden', - ); + ]; $attribs['id'] = $textareaId; $this->_createGetParentFormFunction(); @@ -144,7 +144,7 @@ public function editor($id, $value = null, $params = array(), $attribs = array() */ protected function _getRequiredModules(array $plugins) { - $modules = array(); + $modules = []; foreach ($plugins as $commandName) { if (isset($this->_pluginsModules[$commandName])) { $pluginName = $this->_pluginsModules[$commandName]; diff --git a/library/Zend/Dojo/View/Helper/FilteringSelect.php b/library/Zend/Dojo/View/Helper/FilteringSelect.php index 526aa2e94f..53d3ac6de6 100644 --- a/library/Zend/Dojo/View/Helper/FilteringSelect.php +++ b/library/Zend/Dojo/View/Helper/FilteringSelect.php @@ -56,7 +56,7 @@ class Zend_Dojo_View_Helper_FilteringSelect extends Zend_Dojo_View_Helper_ComboB * @param array|null $options Select options * @return string */ - public function filteringSelect($id, $value = null, array $params = array(), array $attribs = array(), array $options = null) + public function filteringSelect($id, $value = null, array $params = [], array $attribs = [], array $options = null) { return $this->comboBox($id, $value, $params, $attribs, $options); } diff --git a/library/Zend/Dojo/View/Helper/Form.php b/library/Zend/Dojo/View/Helper/Form.php index 6c45f9ae4b..3244fd07f4 100644 --- a/library/Zend/Dojo/View/Helper/Form.php +++ b/library/Zend/Dojo/View/Helper/Form.php @@ -70,7 +70,7 @@ public function form($id, $attribs = null, $content = false) $attribs['id'] = $id; } - $attribs = $this->_prepareDijit($attribs, array(), 'layout'); + $attribs = $this->_prepareDijit($attribs, [], 'layout'); return $this->getFormHelper()->form($id, $attribs, $content); } diff --git a/library/Zend/Dojo/View/Helper/HorizontalSlider.php b/library/Zend/Dojo/View/Helper/HorizontalSlider.php index ca42af0735..20ec206625 100644 --- a/library/Zend/Dojo/View/Helper/HorizontalSlider.php +++ b/library/Zend/Dojo/View/Helper/HorizontalSlider.php @@ -55,7 +55,7 @@ class Zend_Dojo_View_Helper_HorizontalSlider extends Zend_Dojo_View_Helper_Slide * @param array $attribs HTML attributes * @return string */ - public function horizontalSlider($id, $value = null, array $params = array(), array $attribs = array()) + public function horizontalSlider($id, $value = null, array $params = [], array $attribs = []) { return $this->prepareSlider($id, $value, $params, $attribs); } diff --git a/library/Zend/Dojo/View/Helper/NumberSpinner.php b/library/Zend/Dojo/View/Helper/NumberSpinner.php index a55e47d39f..ad42db4087 100644 --- a/library/Zend/Dojo/View/Helper/NumberSpinner.php +++ b/library/Zend/Dojo/View/Helper/NumberSpinner.php @@ -61,7 +61,7 @@ class Zend_Dojo_View_Helper_NumberSpinner extends Zend_Dojo_View_Helper_Dijit * @param array $attribs HTML attributes * @return string */ - public function numberSpinner($id, $value = null, array $params = array(), array $attribs = array()) + public function numberSpinner($id, $value = null, array $params = [], array $attribs = []) { // Get constraints and serialize to JSON if necessary if (array_key_exists('constraints', $params)) { @@ -69,7 +69,7 @@ public function numberSpinner($id, $value = null, array $params = array(), array unset($params['constraints']); } } else { - $constraints = array(); + $constraints = []; if (array_key_exists('min', $params)) { $constraints['min'] = $params['min']; unset($params['min']); diff --git a/library/Zend/Dojo/View/Helper/NumberTextBox.php b/library/Zend/Dojo/View/Helper/NumberTextBox.php index 625e33eefc..d99129d04f 100644 --- a/library/Zend/Dojo/View/Helper/NumberTextBox.php +++ b/library/Zend/Dojo/View/Helper/NumberTextBox.php @@ -61,7 +61,7 @@ class Zend_Dojo_View_Helper_NumberTextBox extends Zend_Dojo_View_Helper_Dijit * @param array $attribs HTML attributes * @return string */ - public function numberTextBox($id, $value = null, array $params = array(), array $attribs = array()) + public function numberTextBox($id, $value = null, array $params = [], array $attribs = []) { return $this->_createFormElement($id, $value, $params, $attribs); } diff --git a/library/Zend/Dojo/View/Helper/PasswordTextBox.php b/library/Zend/Dojo/View/Helper/PasswordTextBox.php index 77f1884bf8..0f5fb43aeb 100644 --- a/library/Zend/Dojo/View/Helper/PasswordTextBox.php +++ b/library/Zend/Dojo/View/Helper/PasswordTextBox.php @@ -49,7 +49,7 @@ class Zend_Dojo_View_Helper_PasswordTextBox extends Zend_Dojo_View_Helper_Valida * @param array $attribs HTML attributes * @return string */ - public function passwordTextBox($id, $value = null, array $params = array(), array $attribs = array()) + public function passwordTextBox($id, $value = null, array $params = [], array $attribs = []) { return $this->_createFormElement($id, $value, $params, $attribs); } diff --git a/library/Zend/Dojo/View/Helper/RadioButton.php b/library/Zend/Dojo/View/Helper/RadioButton.php index 5c7324fc2d..49578366b8 100644 --- a/library/Zend/Dojo/View/Helper/RadioButton.php +++ b/library/Zend/Dojo/View/Helper/RadioButton.php @@ -60,8 +60,8 @@ class Zend_Dojo_View_Helper_RadioButton extends Zend_Dojo_View_Helper_Dijit public function radioButton( $id, $value = null, - array $params = array(), - array $attribs = array(), + array $params = [], + array $attribs = [], array $options = null, $listsep = "
\n" ) { @@ -80,7 +80,7 @@ public function radioButton( $filter = new Zend_Filter_Alnum(); foreach (array_keys($options) as $key) { $optId = $baseId . '-' . $filter->filter($key); - $this->_createDijit($this->_dijit, $optId, array()); + $this->_createDijit($this->_dijit, $optId, []); } } diff --git a/library/Zend/Dojo/View/Helper/SimpleTextarea.php b/library/Zend/Dojo/View/Helper/SimpleTextarea.php index 04bbbb7072..7c8a762c11 100644 --- a/library/Zend/Dojo/View/Helper/SimpleTextarea.php +++ b/library/Zend/Dojo/View/Helper/SimpleTextarea.php @@ -59,7 +59,7 @@ class Zend_Dojo_View_Helper_SimpleTextarea extends Zend_Dojo_View_Helper_Dijit * @param array $attribs HTML attributes * @return string */ - public function simpleTextarea($id, $value = null, array $params = array(), array $attribs = array()) + public function simpleTextarea($id, $value = null, array $params = [], array $attribs = []) { if (!array_key_exists('id', $attribs)) { $attribs['id'] = $id; diff --git a/library/Zend/Dojo/View/Helper/Slider.php b/library/Zend/Dojo/View/Helper/Slider.php index 792b0686ac..3320559082 100644 --- a/library/Zend/Dojo/View/Helper/Slider.php +++ b/library/Zend/Dojo/View/Helper/Slider.php @@ -44,7 +44,7 @@ abstract class Zend_Dojo_View_Helper_Slider extends Zend_Dojo_View_Helper_Dijit * Required slider parameters * @var array */ - protected $_requiredParams = array('minimum', 'maximum', 'discreteValues'); + protected $_requiredParams = ['minimum', 'maximum', 'discreteValues']; /** * Slider type -- vertical or horizontal @@ -61,7 +61,7 @@ abstract class Zend_Dojo_View_Helper_Slider extends Zend_Dojo_View_Helper_Dijit * @param array $attribs HTML attributes * @return string */ - public function prepareSlider($id, $value = null, array $params = array(), array $attribs = array()) + public function prepareSlider($id, $value = null, array $params = [], array $attribs = []) { $this->_sliderType = strtolower($this->_sliderType); @@ -84,7 +84,7 @@ public function prepareSlider($id, $value = null, array $params = array(), array } $id = str_replace('][', '-', $id); - $id = str_replace(array('[', ']'), '-', $id); + $id = str_replace(['[', ']'], '-', $id); $id = rtrim($id, '-'); $id .= '-slider'; @@ -145,7 +145,7 @@ public function prepareSlider($id, $value = null, array $params = array(), array */ protected function _prepareDecoration($position, $id, $decInfo) { - if (!in_array($position, array('topDecoration', 'bottomDecoration', 'leftDecoration', 'rightDecoration'))) { + if (!in_array($position, ['topDecoration', 'bottomDecoration', 'leftDecoration', 'rightDecoration'])) { return ''; } @@ -167,8 +167,8 @@ protected function _prepareDecoration($position, $id, $decInfo) } } - $params = array(); - $attribs = array(); + $params = []; + $attribs = []; $labels = $decInfo['labels']; if (array_key_exists('params', $decInfo)) { $params = $decInfo['params']; diff --git a/library/Zend/Dojo/View/Helper/SplitContainer.php b/library/Zend/Dojo/View/Helper/SplitContainer.php index 1462406dea..5603e824ad 100644 --- a/library/Zend/Dojo/View/Helper/SplitContainer.php +++ b/library/Zend/Dojo/View/Helper/SplitContainer.php @@ -55,7 +55,7 @@ class Zend_Dojo_View_Helper_SplitContainer extends Zend_Dojo_View_Helper_DijitCo * @param array $attribs HTML attributes * @return string */ - public function splitContainer($id = null, $content = '', array $params = array(), array $attribs = array()) + public function splitContainer($id = null, $content = '', array $params = [], array $attribs = []) { if (0 === func_num_args()) { return $this; diff --git a/library/Zend/Dojo/View/Helper/StackContainer.php b/library/Zend/Dojo/View/Helper/StackContainer.php index 40a558c4c9..f8d8a0d9fb 100644 --- a/library/Zend/Dojo/View/Helper/StackContainer.php +++ b/library/Zend/Dojo/View/Helper/StackContainer.php @@ -55,7 +55,7 @@ class Zend_Dojo_View_Helper_StackContainer extends Zend_Dojo_View_Helper_DijitCo * @param array $attribs HTML attributes * @return string */ - public function stackContainer($id = null, $content = '', array $params = array(), array $attribs = array()) + public function stackContainer($id = null, $content = '', array $params = [], array $attribs = []) { if (0 === func_num_args()) { return $this; diff --git a/library/Zend/Dojo/View/Helper/SubmitButton.php b/library/Zend/Dojo/View/Helper/SubmitButton.php index 1072fb71c0..d747d1713e 100644 --- a/library/Zend/Dojo/View/Helper/SubmitButton.php +++ b/library/Zend/Dojo/View/Helper/SubmitButton.php @@ -48,7 +48,7 @@ class Zend_Dojo_View_Helper_SubmitButton extends Zend_Dojo_View_Helper_Button * @param array $attribs HTML attributes * @return string */ - public function submitButton($id, $value = null, array $params = array(), array $attribs = array()) + public function submitButton($id, $value = null, array $params = [], array $attribs = []) { if (!array_key_exists('label', $params)) { $params['label'] = $value; diff --git a/library/Zend/Dojo/View/Helper/TabContainer.php b/library/Zend/Dojo/View/Helper/TabContainer.php index 354ba349aa..0e2010d9f8 100644 --- a/library/Zend/Dojo/View/Helper/TabContainer.php +++ b/library/Zend/Dojo/View/Helper/TabContainer.php @@ -55,7 +55,7 @@ class Zend_Dojo_View_Helper_TabContainer extends Zend_Dojo_View_Helper_DijitCont * @param array $attribs HTML attributes * @return string */ - public function tabContainer($id = null, $content = '', array $params = array(), array $attribs = array()) + public function tabContainer($id = null, $content = '', array $params = [], array $attribs = []) { if (0 === func_num_args()) { return $this; diff --git a/library/Zend/Dojo/View/Helper/TextBox.php b/library/Zend/Dojo/View/Helper/TextBox.php index f0f382ea02..80a71d8fc0 100644 --- a/library/Zend/Dojo/View/Helper/TextBox.php +++ b/library/Zend/Dojo/View/Helper/TextBox.php @@ -61,7 +61,7 @@ class Zend_Dojo_View_Helper_TextBox extends Zend_Dojo_View_Helper_Dijit * @param array $attribs HTML attributes * @return string */ - public function textBox($id, $value = null, array $params = array(), array $attribs = array()) + public function textBox($id, $value = null, array $params = [], array $attribs = []) { return $this->_createFormElement($id, $value, $params, $attribs); } diff --git a/library/Zend/Dojo/View/Helper/Textarea.php b/library/Zend/Dojo/View/Helper/Textarea.php index 03e04b8d38..40b9e835fa 100644 --- a/library/Zend/Dojo/View/Helper/Textarea.php +++ b/library/Zend/Dojo/View/Helper/Textarea.php @@ -61,7 +61,7 @@ class Zend_Dojo_View_Helper_Textarea extends Zend_Dojo_View_Helper_Dijit * @param array $attribs HTML attributes * @return string */ - public function textarea($id, $value = null, array $params = array(), array $attribs = array()) + public function textarea($id, $value = null, array $params = [], array $attribs = []) { if (!array_key_exists('id', $attribs)) { $attribs['id'] = $id; diff --git a/library/Zend/Dojo/View/Helper/TimeTextBox.php b/library/Zend/Dojo/View/Helper/TimeTextBox.php index 82b2c77f85..270557897b 100644 --- a/library/Zend/Dojo/View/Helper/TimeTextBox.php +++ b/library/Zend/Dojo/View/Helper/TimeTextBox.php @@ -61,7 +61,7 @@ class Zend_Dojo_View_Helper_TimeTextBox extends Zend_Dojo_View_Helper_Dijit * @param array $attribs HTML attributes * @return string */ - public function timeTextBox($id, $value = null, array $params = array(), array $attribs = array()) + public function timeTextBox($id, $value = null, array $params = [], array $attribs = []) { return $this->_createFormElement($id, $value, $params, $attribs); } diff --git a/library/Zend/Dojo/View/Helper/ValidationTextBox.php b/library/Zend/Dojo/View/Helper/ValidationTextBox.php index e349c90cfa..50d9888147 100644 --- a/library/Zend/Dojo/View/Helper/ValidationTextBox.php +++ b/library/Zend/Dojo/View/Helper/ValidationTextBox.php @@ -61,7 +61,7 @@ class Zend_Dojo_View_Helper_ValidationTextBox extends Zend_Dojo_View_Helper_Diji * @param array $attribs HTML attributes * @return string */ - public function validationTextBox($id, $value = null, array $params = array(), array $attribs = array()) + public function validationTextBox($id, $value = null, array $params = [], array $attribs = []) { return $this->_createFormElement($id, $value, $params, $attribs); } diff --git a/library/Zend/Dojo/View/Helper/VerticalSlider.php b/library/Zend/Dojo/View/Helper/VerticalSlider.php index 30bdc564cb..6a92d3f590 100644 --- a/library/Zend/Dojo/View/Helper/VerticalSlider.php +++ b/library/Zend/Dojo/View/Helper/VerticalSlider.php @@ -55,7 +55,7 @@ class Zend_Dojo_View_Helper_VerticalSlider extends Zend_Dojo_View_Helper_Slider * @param array $attribs HTML attributes * @return string */ - public function verticalSlider($id, $value = null, array $params = array(), array $attribs = array()) + public function verticalSlider($id, $value = null, array $params = [], array $attribs = []) { return $this->prepareSlider($id, $value, $params, $attribs); } diff --git a/library/Zend/Dom/Query.php b/library/Zend/Dom/Query.php index 3f87cca176..5fe6e8b3ff 100644 --- a/library/Zend/Dom/Query.php +++ b/library/Zend/Dom/Query.php @@ -81,7 +81,7 @@ class Zend_Dom_Query * XPath namespaces * @var array */ - protected $_xpathNamespaces = array(); + protected $_xpathNamespaces = []; /** * Constructor diff --git a/library/Zend/Dom/Query/Css2Xpath.php b/library/Zend/Dom/Query/Css2Xpath.php index 5612ad7abf..64537ed51d 100644 --- a/library/Zend/Dom/Query/Css2Xpath.php +++ b/library/Zend/Dom/Query/Css2Xpath.php @@ -40,7 +40,7 @@ public static function transform($path) $path = (string) $path; if (strstr($path, ',')) { $paths = explode(',', $path); - $expressions = array(); + $expressions = []; foreach ($paths as $path) { $xpath = self::transform(trim($path)); if (is_string($xpath)) { @@ -52,7 +52,7 @@ public static function transform($path) return implode('|', $expressions); } - $paths = array('//'); + $paths = ['//']; $path = preg_replace('|\s+>\s+|', '>', $path); $segments = preg_split('/\s+/', $path); foreach ($segments as $key => $segment) { @@ -101,21 +101,21 @@ protected static function _tokenize($expression) // arbitrary attribute strict equality $expression = preg_replace_callback( '|\[([a-z0-9_-]+)=[\'"]([^\'"]+)[\'"]\]|i', - array(__CLASS__, '_createEqualityExpression'), + [__CLASS__, '_createEqualityExpression'], $expression ); // arbitrary attribute contains full word $expression = preg_replace_callback( '|\[([a-z0-9_-]+)~=[\'"]([^\'"]+)[\'"]\]|i', - array(__CLASS__, '_normalizeSpaceAttribute'), + [__CLASS__, '_normalizeSpaceAttribute'], $expression ); // arbitrary attribute contains specified content $expression = preg_replace_callback( '|\[([a-z0-9_-]+)\*=[\'"]([^\'"]+)[\'"]\]|i', - array(__CLASS__, '_createContainsExpression'), + [__CLASS__, '_createContainsExpression'], $expression ); diff --git a/library/Zend/EventManager/Event.php b/library/Zend/EventManager/Event.php index 366f3ead8c..d941dd47b2 100644 --- a/library/Zend/EventManager/Event.php +++ b/library/Zend/EventManager/Event.php @@ -46,7 +46,7 @@ class Zend_EventManager_Event implements Zend_EventManager_EventDescription /** * @var array|ArrayAccess|object The event parameters */ - protected $params = array(); + protected $params = []; /** * @var bool Whether or not to stop propagation diff --git a/library/Zend/EventManager/EventCollection.php b/library/Zend/EventManager/EventCollection.php index 7318425ea3..55ac29fb85 100644 --- a/library/Zend/EventManager/EventCollection.php +++ b/library/Zend/EventManager/EventCollection.php @@ -47,7 +47,7 @@ interface Zend_EventManager_EventCollection * @param null|callback $callback * @return Zend_EventManager_ResponseCollection */ - public function trigger($event, $target = null, $argv = array(), $callback = null); + public function trigger($event, $target = null, $argv = [], $callback = null); /** * Trigger an event until the given callback returns a boolean false diff --git a/library/Zend/EventManager/EventManager.php b/library/Zend/EventManager/EventManager.php index 732b7a2618..abad1113cb 100644 --- a/library/Zend/EventManager/EventManager.php +++ b/library/Zend/EventManager/EventManager.php @@ -43,7 +43,7 @@ class Zend_EventManager_EventManager implements Zend_EventManager_EventCollectio * Subscribed events and their listeners * @var array Array of Zend_Stdlib_PriorityQueue objects */ - protected $events = array(); + protected $events = []; /** * @var string Class representing the event being emitted @@ -54,7 +54,7 @@ class Zend_EventManager_EventManager implements Zend_EventManager_EventCollectio * Identifiers, used to pull static signals from StaticEventManager * @var array */ - protected $identifiers = array(); + protected $identifiers = []; /** * Static collections @@ -147,7 +147,7 @@ public function setIdentifiers($identifiers) if (is_array($identifiers) || $identifiers instanceof Traversable) { $this->identifiers = array_unique((array) $identifiers); } elseif ($identifiers !== null) { - $this->identifiers = array($identifiers); + $this->identifiers = [$identifiers]; } return $this; } @@ -163,7 +163,7 @@ public function addIdentifiers($identifiers) if (is_array($identifiers) || $identifiers instanceof Traversable) { $this->identifiers = array_unique($this->identifiers + (array) $identifiers); } elseif ($identifiers !== null) { - $this->identifiers = array_unique(array_merge($this->identifiers, array($identifiers))); + $this->identifiers = array_unique(array_merge($this->identifiers, [$identifiers])); } return $this; } @@ -179,7 +179,7 @@ public function addIdentifiers($identifiers) * @param null|callback $callback * @return Zend_EventManager_ResponseCollection All listener return values */ - public function trigger($event, $target = null, $argv = array(), $callback = null) + public function trigger($event, $target = null, $argv = [], $callback = null) { if ($event instanceof Zend_EventManager_EventDescription) { $e = $event; @@ -287,7 +287,7 @@ public function attach($event, $callback = null, $priority = 1) // Array of events should be registered individually, and return an array of all listeners if (is_array($event)) { - $listeners = array(); + $listeners = []; foreach ($event as $name) { $listeners[] = $this->attach($name, $callback, $priority); } @@ -300,7 +300,7 @@ public function attach($event, $callback = null, $priority = 1) } // Create a callback handler, setting the event and priority in its metadata - $listener = new Zend_Stdlib_CallbackHandler($callback, array('event' => $event, 'priority' => $priority)); + $listener = new Zend_Stdlib_CallbackHandler($callback, ['event' => $event, 'priority' => $priority]); // Inject the callback handler into the queue $this->events[$event]->insert($listener, $priority); @@ -495,11 +495,11 @@ protected function triggerListeners($event, Zend_EventManager_EventDescription $ protected function getSharedListeners($event) { if (!$sharedCollections = $this->getSharedCollections()) { - return array(); + return []; } $identifiers = $this->getIdentifiers(); - $sharedListeners = array(); + $sharedListeners = []; foreach ($identifiers as $id) { if (!$listeners = $sharedCollections->getListeners($id, $event)) { diff --git a/library/Zend/EventManager/Filter.php b/library/Zend/EventManager/Filter.php index fc932e8056..7164709542 100644 --- a/library/Zend/EventManager/Filter.php +++ b/library/Zend/EventManager/Filter.php @@ -37,7 +37,7 @@ interface Zend_EventManager_Filter * @param array $params * @return mixed */ - public function run($context, array $params = array()); + public function run($context, array $params = []); /** * Attach an intercepting filter diff --git a/library/Zend/EventManager/Filter/FilterIterator.php b/library/Zend/EventManager/Filter/FilterIterator.php index dbbe711873..6be16b771b 100644 --- a/library/Zend/EventManager/Filter/FilterIterator.php +++ b/library/Zend/EventManager/Filter/FilterIterator.php @@ -66,7 +66,7 @@ public function remove($datum) // Iterate and remove any matches $removed = false; - $items = array(); + $items = []; $this->rewind(); while (!$this->isEmpty()) { $item = $this->extract(); @@ -96,7 +96,7 @@ public function remove($datum) * @param Zend_EventManager_Filter_FilterIterator $chain * @return mixed */ - public function next($context = null, array $params = array(), $chain = null) + public function next($context = null, array $params = [], $chain = null) { if (empty($context) || $chain->isEmpty()) { return; diff --git a/library/Zend/EventManager/FilterChain.php b/library/Zend/EventManager/FilterChain.php index 8aa8741e43..d8397aa6d3 100644 --- a/library/Zend/EventManager/FilterChain.php +++ b/library/Zend/EventManager/FilterChain.php @@ -58,7 +58,7 @@ public function __construct() * @param mixed $argv Associative array of arguments * @return mixed */ - public function run($context, array $argv = array()) + public function run($context, array $argv = []) { $chain = clone $this->getFilters(); @@ -88,7 +88,7 @@ public function attach($callback, $priority = 1) require_once 'Zend/Stdlib/Exception/InvalidCallbackException.php'; throw new Zend_Stdlib_Exception_InvalidCallbackException('No callback provided'); } - $filter = new Zend_Stdlib_CallbackHandler($callback, array('priority' => $priority)); + $filter = new Zend_Stdlib_CallbackHandler($callback, ['priority' => $priority]); $this->filters->insert($filter, $priority); return $filter; } diff --git a/library/Zend/EventManager/GlobalEventManager.php b/library/Zend/EventManager/GlobalEventManager.php index 19e5f24d4e..49ad6a732a 100644 --- a/library/Zend/EventManager/GlobalEventManager.php +++ b/library/Zend/EventManager/GlobalEventManager.php @@ -71,7 +71,7 @@ public static function getEventCollection() * @param array|object $argv * @return Zend_EventManager_ResponseCollection */ - public static function trigger($event, $context, $argv = array()) + public static function trigger($event, $context, $argv = []) { return self::getEventCollection()->trigger($event, $context, $argv); } diff --git a/library/Zend/EventManager/ResponseCollection.php b/library/Zend/EventManager/ResponseCollection.php index 6ef9d9aa18..1e08321a74 100644 --- a/library/Zend/EventManager/ResponseCollection.php +++ b/library/Zend/EventManager/ResponseCollection.php @@ -49,7 +49,7 @@ class SplStack implements Iterator, ArrayAccess, Countable * * @var array */ - protected $data = array(); + protected $data = []; /** * Sorted stack of values @@ -70,10 +70,10 @@ class SplStack implements Iterator, ArrayAccess, Countable */ public function setIteratorMode($mode) { - $expected = array( + $expected = [ self::IT_MODE_DELETE => true, self::IT_MODE_KEEP => true, - ); + ]; if (!isset($expected[$mode])) { throw new InvalidArgumentException(sprintf('Invalid iterator mode specified ("%s")', $mode)); diff --git a/library/Zend/EventManager/SharedEventManager.php b/library/Zend/EventManager/SharedEventManager.php index be232351b3..ce4063d748 100644 --- a/library/Zend/EventManager/SharedEventManager.php +++ b/library/Zend/EventManager/SharedEventManager.php @@ -39,7 +39,7 @@ class Zend_EventManager_SharedEventManager implements Zend_EventManager_SharedEv * Identifiers with event connections * @var array */ - protected $identifiers = array(); + protected $identifiers = []; /** * Attach a listener to an event diff --git a/library/Zend/Feed.php b/library/Zend/Feed.php index 3eeed7406e..3ee06ac153 100644 --- a/library/Zend/Feed.php +++ b/library/Zend/Feed.php @@ -54,11 +54,11 @@ class Zend_Feed /** * @var array */ - protected static $_namespaces = array( + protected static $_namespaces = [ 'opensearch' => 'http://a9.com/-/spec/opensearchrss/1.0/', 'atom' => 'http://www.w3.org/2005/Atom', 'rss' => 'http://blogs.law.harvard.edu/tech/rss', - ); + ]; /** @@ -310,7 +310,7 @@ public static function findFeeds($uri) } // Try to fetch a feed for each link tag that appears to refer to a feed - $feeds = array(); + $feeds = []; if (isset($matches[1]) && count($matches[1]) > 0) { foreach ($matches[1] as $link) { // force string to be an utf-8 one diff --git a/library/Zend/Feed/Abstract.php b/library/Zend/Feed/Abstract.php index 287a65b793..50ffb7e361 100644 --- a/library/Zend/Feed/Abstract.php +++ b/library/Zend/Feed/Abstract.php @@ -146,7 +146,7 @@ public function __sleep() { $this->_element = $this->saveXML(); - return array('_element'); + return ['_element']; } @@ -158,7 +158,7 @@ public function __sleep() */ protected function _buildEntryCache() { - $this->_entries = array(); + $this->_entries = []; foreach ($this->_element->childNodes as $child) { if ($child->localName == $this->_entryElementName) { $this->_entries[] = $child; diff --git a/library/Zend/Feed/Atom.php b/library/Zend/Feed/Atom.php index 2ee08cef6a..1d1aeedb77 100644 --- a/library/Zend/Feed/Atom.php +++ b/library/Zend/Feed/Atom.php @@ -137,7 +137,7 @@ public function link($rel = null) $links = parent::__get('link'); if (!is_array($links)) { if ($links instanceof Zend_Feed_Element) { - $links = array($links); + $links = [$links]; } else { return $links; } diff --git a/library/Zend/Feed/Builder.php b/library/Zend/Feed/Builder.php index f35dc7f1fc..cb88dce846 100644 --- a/library/Zend/Feed/Builder.php +++ b/library/Zend/Feed/Builder.php @@ -68,7 +68,7 @@ class Zend_Feed_Builder implements Zend_Feed_Builder_Interface * * @var $_entries array */ - private $_entries = array(); + private $_entries = []; /** * Constructor. The $data array must conform to the following format: @@ -214,7 +214,7 @@ public function getEntries() */ protected function _createHeader(array $data) { - $mandatories = array('title', 'link', 'charset'); + $mandatories = ['title', 'link', 'charset']; foreach ($mandatories as $mandatory) { if (!isset($data[$mandatory])) { /** @@ -262,7 +262,7 @@ protected function _createHeader(array $data) $this->_header->setRating($data['rating']); } if (isset($data['cloud'])) { - $mandatories = array('domain', 'path', 'registerProcedure', 'protocol'); + $mandatories = ['domain', 'path', 'registerProcedure', 'protocol']; foreach ($mandatories as $mandatory) { if (!isset($data['cloud'][$mandatory])) { /** @@ -276,7 +276,7 @@ protected function _createHeader(array $data) $this->_header->setCloud($uri_str, $data['cloud']['registerProcedure'], $data['cloud']['protocol']); } if (isset($data['textInput'])) { - $mandatories = array('title', 'description', 'name', 'link'); + $mandatories = ['title', 'description', 'name', 'link']; foreach ($mandatories as $mandatory) { if (!isset($data['textInput'][$mandatory])) { /** @@ -343,7 +343,7 @@ protected function _createHeader(array $data) protected function _createEntries(array $data) { foreach ($data as $row) { - $mandatories = array('title', 'link', 'description'); + $mandatories = ['title', 'link', 'description']; foreach ($mandatories as $mandatory) { if (!isset($row[$mandatory])) { /** @@ -373,7 +373,7 @@ protected function _createEntries(array $data) $entry->setCommentsRssUrl($row['commentRss']); } if (isset($row['source'])) { - $mandatories = array('title', 'url'); + $mandatories = ['title', 'url']; foreach ($mandatories as $mandatory) { if (!isset($row['source'][$mandatory])) { /** diff --git a/library/Zend/Feed/Builder/Entry.php b/library/Zend/Feed/Builder/Entry.php index d911cf6658..d44d166cee 100644 --- a/library/Zend/Feed/Builder/Entry.php +++ b/library/Zend/Feed/Builder/Entry.php @@ -182,8 +182,8 @@ public function setCommentsRssUrl($commentRss) */ public function setSource($title, $url) { - $this->offsetSet('source', array('title' => $title, - 'url' => $url)); + $this->offsetSet('source', ['title' => $title, + 'url' => $url]); return $this; } @@ -229,7 +229,7 @@ public function addCategory(array $category) } if (!$this->offsetExists('category')) { - $categories = array($category); + $categories = [$category]; } else { $categories = $this->offsetGet('category'); $categories[] = $category; @@ -284,13 +284,13 @@ public function setEnclosures(array $enclosures) public function addEnclosure($url, $type = '', $length = '') { if (!$this->offsetExists('enclosure')) { - $enclosure = array(); + $enclosure = []; } else { $enclosure = $this->offsetGet('enclosure'); } - $enclosure[] = array('url' => $url, + $enclosure[] = ['url' => $url, 'type' => $type, - 'length' => $length); + 'length' => $length]; $this->offsetSet('enclosure', $enclosure); return $this; } diff --git a/library/Zend/Feed/Builder/Header.php b/library/Zend/Feed/Builder/Header.php index 7ff4d9b9ba..a8d04178c6 100644 --- a/library/Zend/Feed/Builder/Header.php +++ b/library/Zend/Feed/Builder/Header.php @@ -323,9 +323,9 @@ public function setCloud($uri, $procedure, $protocol) if (!$uri->getPort()) { $uri->setPort(80); } - $this->offsetSet('cloud', array('uri' => $uri, + $this->offsetSet('cloud', ['uri' => $uri, 'procedure' => $procedure, - 'protocol' => $protocol)); + 'protocol' => $protocol]); return $this; } @@ -341,10 +341,10 @@ public function setCloud($uri, $procedure, $protocol) */ public function setTextInput($title, $description, $name, $link) { - $this->offsetSet('textInput', array('title' => $title, + $this->offsetSet('textInput', ['title' => $title, 'description' => $description, 'name' => $name, - 'link' => $link)); + 'link' => $link]); return $this; } @@ -395,7 +395,7 @@ public function setSkipDays(array $days) require_once 'Zend/Feed/Builder/Exception.php'; throw new Zend_Feed_Builder_Exception("you can not have more than 7 days in the skipDays property"); } - $valid = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); + $valid = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']; foreach ($days as $day) { if (!in_array(strtolower($day), $valid)) { /** diff --git a/library/Zend/Feed/Builder/Header/Itunes.php b/library/Zend/Feed/Builder/Header/Itunes.php index 52d6566ae8..af5dc238b5 100644 --- a/library/Zend/Feed/Builder/Header/Itunes.php +++ b/library/Zend/Feed/Builder/Header/Itunes.php @@ -125,7 +125,7 @@ public function setOwner($name = '', $email = '') throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the itunes owner's email property"); } } - $this->offsetSet('owner', array('name' => $name, 'email' => $email)); + $this->offsetSet('owner', ['name' => $name, 'email' => $email]); return $this; } @@ -178,7 +178,7 @@ public function setSummary($summary) public function setBlock($block) { $block = strtolower($block); - if (!in_array($block, array('yes', 'no'))) { + if (!in_array($block, ['yes', 'no'])) { /** * @see Zend_Feed_Builder_Exception */ @@ -199,7 +199,7 @@ public function setBlock($block) public function setExplicit($explicit) { $explicit = strtolower($explicit); - if (!in_array($explicit, array('yes', 'no', 'clean'))) { + if (!in_array($explicit, ['yes', 'no', 'clean'])) { /** * @see Zend_Feed_Builder_Exception */ diff --git a/library/Zend/Feed/Element.php b/library/Zend/Feed/Element.php index 9376c2551a..c334748dde 100644 --- a/library/Zend/Feed/Element.php +++ b/library/Zend/Feed/Element.php @@ -341,7 +341,7 @@ public function __toString() */ protected function _children($var) { - $found = array(); + $found = []; // Look for access of the form {ns:var}. if (strpos($var, ':') !== false) { diff --git a/library/Zend/Feed/Entry/Atom.php b/library/Zend/Feed/Entry/Atom.php index 3c3a0a8469..490276ccea 100644 --- a/library/Zend/Feed/Entry/Atom.php +++ b/library/Zend/Feed/Entry/Atom.php @@ -153,8 +153,8 @@ public function save($postUri = null) $client = Zend_Feed::getHttpClient(); $client->setUri($editUri); if (Zend_Feed::getHttpMethodOverride()) { - $client->setHeaders(array('X-HTTP-Method-Override: PUT', - 'Content-Type: ' . self::CONTENT_TYPE)); + $client->setHeaders(['X-HTTP-Method-Override: PUT', + 'Content-Type: ' . self::CONTENT_TYPE]); $client->setRawData($this->saveXML()); $response = $client->request('POST'); } else { @@ -261,7 +261,7 @@ public function link($rel = null) $links = parent::__get('link'); if (!is_array($links)) { if ($links instanceof Zend_Feed_Element) { - $links = array($links); + $links = [$links]; } else { return $links; } diff --git a/library/Zend/Feed/Pubsubhubbub/HttpResponse.php b/library/Zend/Feed/Pubsubhubbub/HttpResponse.php index 10c8dbd354..5e567d8cc5 100644 --- a/library/Zend/Feed/Pubsubhubbub/HttpResponse.php +++ b/library/Zend/Feed/Pubsubhubbub/HttpResponse.php @@ -44,7 +44,7 @@ class Zend_Feed_Pubsubhubbub_HttpResponse * * @var array */ - protected $_headers = array(); + protected $_headers = []; /** * HTTP response code to use in headers @@ -116,11 +116,11 @@ public function setHeader($name, $value, $replace = false) } } } - $this->_headers[] = array( + $this->_headers[] = [ 'name' => $name, 'value' => $value, 'replace' => $replace, - ); + ]; return $this; } @@ -227,7 +227,7 @@ public function getBody() */ protected function _normalizeHeader($name) { - $filtered = str_replace(array('-', '_'), ' ', (string) $name); + $filtered = str_replace(['-', '_'], ' ', (string) $name); $filtered = ucwords(strtolower($filtered)); $filtered = str_replace(' ', '-', $filtered); return $filtered; diff --git a/library/Zend/Feed/Pubsubhubbub/Publisher.php b/library/Zend/Feed/Pubsubhubbub/Publisher.php index 89378bdd5e..687f6fa517 100644 --- a/library/Zend/Feed/Pubsubhubbub/Publisher.php +++ b/library/Zend/Feed/Pubsubhubbub/Publisher.php @@ -38,7 +38,7 @@ class Zend_Feed_Pubsubhubbub_Publisher * * @var array */ - protected $_hubUrls = array(); + protected $_hubUrls = []; /** * An array of topic (Atom or RSS feed) URLs which have been updated and @@ -46,7 +46,7 @@ class Zend_Feed_Pubsubhubbub_Publisher * * @var array */ - protected $_updatedTopicUrls = array(); + protected $_updatedTopicUrls = []; /** * An array of any errors including keys for 'response', 'hubUrl'. @@ -54,7 +54,7 @@ class Zend_Feed_Pubsubhubbub_Publisher * * @var array */ - protected $_errors = array(); + protected $_errors = []; /** * An array of topic (Atom or RSS feed) URLs which have been updated and @@ -62,7 +62,7 @@ class Zend_Feed_Pubsubhubbub_Publisher * * @var array */ - protected $_parameters = array(); + protected $_parameters = []; /** * Constructor; accepts an array or Zend_Config instance to preset @@ -274,15 +274,15 @@ public function notifyAll() throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' . ' have been set so no notifcations can be sent'); } - $this->_errors = array(); + $this->_errors = []; foreach ($hubs as $url) { $client->setUri($url); $response = $client->request(); if ($response->getStatus() !== 204) { - $this->_errors[] = array( + $this->_errors[] = [ 'response' => $response, 'hubUrl' => $url - ); + ]; } } } @@ -400,10 +400,10 @@ protected function _getHttpClient() { $client = Zend_Feed_Pubsubhubbub::getHttpClient(); $client->setMethod(Zend_Http_Client::POST); - $client->setConfig(array( + $client->setConfig([ 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . Zend_Version::VERSION, - )); - $params = array(); + ]); + $params = []; $params[] = 'hub.mode=publish'; $topics = $this->getUpdatedTopicUrls(); if (empty($topics)) { diff --git a/library/Zend/Feed/Pubsubhubbub/Subscriber.php b/library/Zend/Feed/Pubsubhubbub/Subscriber.php index 97b8fab5f0..0a9f706d8e 100644 --- a/library/Zend/Feed/Pubsubhubbub/Subscriber.php +++ b/library/Zend/Feed/Pubsubhubbub/Subscriber.php @@ -42,7 +42,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber * * @var array */ - protected $_hubUrls = array(); + protected $_hubUrls = []; /** * An array of optional parameters to be included in any @@ -50,7 +50,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber * * @var array */ - protected $_parameters = array(); + protected $_parameters = []; /** * The URL of the topic (Rss or Atom feed) which is the subject of @@ -96,7 +96,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber * * @var array */ - protected $_errors = array(); + protected $_errors = []; /** * An array of Hub Server URLs for Hubs operating at this time in @@ -104,7 +104,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber * * @var array */ - protected $_asyncHubs = array(); + protected $_asyncHubs = []; /** * An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background @@ -121,7 +121,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber * * @var array */ - protected $_authentications = array(); + protected $_authentications = []; /** * Tells the Subscriber to append any subscription identifier to the path @@ -639,8 +639,8 @@ protected function _doRequest($mode) throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' . ' have been set so no subscriptions can be attempted'); } - $this->_errors = array(); - $this->_asyncHubs = array(); + $this->_errors = []; + $this->_asyncHubs = []; foreach ($hubs as $url) { if (array_key_exists($url, $this->_authentications)) { $auth = $this->_authentications[$url]; @@ -655,10 +655,10 @@ protected function _doRequest($mode) if ($response->getStatus() !== 204 && $response->getStatus() !== 202 ) { - $this->_errors[] = array( + $this->_errors[] = [ 'response' => $response, 'hubUrl' => $url, - ); + ]; /** * At first I thought it was needed, but the backend storage will * allow tracking async without any user interference. It's left @@ -667,10 +667,10 @@ protected function _doRequest($mode) * move these to asynchronous processes. */ } elseif ($response->getStatus() == 202) { - $this->_asyncHubs[] = array( + $this->_asyncHubs[] = [ 'response' => $response, 'hubUrl' => $url, - ); + ]; } } } @@ -684,8 +684,8 @@ protected function _getHttpClient() { $client = Zend_Feed_Pubsubhubbub::getHttpClient(); $client->setMethod(Zend_Http_Client::POST); - $client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' - . Zend_Version::VERSION)); + $client->setConfig(['useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' + . Zend_Version::VERSION]); return $client; } @@ -700,31 +700,31 @@ protected function _getHttpClient() */ protected function _getRequestParameters($hubUrl, $mode) { - if (!in_array($mode, array('subscribe', 'unsubscribe'))) { + if (!in_array($mode, ['subscribe', 'unsubscribe'])) { require_once 'Zend/Feed/Pubsubhubbub/Exception.php'; throw new Zend_Feed_Pubsubhubbub_Exception('Invalid mode specified: "' . $mode . '" which should have been "subscribe" or "unsubscribe"'); } - $params = array( + $params = [ 'hub.mode' => $mode, 'hub.topic' => $this->getTopicUrl(), - ); + ]; if ($this->getPreferredVerificationMode() == Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC ) { - $vmodes = array( + $vmodes = [ Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, - ); + ]; } else { - $vmodes = array( + $vmodes = [ Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, - ); + ]; } - $params['hub.verify'] = array(); + $params['hub.verify'] = []; foreach($vmodes as $vmode) { $params['hub.verify'][] = $vmode; } @@ -762,7 +762,7 @@ protected function _getRequestParameters($hubUrl, $mode) $expires = $now->add($params['hub.lease_seconds'], Zend_Date::SECOND) ->get('yyyy-MM-dd HH:mm:ss'); } - $data = array( + $data = [ 'id' => $key, 'topic_url' => $params['hub.topic'], 'hub_url' => $hubUrl, @@ -772,7 +772,7 @@ protected function _getRequestParameters($hubUrl, $mode) 'secret' => null, 'expiration_time' => $expires, 'subscription_state' => Zend_Feed_Pubsubhubbub::SUBSCRIPTION_NOTVERIFIED, - ); + ]; $this->getStorage()->setSubscription($data); return $this->_toByteValueOrderedString( @@ -818,11 +818,11 @@ protected function _generateSubscriptionKey(array $params, $hubUrl) */ protected function _urlEncode(array $params) { - $encoded = array(); + $encoded = []; foreach ($params as $key => $value) { if (is_array($value)) { $ekey = Zend_Feed_Pubsubhubbub::urlencode($key); - $encoded[$ekey] = array(); + $encoded[$ekey] = []; foreach ($value as $duplicateKey) { $encoded[$ekey][] = Zend_Feed_Pubsubhubbub::urlencode($duplicateKey); @@ -843,7 +843,7 @@ protected function _urlEncode(array $params) */ protected function _toByteValueOrderedString(array $params) { - $return = array(); + $return = []; uksort($params, 'strnatcmp'); foreach ($params as $key => $value) { if (is_array($value)) { diff --git a/library/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php b/library/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php index 42c0559f80..33c8463b02 100644 --- a/library/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php +++ b/library/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php @@ -154,12 +154,12 @@ public function isValidHubVerification(array $httpGetData) if (strtolower($_SERVER['REQUEST_METHOD']) !== 'get') { return false; } - $required = array( + $required = [ 'hub_mode', 'hub_topic', 'hub_challenge', 'hub_verify_token', - ); + ]; foreach ($required as $key) { if (!array_key_exists($key, $httpGetData)) { return false; @@ -302,13 +302,13 @@ protected function _detectVerifyTokenKey(array $httpGetData = null) */ protected function _parseQueryString() { - $params = array(); + $params = []; $queryString = ''; if (isset($_SERVER['QUERY_STRING'])) { $queryString = $_SERVER['QUERY_STRING']; } if (empty($queryString)) { - return array(); + return []; } $parts = explode('&', $queryString); foreach ($parts as $kvpair) { @@ -319,7 +319,7 @@ protected function _parseQueryString() if (is_array($params[$key])) { $params[$key][] = $value; } else { - $params[$key] = array($params[$key], $value); + $params[$key] = [$params[$key], $value]; } } else { $params[$key] = $value; diff --git a/library/Zend/Feed/Reader.php b/library/Zend/Feed/Reader.php index 92edc9a785..f3f9e0854c 100644 --- a/library/Zend/Feed/Reader.php +++ b/library/Zend/Feed/Reader.php @@ -106,26 +106,26 @@ class Zend_Feed_Reader protected static $_pluginLoader = null; - protected static $_prefixPaths = array(); + protected static $_prefixPaths = []; - protected static $_extensions = array( - 'feed' => array( + protected static $_extensions = [ + 'feed' => [ 'DublinCore_Feed', 'Atom_Feed' - ), - 'entry' => array( + ], + 'entry' => [ 'Content_Entry', 'DublinCore_Entry', 'Atom_Entry' - ), - 'core' => array( + ], + 'core' => [ 'DublinCore_Feed', 'Atom_Feed', 'Content_Entry', 'DublinCore_Entry', 'Atom_Entry' - ) - ); + ] + ]; /** * Get the Feed cache @@ -583,9 +583,9 @@ public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { require_once 'Zend/Loader/PluginLoader.php'; - self::$_pluginLoader = new Zend_Loader_PluginLoader(array( + self::$_pluginLoader = new Zend_Loader_PluginLoader([ 'Zend_Feed_Reader_Extension_' => 'Zend/Feed/Reader/Extension/', - )); + ]); } return self::$_pluginLoader; } @@ -698,25 +698,25 @@ public static function reset() self::$_httpMethodOverride = false; self::$_httpConditionalGet = false; self::$_pluginLoader = null; - self::$_prefixPaths = array(); - self::$_extensions = array( - 'feed' => array( + self::$_prefixPaths = []; + self::$_extensions = [ + 'feed' => [ 'DublinCore_Feed', 'Atom_Feed' - ), - 'entry' => array( + ], + 'entry' => [ 'Content_Entry', 'DublinCore_Entry', 'Atom_Entry' - ), - 'core' => array( + ], + 'core' => [ 'DublinCore_Feed', 'Atom_Feed', 'Content_Entry', 'DublinCore_Entry', 'Atom_Entry' - ) - ); + ] + ]; } /** diff --git a/library/Zend/Feed/Reader/Collection/Author.php b/library/Zend/Feed/Reader/Collection/Author.php index fa03df3b76..07c1a29912 100644 --- a/library/Zend/Feed/Reader/Collection/Author.php +++ b/library/Zend/Feed/Reader/Collection/Author.php @@ -41,7 +41,7 @@ class Zend_Feed_Reader_Collection_Author * @return array */ public function getValues() { - $authors = array(); + $authors = []; foreach ($this->getIterator() as $element) { $authors[] = $element['name']; } diff --git a/library/Zend/Feed/Reader/Collection/Category.php b/library/Zend/Feed/Reader/Collection/Category.php index 2ee9b3d512..3f8b09e5e0 100644 --- a/library/Zend/Feed/Reader/Collection/Category.php +++ b/library/Zend/Feed/Reader/Collection/Category.php @@ -43,7 +43,7 @@ class Zend_Feed_Reader_Collection_Category * @return array */ public function getValues() { - $categories = array(); + $categories = []; foreach ($this->getIterator() as $element) { if (isset($element['label']) && !empty($element['label'])) { $categories[] = $element['label']; diff --git a/library/Zend/Feed/Reader/Entry/Rss.php b/library/Zend/Feed/Reader/Entry/Rss.php index 52eaa3d206..d54f77d00e 100644 --- a/library/Zend/Feed/Reader/Entry/Rss.php +++ b/library/Zend/Feed/Reader/Entry/Rss.php @@ -160,13 +160,13 @@ public function getAuthors() return $this->_data['authors']; } - $authors = array(); + $authors = []; $authors_dc = $this->getExtension('DublinCore')->getAuthors(); if (!empty($authors_dc)) { foreach ($authors_dc as $author) { - $authors[] = array( + $authors[] = [ 'name' => $author['name'] - ); + ]; } } @@ -181,7 +181,7 @@ public function getAuthors() $string = trim($author->nodeValue); $email = null; $name = null; - $data = array(); + $data = []; // Pretty rough parsing - but it's a catchall if (preg_match("/^.*@[^ ]*/", $string, $matches)) { $data['email'] = trim($matches[0]); @@ -269,8 +269,8 @@ public function getDateModified() if ($dateModifiedParsed) { $date = new Zend_Date($dateModifiedParsed); } else { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); + $dateStandards = [Zend_Date::RSS, Zend_Date::RFC_822, + Zend_Date::RFC_2822, Zend_Date::DATES]; $date = new Zend_Date; foreach ($dateStandards as $standard) { try { @@ -451,7 +451,7 @@ public function getLinks() return $this->_data['links']; } - $links = array(); + $links = []; if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { @@ -494,11 +494,11 @@ public function getCategories() if ($list->length) { $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { - $categoryCollection[] = array( + $categoryCollection[] = [ 'term' => $category->nodeValue, 'scheme' => $category->getAttribute('domain'), 'label' => $category->nodeValue, - ); + ]; } } else { $categoryCollection = $this->getExtension('DublinCore')->getCategories(); diff --git a/library/Zend/Feed/Reader/EntryAbstract.php b/library/Zend/Feed/Reader/EntryAbstract.php index a55e0953ef..b57c576410 100644 --- a/library/Zend/Feed/Reader/EntryAbstract.php +++ b/library/Zend/Feed/Reader/EntryAbstract.php @@ -32,7 +32,7 @@ abstract class Zend_Feed_Reader_EntryAbstract * * @var array */ - protected $_data = array(); + protected $_data = []; /** * DOM document object @@ -67,7 +67,7 @@ abstract class Zend_Feed_Reader_EntryAbstract * * @var array */ - protected $_extensions = array(); + protected $_extensions = []; /** * Constructor @@ -210,7 +210,7 @@ public function __call($method, $args) { foreach ($this->_extensions as $extension) { if (method_exists($extension, $method)) { - return call_user_func_array(array($extension, $method), $args); + return call_user_func_array([$extension, $method], $args); } } require_once 'Zend/Feed/Exception.php'; diff --git a/library/Zend/Feed/Reader/Extension/Atom/Entry.php b/library/Zend/Feed/Reader/Extension/Atom/Entry.php index d97c49f3b6..d2a53f173f 100644 --- a/library/Zend/Feed/Reader/Extension/Atom/Entry.php +++ b/library/Zend/Feed/Reader/Extension/Atom/Entry.php @@ -86,7 +86,7 @@ public function getAuthors() return $this->_data['authors']; } - $authors = array(); + $authors = []; $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:author'); if (!$list->length) { @@ -174,10 +174,10 @@ public function getContent() protected function _collectXhtml($xhtml, $prefix) { if (!empty($prefix)) $prefix = $prefix . ':'; - $matches = array( + $matches = [ "/<\?xml[^<]*>[^<]*<" . $prefix . "div[^<]*/", "/<\/" . $prefix . "div>\s*$/" - ); + ]; $xhtml = preg_replace($matches, '', $xhtml); if (!empty($prefix)) { $xhtml = preg_replace("/(<[\/]?)" . $prefix . "([a-zA-Z]+)/", '$1$2', $xhtml); @@ -378,7 +378,7 @@ public function getLinks() return $this->_data['links']; } - $links = array(); + $links = []; $list = $this->getXpath()->query( $this->getXpathPrefix() . '//atom:link[@rel="alternate"]/@href' . '|' . @@ -535,11 +535,11 @@ public function getCategories() if ($list->length) { $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { - $categoryCollection[] = array( + $categoryCollection[] = [ 'term' => $category->getAttribute('term'), 'scheme' => $category->getAttribute('scheme'), 'label' => $category->getAttribute('label') - ); + ]; } } else { return new Zend_Feed_Reader_Collection_Category; @@ -600,7 +600,7 @@ protected function _absolutiseUri($link) */ protected function _getAuthor(DOMElement $element) { - $author = array(); + $author = []; $emailNode = $element->getElementsByTagName('email'); $nameNode = $element->getElementsByTagName('name'); diff --git a/library/Zend/Feed/Reader/Extension/Atom/Feed.php b/library/Zend/Feed/Reader/Extension/Atom/Feed.php index 240a76d091..d64f44c683 100644 --- a/library/Zend/Feed/Reader/Extension/Atom/Feed.php +++ b/library/Zend/Feed/Reader/Extension/Atom/Feed.php @@ -78,7 +78,7 @@ public function getAuthors() $list = $this->_xpath->query('//atom:author'); - $authors = array(); + $authors = []; if ($list->length) { foreach ($list as $author) { @@ -308,7 +308,7 @@ public function getImage() if (!$imageUrl) { $image = null; } else { - $image = array('uri'=>$imageUrl); + $image = ['uri'=>$imageUrl]; } $this->_data['image'] = $image; @@ -332,7 +332,7 @@ public function getIcon() if (!$imageUrl) { $image = null; } else { - $image = array('uri'=>$imageUrl); + $image = ['uri'=>$imageUrl]; } $this->_data['icon'] = $image; @@ -419,7 +419,7 @@ public function getHubs() if (array_key_exists('hubs', $this->_data)) { return $this->_data['hubs']; } - $hubs = array(); + $hubs = []; $list = $this->_xpath->query($this->getXpathPrefix() . '//atom:link[@rel="hub"]/@href'); @@ -485,11 +485,11 @@ public function getCategories() if ($list->length) { $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { - $categoryCollection[] = array( + $categoryCollection[] = [ 'term' => $category->getAttribute('term'), 'scheme' => $category->getAttribute('scheme'), 'label' => $category->getAttribute('label') - ); + ]; } } else { return new Zend_Feed_Reader_Collection_Category; @@ -508,7 +508,7 @@ public function getCategories() */ protected function _getAuthor(DOMElement $element) { - $author = array(); + $author = []; $emailNode = $element->getElementsByTagName('email'); $nameNode = $element->getElementsByTagName('name'); diff --git a/library/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php b/library/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php index 1962202597..9b44c834cf 100644 --- a/library/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php +++ b/library/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php @@ -65,7 +65,7 @@ public function getLicenses() return $this->_data[$name]; } - $licenses = array(); + $licenses = []; $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//cc:license'); if ($list->length) { diff --git a/library/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php b/library/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php index dc42486c97..1d65289085 100644 --- a/library/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php +++ b/library/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php @@ -61,7 +61,7 @@ public function getLicenses() return $this->_data[$name]; } - $licenses = array(); + $licenses = []; $list = $this->_xpath->evaluate('channel/cc:license'); if ($list->length) { diff --git a/library/Zend/Feed/Reader/Extension/DublinCore/Entry.php b/library/Zend/Feed/Reader/Extension/DublinCore/Entry.php index 35f94e77ca..1127994c18 100644 --- a/library/Zend/Feed/Reader/Extension/DublinCore/Entry.php +++ b/library/Zend/Feed/Reader/Extension/DublinCore/Entry.php @@ -71,7 +71,7 @@ public function getAuthors() return $this->_data['authors']; } - $authors = array(); + $authors = []; $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:creator'); if (!$list->length) { @@ -87,9 +87,9 @@ public function getAuthors() if ($list->length) { foreach ($list as $author) { - $authors[] = array( + $authors[] = [ 'name' => $author->nodeValue - ); + ]; } $authors = new Zend_Feed_Reader_Collection_Author( Zend_Feed_Reader::arrayUnique($authors) @@ -123,11 +123,11 @@ public function getCategories() if ($list->length) { $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { - $categoryCollection[] = array( + $categoryCollection[] = [ 'term' => $category->nodeValue, 'scheme' => null, 'label' => $category->nodeValue, - ); + ]; } } else { $categoryCollection = new Zend_Feed_Reader_Collection_Category; diff --git a/library/Zend/Feed/Reader/Extension/DublinCore/Feed.php b/library/Zend/Feed/Reader/Extension/DublinCore/Feed.php index 168235fc27..70041e386e 100644 --- a/library/Zend/Feed/Reader/Extension/DublinCore/Feed.php +++ b/library/Zend/Feed/Reader/Extension/DublinCore/Feed.php @@ -71,7 +71,7 @@ public function getAuthors() return $this->_data['authors']; } - $authors = array(); + $authors = []; $list = $this->_xpath->query('//dc11:creator'); if (!$list->length) { @@ -87,9 +87,9 @@ public function getAuthors() if ($list->length) { foreach ($list as $author) { - $authors[] = array( + $authors[] = [ 'name' => $author->nodeValue - ); + ]; } $authors = new Zend_Feed_Reader_Collection_Author( Zend_Feed_Reader::arrayUnique($authors) @@ -282,11 +282,11 @@ public function getCategories() if ($list->length) { $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { - $categoryCollection[] = array( + $categoryCollection[] = [ 'term' => $category->nodeValue, 'scheme' => null, 'label' => $category->nodeValue, - ); + ]; } } else { $categoryCollection = new Zend_Feed_Reader_Collection_Category; diff --git a/library/Zend/Feed/Reader/Extension/EntryAbstract.php b/library/Zend/Feed/Reader/Extension/EntryAbstract.php index 6b1cda6235..e18f567724 100644 --- a/library/Zend/Feed/Reader/Extension/EntryAbstract.php +++ b/library/Zend/Feed/Reader/Extension/EntryAbstract.php @@ -32,7 +32,7 @@ abstract class Zend_Feed_Reader_Extension_EntryAbstract * * @var array */ - protected $_data = array(); + protected $_data = []; /** * DOM document object diff --git a/library/Zend/Feed/Reader/Extension/FeedAbstract.php b/library/Zend/Feed/Reader/Extension/FeedAbstract.php index 93b0b579e2..7c10be6abf 100644 --- a/library/Zend/Feed/Reader/Extension/FeedAbstract.php +++ b/library/Zend/Feed/Reader/Extension/FeedAbstract.php @@ -48,7 +48,7 @@ abstract class Zend_Feed_Reader_Extension_FeedAbstract * * @var array */ - protected $_data = array(); + protected $_data = []; /** * Parsed feed data in the shape of a DOMDocument diff --git a/library/Zend/Feed/Reader/Extension/Podcast/Feed.php b/library/Zend/Feed/Reader/Extension/Podcast/Feed.php index 0cffab413d..89fca47743 100644 --- a/library/Zend/Feed/Reader/Extension/Podcast/Feed.php +++ b/library/Zend/Feed/Reader/Extension/Podcast/Feed.php @@ -89,14 +89,14 @@ public function getCategories() $categoryList = $this->_xpath->query($this->getXpathPrefix() . '/itunes:category'); - $categories = array(); + $categories = []; if ($categoryList->length > 0) { foreach ($categoryList as $node) { $children = null; if ($node->childNodes->length > 0) { - $children = array(); + $children = []; foreach ($node->childNodes as $childNode) { if (!($childNode instanceof DOMText)) { diff --git a/library/Zend/Feed/Reader/Extension/Slash/Entry.php b/library/Zend/Feed/Reader/Extension/Slash/Entry.php index 866f72a306..e46e4b1c77 100644 --- a/library/Zend/Feed/Reader/Extension/Slash/Entry.php +++ b/library/Zend/Feed/Reader/Extension/Slash/Entry.php @@ -72,7 +72,7 @@ public function getHitParade() } $stringParade = $this->_getData($name); - $hitParade = array(); + $hitParade = []; if (!empty($stringParade)) { $stringParade = explode(',', $stringParade); diff --git a/library/Zend/Feed/Reader/Feed/Atom.php b/library/Zend/Feed/Reader/Feed/Atom.php index 839cdca6fc..fda53f7d00 100644 --- a/library/Zend/Feed/Reader/Feed/Atom.php +++ b/library/Zend/Feed/Reader/Feed/Atom.php @@ -394,7 +394,7 @@ protected function _indexEntries() { if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03) { - $entries = array(); + $entries = []; $entries = $this->_xpath->evaluate('//atom:entry'); foreach($entries as $index=>$entry) { diff --git a/library/Zend/Feed/Reader/Feed/Rss.php b/library/Zend/Feed/Reader/Feed/Rss.php index ab176246f0..6582aa7eb2 100644 --- a/library/Zend/Feed/Reader/Feed/Rss.php +++ b/library/Zend/Feed/Reader/Feed/Rss.php @@ -106,13 +106,13 @@ public function getAuthors() return $this->_data['authors']; } - $authors = array(); + $authors = []; $authors_dc = $this->getExtension('DublinCore')->getAuthors(); if (!empty($authors_dc)) { foreach ($authors_dc as $author) { - $authors[] = array( + $authors[] = [ 'name' => $author['name'] - ); + ]; } } @@ -131,7 +131,7 @@ public function getAuthors() $string = trim($author->nodeValue); $email = null; $name = null; - $data = array(); + $data = []; // Pretty rough parsing - but it's a catchall if (preg_match("/^.*@[^ ]*/", $string, $matches)) { $data['email'] = trim($matches[0]); @@ -230,8 +230,8 @@ public function getDateModified() if ($dateModifiedParsed) { $date = new Zend_Date($dateModifiedParsed); } else { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); + $dateStandards = [Zend_Date::RSS, Zend_Date::RFC_822, + Zend_Date::RFC_2822, Zend_Date::DATES]; $date = new Zend_Date; foreach ($dateStandards as $standard) { try { @@ -292,8 +292,8 @@ public function getLastBuildDate() if ($lastBuildDateParsed) { $date = new Zend_Date($lastBuildDateParsed); } else { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); + $dateStandards = [Zend_Date::RSS, Zend_Date::RFC_822, + Zend_Date::RFC_2822, Zend_Date::DATES]; $date = new Zend_Date; foreach ($dateStandards as $standard) { try { @@ -422,7 +422,7 @@ public function getImage() $prefix = '/rdf:RDF/rss:channel/rss:image[1]'; } if ($list->length > 0) { - $image = array(); + $image = []; $value = $this->_xpath->evaluate('string(' . $prefix . '/url)'); if ($value) { $image['uri'] = $value; @@ -674,11 +674,11 @@ public function getCategories() if ($list->length) { $categoryCollection = new Zend_Feed_Reader_Collection_Category; foreach ($list as $category) { - $categoryCollection[] = array( + $categoryCollection[] = [ 'term' => $category->nodeValue, 'scheme' => $category->getAttribute('domain'), 'label' => $category->nodeValue, - ); + ]; } } else { $categoryCollection = $this->getExtension('DublinCore')->getCategories(); @@ -699,7 +699,7 @@ public function getCategories() */ protected function _indexEntries() { - $entries = array(); + $entries = []; if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { $entries = $this->_xpath->evaluate('//item'); diff --git a/library/Zend/Feed/Reader/FeedAbstract.php b/library/Zend/Feed/Reader/FeedAbstract.php index 3426958fba..076184cd04 100644 --- a/library/Zend/Feed/Reader/FeedAbstract.php +++ b/library/Zend/Feed/Reader/FeedAbstract.php @@ -42,7 +42,7 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt * * @var array */ - protected $_data = array(); + protected $_data = []; /** * Parsed feed data in the shape of a DOMDocument @@ -56,7 +56,7 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt * * @var array */ - protected $_entries = array(); + protected $_entries = []; /** * A pointer for the iterator to keep track of the entries array @@ -77,7 +77,7 @@ abstract class Zend_Feed_Reader_FeedAbstract implements Zend_Feed_Reader_FeedInt * * @var array */ - protected $_extensions = array(); + protected $_extensions = []; /** * Original Source URI (set if imported from a URI) @@ -270,7 +270,7 @@ public function __call($method, $args) { foreach ($this->_extensions as $extension) { if (method_exists($extension, $method)) { - return call_user_func_array(array($extension, $method), $args); + return call_user_func_array([$extension, $method], $args); } } require_once 'Zend/Feed/Exception.php'; diff --git a/library/Zend/Feed/Reader/FeedSet.php b/library/Zend/Feed/Reader/FeedSet.php index 962ea765ee..6e51d0f594 100644 --- a/library/Zend/Feed/Reader/FeedSet.php +++ b/library/Zend/Feed/Reader/FeedSet.php @@ -74,11 +74,11 @@ public function addLinks(DOMNodeList $links, $uri) } elseif(!isset($this->rdf) && $link->getAttribute('type') == 'application/rdf+xml') { $this->rdf = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri); } - $this[] = new self(array( + $this[] = new self([ 'rel' => 'alternate', 'type' => $link->getAttribute('type'), 'href' => $this->_absolutiseUri(trim($link->getAttribute('href')), $uri), - )); + ]); } } @@ -110,7 +110,7 @@ protected function _absolutiseUri($link, $uri = null) protected function _canonicalizePath($path) { $parts = array_filter(explode('/', $path)); - $absolutes = array(); + $absolutes = []; foreach ($parts as $part) { if ('.' == $part) { continue; diff --git a/library/Zend/Feed/Writer.php b/library/Zend/Feed/Writer.php index 8eced7af38..f04b268f39 100644 --- a/library/Zend/Feed/Writer.php +++ b/library/Zend/Feed/Writer.php @@ -66,7 +66,7 @@ class Zend_Feed_Writer * * @var array */ - protected static $_prefixPaths = array(); + protected static $_prefixPaths = []; /** * Array of registered extensions by class postfix (after the base class @@ -75,12 +75,12 @@ class Zend_Feed_Writer * * @var array */ - protected static $_extensions = array( - 'entry' => array(), - 'feed' => array(), - 'entryRenderer' => array(), - 'feedRenderer' => array(), - ); + protected static $_extensions = [ + 'entry' => [], + 'feed' => [], + 'entryRenderer' => [], + 'feedRenderer' => [], + ]; /** * Set plugin loader for use with Extensions @@ -101,9 +101,9 @@ public static function getPluginLoader() { if (!isset(self::$_pluginLoader)) { require_once 'Zend/Loader/PluginLoader.php'; - self::$_pluginLoader = new Zend_Loader_PluginLoader(array( + self::$_pluginLoader = new Zend_Loader_PluginLoader([ 'Zend_Feed_Writer_Extension_' => 'Zend/Feed/Writer/Extension/', - )); + ]); } return self::$_pluginLoader; } @@ -233,13 +233,13 @@ public static function getExtensions() public static function reset() { self::$_pluginLoader = null; - self::$_prefixPaths = array(); - self::$_extensions = array( - 'entry' => array(), - 'feed' => array(), - 'entryRenderer' => array(), - 'feedRenderer' => array(), - ); + self::$_prefixPaths = []; + self::$_extensions = [ + 'entry' => [], + 'feed' => [], + 'entryRenderer' => [], + 'feedRenderer' => [], + ]; } /** diff --git a/library/Zend/Feed/Writer/Deleted.php b/library/Zend/Feed/Writer/Deleted.php index 77cf8c3a18..26c236bff7 100644 --- a/library/Zend/Feed/Writer/Deleted.php +++ b/library/Zend/Feed/Writer/Deleted.php @@ -35,7 +35,7 @@ class Zend_Feed_Writer_Deleted * * @var array */ - protected $_data = array(); + protected $_data = []; /** * Holds the value "atom" or "rss" depending on the feed type set when @@ -149,7 +149,7 @@ public function getWhen() public function setBy(array $by) { - $author = array(); + $author = []; if (!array_key_exists('name', $by) || empty($by['name']) || !is_string($by['name']) diff --git a/library/Zend/Feed/Writer/Entry.php b/library/Zend/Feed/Writer/Entry.php index f364e0bbe0..4207574675 100644 --- a/library/Zend/Feed/Writer/Entry.php +++ b/library/Zend/Feed/Writer/Entry.php @@ -45,14 +45,14 @@ class Zend_Feed_Writer_Entry * * @var array */ - protected $_data = array(); + protected $_data = []; /** * Registered extensions * * @var array */ - protected $_extensions = array(); + protected $_extensions = []; /** * Holds the value "atom" or "rss" depending on the feed type set when @@ -82,7 +82,7 @@ public function __construct() */ public function addAuthor($name, $email = null, $uri = null) { - $author = array(); + $author = []; if (is_array($name)) { if (!array_key_exists('name', $name) || empty($name['name']) @@ -327,13 +327,13 @@ public function setCommentFeedLink(array $link) require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); } - if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { + if (!isset($link['type']) || !in_array($link['type'], ['atom', 'rss', 'rdf'])) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "type" must be one' . ' of "atom", "rss" or "rdf"'); } if (!isset($this->_data['commentFeedLinks'])) { - $this->_data['commentFeedLinks'] = array(); + $this->_data['commentFeedLinks'] = []; } $this->_data['commentFeedLinks'][] = $link; } @@ -561,7 +561,7 @@ public function addCategory(array $category) } } if (!isset($this->_data['categories'])) { - $this->_data['categories'] = array(); + $this->_data['categories'] = []; } $this->_data['categories'][] = $category; } @@ -695,7 +695,7 @@ public function __call($method, $args) { foreach ($this->_extensions as $extension) { try { - return call_user_func_array(array($extension, $method), $args); + return call_user_func_array([$extension, $method], $args); } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { } } diff --git a/library/Zend/Feed/Writer/Extension/ITunes/Entry.php b/library/Zend/Feed/Writer/Extension/ITunes/Entry.php index 8f31597bd8..29d6cb250c 100644 --- a/library/Zend/Feed/Writer/Extension/ITunes/Entry.php +++ b/library/Zend/Feed/Writer/Extension/ITunes/Entry.php @@ -32,7 +32,7 @@ class Zend_Feed_Writer_Extension_ITunes_Entry * * @var array */ - protected $_data = array(); + protected $_data = []; /** * Encoding of all text values @@ -112,7 +112,7 @@ public function addItunesAuthor($value) . ' contain a maximum of 255 characters each'); } if (!isset($this->_data['authors'])) { - $this->_data['authors'] = array(); + $this->_data['authors'] = []; } $this->_data['authors'][] = $value; return $this; @@ -147,7 +147,7 @@ public function setItunesDuration($value) */ public function setItunesExplicit($value) { - if (!in_array($value, array('yes','no','clean'))) { + if (!in_array($value, ['yes','no','clean'])) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); diff --git a/library/Zend/Feed/Writer/Extension/ITunes/Feed.php b/library/Zend/Feed/Writer/Extension/ITunes/Feed.php index f3a733de70..9eb33ada9d 100644 --- a/library/Zend/Feed/Writer/Extension/ITunes/Feed.php +++ b/library/Zend/Feed/Writer/Extension/ITunes/Feed.php @@ -32,7 +32,7 @@ class Zend_Feed_Writer_Extension_ITunes_Feed * * @var array */ - protected $_data = array(); + protected $_data = []; /** * Encoding of all text values @@ -113,7 +113,7 @@ public function addItunesAuthor($value) . ' contain a maximum of 255 characters each'); } if (!isset($this->_data['authors'])) { - $this->_data['authors'] = array(); + $this->_data['authors'] = []; } $this->_data['authors'][] = $value; return $this; @@ -128,7 +128,7 @@ public function addItunesAuthor($value) public function setItunesCategories(array $values) { if (!isset($this->_data['categories'])) { - $this->_data['categories'] = array(); + $this->_data['categories'] = []; } foreach ($values as $key=>$value) { if (!is_array($value)) { @@ -144,7 +144,7 @@ public function setItunesCategories(array $values) throw new Zend_Feed_Exception('invalid parameter: any "category" may only' . ' contain a maximum of 255 characters each'); } - $this->_data['categories'][$key] = array(); + $this->_data['categories'][$key] = []; foreach ($value as $val) { if (iconv_strlen($val, $this->getEncoding()) > 255) { require_once 'Zend/Feed/Exception.php'; @@ -171,7 +171,7 @@ public function setItunesImage($value) throw new Zend_Feed_Exception('invalid parameter: "image" may only' . ' be a valid URI/IRI'); } - if (!in_array(substr($value, -3), array('jpg','png'))) { + if (!in_array(substr($value, -3), ['jpg','png'])) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "image" may only' . ' use file extension "jpg" or "png" which must be the last three' @@ -210,7 +210,7 @@ public function setItunesDuration($value) */ public function setItunesExplicit($value) { - if (!in_array($value, array('yes','no','clean'))) { + if (!in_array($value, ['yes','no','clean'])) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' . ' be one of "yes", "no" or "clean"'); @@ -295,7 +295,7 @@ public function addItunesOwner(array $value) . ' contain a maximum of 255 characters each for "name" and "email"'); } if (!isset($this->_data['owners'])) { - $this->_data['owners'] = array(); + $this->_data['owners'] = []; } $this->_data['owners'][] = $value; return $this; diff --git a/library/Zend/Feed/Writer/Feed.php b/library/Zend/Feed/Writer/Feed.php index c0c13636bf..554e494bec 100644 --- a/library/Zend/Feed/Writer/Feed.php +++ b/library/Zend/Feed/Writer/Feed.php @@ -71,7 +71,7 @@ class Zend_Feed_Writer_Feed extends Zend_Feed_Writer_Feed_FeedAbstract * * @var array */ - protected $_entries = array(); + protected $_entries = []; /** * A pointer for the iterator to keep track of the entries array @@ -181,7 +181,7 @@ public function orderByDate() * Could do with some improvement for performance perhaps */ $timestamp = time(); - $entries = array(); + $entries = []; foreach ($this->_entries as $entry) { if ($entry->getDateModified()) { $timestamp = (int) $entry->getDateModified()->get(Zend_Date::TIMESTAMP); diff --git a/library/Zend/Feed/Writer/Feed/FeedAbstract.php b/library/Zend/Feed/Writer/Feed/FeedAbstract.php index 2cdc9e3b3a..0f66052a3d 100644 --- a/library/Zend/Feed/Writer/Feed/FeedAbstract.php +++ b/library/Zend/Feed/Writer/Feed/FeedAbstract.php @@ -65,7 +65,7 @@ class Zend_Feed_Writer_Feed_FeedAbstract * * @var array */ - protected $_data = array(); + protected $_data = []; /** * Holds the value "atom" or "rss" depending on the feed type set when @@ -95,7 +95,7 @@ public function __construct() */ public function addAuthor($name, $email = null, $uri = null) { - $author = array(); + $author = []; if (is_array($name)) { if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { require_once 'Zend/Feed/Exception.php'; @@ -256,7 +256,7 @@ public function setGenerator($name, $version = null, $uri = null) require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); } - $generator = array('name' => $data['name']); + $generator = ['name' => $data['name']]; if (isset($data['version'])) { if (empty($data['version']) || !is_string($data['version'])) { require_once 'Zend/Feed/Exception.php'; @@ -276,7 +276,7 @@ public function setGenerator($name, $version = null, $uri = null) require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); } - $generator = array('name' => $name); + $generator = ['name' => $name]; if (isset($version)) { if (empty($version) || !is_string($version)) { require_once 'Zend/Feed/Exception.php'; @@ -419,7 +419,7 @@ public function setFeedLink($link, $type) require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); } - if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { + if (!in_array(strtolower($type), ['rss', 'rdf', 'atom'])) { require_once 'Zend/Feed/Exception.php'; throw new Zend_Feed_Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); } @@ -482,7 +482,7 @@ public function addHub($url) . ' must be a non-empty string and valid URI/IRI'); } if (!isset($this->_data['hubs'])) { - $this->_data['hubs'] = array(); + $this->_data['hubs'] = []; } $this->_data['hubs'][] = $url; } @@ -523,7 +523,7 @@ public function addCategory(array $category) } } if (!isset($this->_data['categories'])) { - $this->_data['categories'] = array(); + $this->_data['categories'] = []; } $this->_data['categories'][] = $category; } @@ -796,7 +796,7 @@ public function getCategories() */ public function reset() { - $this->_data = array(); + $this->_data = []; } /** @@ -845,7 +845,7 @@ public function __call($method, $args) { foreach ($this->_extensions as $extension) { try { - return call_user_func_array(array($extension, $method), $args); + return call_user_func_array([$extension, $method], $args); } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { } } diff --git a/library/Zend/Feed/Writer/Renderer/Entry/Atom.php b/library/Zend/Feed/Writer/Renderer/Entry/Atom.php index 02c2289608..388f765cd2 100644 --- a/library/Zend/Feed/Writer/Renderer/Entry/Atom.php +++ b/library/Zend/Feed/Writer/Renderer/Entry/Atom.php @@ -376,11 +376,11 @@ protected function _loadXhtml($content) $xhtml = ''; if (class_exists('tidy', false)) { $tidy = new tidy; - $config = array( + $config = [ 'output-xhtml' => true, 'show-body-only' => true, 'quote-nbsp' => false - ); + ]; $encoding = str_replace('-', '', $this->getEncoding()); $tidy->parseString($content, $config, $encoding); $tidy->cleanRepair(); @@ -388,9 +388,9 @@ protected function _loadXhtml($content) } else { $xhtml = $content; } - $xhtml = preg_replace(array( + $xhtml = preg_replace([ "/(<[\/]?)([a-zA-Z]+)/" - ), '$1xhtml:$2', $xhtml); + ], '$1xhtml:$2', $xhtml); $dom = new DOMDocument('1.0', $this->getEncoding()); $dom = Zend_Xml_Security::scan('' diff --git a/library/Zend/Feed/Writer/Renderer/RendererAbstract.php b/library/Zend/Feed/Writer/Renderer/RendererAbstract.php index 05a61bfdc1..2d659c5aab 100644 --- a/library/Zend/Feed/Writer/Renderer/RendererAbstract.php +++ b/library/Zend/Feed/Writer/Renderer/RendererAbstract.php @@ -37,7 +37,7 @@ class Zend_Feed_Writer_Renderer_RendererAbstract * Extensions * @var array */ - protected $_extensions = array(); + protected $_extensions = []; /** * @var mixed @@ -57,7 +57,7 @@ class Zend_Feed_Writer_Renderer_RendererAbstract /** * @var array */ - protected $_exceptions = array(); + protected $_exceptions = []; /** * Encoding of all text values diff --git a/library/Zend/File/Transfer.php b/library/Zend/File/Transfer.php index 28e15271a6..c492b7011c 100644 --- a/library/Zend/File/Transfer.php +++ b/library/Zend/File/Transfer.php @@ -39,7 +39,7 @@ class Zend_File_Transfer * * @var array */ - protected $_adapter = array(); + protected $_adapter = []; /** * Creates a file processing handler @@ -49,7 +49,7 @@ class Zend_File_Transfer * @param array $options OPTIONAL Options to set for this adapter * @throws Zend_File_Transfer_Exception */ - public function __construct($adapter = 'Http', $direction = false, $options = array()) + public function __construct($adapter = 'Http', $direction = false, $options = []) { $this->setAdapter($adapter, $direction, $options); } @@ -62,7 +62,7 @@ public function __construct($adapter = 'Http', $direction = false, $options = ar * @param array $options OPTIONAL Options to set for this adapter * @throws Zend_File_Transfer_Exception */ - public function setAdapter($adapter, $direction = false, $options = array()) + public function setAdapter($adapter, $direction = false, $options = []) { if (Zend_Loader::isReadable('Zend/File/Transfer/Adapter/' . ucfirst($adapter). '.php')) { $adapter = 'Zend_File_Transfer_Adapter_' . ucfirst($adapter); @@ -116,7 +116,7 @@ public function __call($method, array $options) } if (method_exists($this->_adapter[$direction], $method)) { - return call_user_func_array(array($this->_adapter[$direction], $method), $options); + return call_user_func_array([$this->_adapter[$direction], $method], $options); } require_once 'Zend/File/Transfer/Exception.php'; diff --git a/library/Zend/File/Transfer/Adapter/Abstract.php b/library/Zend/File/Transfer/Adapter/Abstract.php index 4e425509e1..af20749652 100644 --- a/library/Zend/File/Transfer/Adapter/Abstract.php +++ b/library/Zend/File/Transfer/Adapter/Abstract.php @@ -41,28 +41,28 @@ abstract class Zend_File_Transfer_Adapter_Abstract * * @var array */ - protected $_break = array(); + protected $_break = []; /** * Internal list of filters * * @var array */ - protected $_filters = array(); + protected $_filters = []; /** * Plugin loaders for filter and validation chains * * @var array */ - protected $_loaders = array(); + protected $_loaders = []; /** * Internal list of messages * * @var array */ - protected $_messages = array(); + protected $_messages = []; /** * @var Zend_Translate @@ -80,7 +80,7 @@ abstract class Zend_File_Transfer_Adapter_Abstract * Internal list of validators * @var array */ - protected $_validators = array(); + protected $_validators = []; /** * Internal list of files @@ -98,7 +98,7 @@ abstract class Zend_File_Transfer_Adapter_Abstract * * @var array */ - protected $_files = array(); + protected $_files = []; /** * TMP directory @@ -109,12 +109,12 @@ abstract class Zend_File_Transfer_Adapter_Abstract /** * Available options for file transfers */ - protected $_options = array( + protected $_options = [ 'ignoreNoFile' => false, 'useByteString' => true, 'magicFile' => null, 'detectInfos' => true, - ); + ]; /** * Send file @@ -216,10 +216,10 @@ public function getPluginLoader($type) $prefixSegment = ucfirst(strtolower($type)); $pathSegment = $prefixSegment; if (!isset($this->_loaders[$type])) { - $paths = array( + $paths = [ 'Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/', 'Zend_' . $prefixSegment . '_File' => 'Zend/' . $pathSegment . '/File', - ); + ]; require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader($paths); @@ -265,7 +265,7 @@ public function addPrefixPath($prefix, $path, $type = null) case null: $prefix = rtrim($prefix, '_'); $path = rtrim($path, DIRECTORY_SEPARATOR); - foreach (array(self::FILTER, self::VALIDATE) as $type) { + foreach ([self::FILTER, self::VALIDATE] as $type) { $cType = ucfirst(strtolower($type)); $pluginPath = $path . DIRECTORY_SEPARATOR . $cType . DIRECTORY_SEPARATOR; $pluginPrefix = $prefix . '_' . $cType; @@ -357,7 +357,7 @@ public function addValidator($validator, $breakChainOnFailure = false, $options foreach ($files as $file) { if ($name == 'NotEmpty') { $temp = $this->_files[$file]['validators']; - $this->_files[$file]['validators'] = array($name); + $this->_files[$file]['validators'] = [$name]; $this->_files[$file]['validators'] += $temp; } else { $this->_files[$file]['validators'][] = $name; @@ -390,7 +390,7 @@ public function addValidators(array $validators, $files = null) } else if (is_array($validatorInfo)) { $argc = count($validatorInfo); $breakChainOnFailure = false; - $options = array(); + $options = []; if (isset($validatorInfo['validator'])) { $validator = $validatorInfo['validator']; if (isset($validatorInfo['breakChainOnFailure'])) { @@ -488,7 +488,7 @@ public function getValidators($files = null) } $files = $this->_getFiles($files, true, true); - $validators = array(); + $validators = []; foreach ($files as $file) { if (!empty($this->_files[$file]['validators'])) { $validators += $this->_files[$file]['validators']; @@ -496,7 +496,7 @@ public function getValidators($files = null) } $validators = array_unique($validators); - $result = array(); + $result = []; foreach ($validators as $validator) { $result[$validator] = $this->_validators[$validator]; } @@ -541,9 +541,9 @@ public function removeValidator($name) */ public function clearValidators() { - $this->_validators = array(); + $this->_validators = []; foreach (array_keys($this->_files) as $file) { - $this->_files[$file]['validators'] = array(); + $this->_files[$file]['validators'] = []; $this->_files[$file]['validated'] = false; } @@ -557,7 +557,7 @@ public function clearValidators() * @param array $files (Optional) Files to set the options for * @return Zend_File_Transfer_Adapter_Abstract */ - public function setOptions($options = array(), $files = null) { + public function setOptions($options = [], $files = null) { $file = $this->_getFiles($files, false, true); if (is_array($options)) { @@ -602,7 +602,7 @@ public function getOptions($files = null) { if (isset($this->_files[$key]['options'])) { $options[$key] = $this->_files[$key]['options']; } else { - $options[$key] = array(); + $options[$key] = []; } } @@ -623,7 +623,7 @@ public function isValid($files = null) } $translator = $this->getTranslator(); - $this->_messages = array(); + $this->_messages = []; $break = false; foreach($check as $key => $content) { if (array_key_exists('validators', $content) && @@ -652,7 +652,7 @@ public function isValid($files = null) } foreach ($check as $key => $content) { - $fileerrors = array(); + $fileerrors = []; if (array_key_exists('validators', $content) && $content['validated']) { continue; } @@ -864,7 +864,7 @@ public function getFilters($files = null) } $files = $this->_getFiles($files, true, true); - $filters = array(); + $filters = []; foreach ($files as $file) { if (!empty($this->_files[$file]['filters'])) { $filters += $this->_files[$file]['filters']; @@ -872,7 +872,7 @@ public function getFilters($files = null) } $filters = array_unique($filters); - $result = array(); + $result = []; foreach ($filters as $filter) { $result[] = $this->_filters[$filter]; } @@ -915,9 +915,9 @@ public function removeFilter($name) */ public function clearFilters() { - $this->_filters = array(); + $this->_filters = []; foreach (array_keys($this->_files) as $file) { - $this->_files[$file]['filters'] = array(); + $this->_files[$file]['filters'] = []; } return $this; } @@ -944,7 +944,7 @@ public function getFile() public function getFileName($file = null, $path = true) { $files = $this->_getFiles($file, true, true); - $result = array(); + $result = []; $directory = ""; foreach($files as $file) { if (empty($this->_files[$file]['name'])) { @@ -1074,7 +1074,7 @@ public function getDestination($files = null) { $orig = $files; $files = $this->_getFiles($files, false, true); - $destinations = array(); + $destinations = []; if (empty($files) && is_string($orig)) { if (isset($this->_files[$orig]['destination'])) { $destinations[$orig] = $this->_files[$orig]['destination']; @@ -1178,7 +1178,7 @@ public function getHash($hash = 'crc32', $files = null) } $files = $this->_getFiles($files); - $result = array(); + $result = []; foreach($files as $key => $value) { if (file_exists($value['name'])) { $result[$key] = hash_file($hash, $value['name']); @@ -1207,7 +1207,7 @@ public function getHash($hash = 'crc32', $files = null) public function getFileSize($files = null) { $files = $this->_getFiles($files); - $result = array(); + $result = []; foreach($files as $key => $value) { if (file_exists($value['name']) || file_exists($value['tmp_name'])) { if ($value['options']['useByteString']) { @@ -1260,7 +1260,7 @@ protected function _detectFileSize($value) public function getMimeType($files = null) { $files = $this->_getFiles($files); - $result = array(); + $result = []; foreach($files as $key => $value) { if (file_exists($value['name']) || file_exists($value['tmp_name'])) { $result[$key] = $value['type']; @@ -1332,7 +1332,7 @@ protected function _detectMimeType($value) */ protected static function _toByteString($size) { - $sizes = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'); + $sizes = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; for ($i=0; $size >= 1024 && $i < 9; $i++) { $size /= 1024; } @@ -1359,7 +1359,7 @@ protected function _filter($files = null) $this->_files[$name]['destination'] = dirname($result); $this->_files[$name]['name'] = basename($result); } catch (Zend_Filter_Exception $e) { - $this->_messages += array($e->getMessage()); + $this->_messages += [$e->getMessage()]; } } } @@ -1381,7 +1381,7 @@ protected function _filter($files = null) protected function _getTmpDir() { if (null === $this->_tmpDir) { - $tmpdir = array(); + $tmpdir = []; if (function_exists('sys_get_temp_dir')) { $tmpdir[] = sys_get_temp_dir(); } @@ -1463,15 +1463,15 @@ protected function _isPathWriteable($path) */ protected function _getFiles($files, $names = false, $noexception = false) { - $check = array(); + $check = []; if (is_string($files)) { - $files = array($files); + $files = [$files]; } if (is_array($files)) { foreach ($files as $find) { - $found = array(); + $found = []; foreach ($this->_files as $file => $content) { if (!isset($content['name'])) { continue; @@ -1497,7 +1497,7 @@ protected function _getFiles($files, $names = false, $noexception = false) if (empty($found)) { if ($noexception !== false) { - return array(); + return []; } require_once 'Zend/File/Transfer/Exception.php'; diff --git a/library/Zend/File/Transfer/Adapter/Http.php b/library/Zend/File/Transfer/Adapter/Http.php index 28af6e5fef..015fef3aa9 100644 --- a/library/Zend/File/Transfer/Adapter/Http.php +++ b/library/Zend/File/Transfer/Adapter/Http.php @@ -42,7 +42,7 @@ class Zend_File_Transfer_Adapter_Http extends Zend_File_Transfer_Adapter_Abstrac * * @param array $options OPTIONAL Options to set */ - public function __construct($options = array()) + public function __construct($options = []) { if (ini_get('file_uploads') == false) { require_once 'Zend/File/Transfer/Exception.php'; @@ -135,9 +135,9 @@ public function isValid($files = null) $files = current($files); } - $temp = array($files => array( + $temp = [$files => [ 'name' => $files, - 'error' => 1)); + 'error' => 1]]; $validator = $this->_validators['Zend_Validate_File_Upload']; $validator->setFiles($temp) ->isValid($files, null); @@ -312,13 +312,13 @@ public static function getProgress($id = null) } $session = 'Zend_File_Transfer_Adapter_Http_ProgressBar'; - $status = array( + $status = [ 'total' => 0, 'current' => 0, 'rate' => 0, 'message' => '', 'done' => false - ); + ]; if (is_array($id)) { if (isset($id['progress'])) { @@ -434,7 +434,7 @@ public static function isUploadProgressAvailable() */ protected function _prepareFiles() { - $this->_files = array(); + $this->_files = []; foreach ($_FILES as $form => $content) { if (is_array($content['name'])) { foreach ($content as $param => $file) { diff --git a/library/Zend/Filter.php b/library/Zend/Filter.php index 1256ff9bd6..d0e393d187 100644 --- a/library/Zend/Filter.php +++ b/library/Zend/Filter.php @@ -41,14 +41,14 @@ class Zend_Filter implements Zend_Filter_Interface * * @var array */ - protected $_filters = array(); + protected $_filters = []; /** * Default Namespaces * * @var array */ - protected static $_defaultNamespaces = array(); + protected static $_defaultNamespaces = []; /** * Adds a filter to the chain @@ -135,7 +135,7 @@ public static function getDefaultNamespaces() public static function setDefaultNamespaces($namespace) { if (!is_array($namespace)) { - $namespace = array((string) $namespace); + $namespace = [(string) $namespace]; } self::$_defaultNamespaces = $namespace; @@ -150,7 +150,7 @@ public static function setDefaultNamespaces($namespace) public static function addDefaultNamespaces($namespace) { if (!is_array($namespace)) { - $namespace = array((string) $namespace); + $namespace = [(string) $namespace]; } self::$_defaultNamespaces = array_unique(array_merge(self::$_defaultNamespaces, $namespace)); @@ -177,7 +177,7 @@ public static function hasDefaultNamespaces() * @return mixed * @throws Zend_Filter_Exception */ - public static function get($value, $classBaseName, array $args = array(), $namespaces = array()) + public static function get($value, $classBaseName, array $args = [], $namespaces = []) { trigger_error( 'Zend_Filter::get() is deprecated as of 1.9.0; please update your code to utilize Zend_Filter::filterStatic()', @@ -204,10 +204,10 @@ public static function get($value, $classBaseName, array $args = array(), $names * @return mixed * @throws Zend_Filter_Exception */ - public static function filterStatic($value, $classBaseName, array $args = array(), $namespaces = array()) + public static function filterStatic($value, $classBaseName, array $args = [], $namespaces = []) { require_once 'Zend/Loader.php'; - $namespaces = array_merge((array) $namespaces, self::$_defaultNamespaces, array('Zend_Filter')); + $namespaces = array_merge((array) $namespaces, self::$_defaultNamespaces, ['Zend_Filter']); foreach ($namespaces as $namespace) { $className = $namespace . '_' . ucfirst($classBaseName); if (!class_exists($className, false)) { diff --git a/library/Zend/Filter/Alnum.php b/library/Zend/Filter/Alnum.php index 7455dafe45..8528f0c0d8 100644 --- a/library/Zend/Filter/Alnum.php +++ b/library/Zend/Filter/Alnum.php @@ -91,7 +91,7 @@ public function __construct($allowWhiteSpace = false) if (null === self::$_meansEnglishAlphabet) { $this->_locale = new Zend_Locale('auto'); self::$_meansEnglishAlphabet = in_array($this->_locale->getLanguage(), - array('ja', 'ko', 'zh') + ['ja', 'ko', 'zh'] ); } diff --git a/library/Zend/Filter/Alpha.php b/library/Zend/Filter/Alpha.php index 7374da1665..acbdc7d93c 100644 --- a/library/Zend/Filter/Alpha.php +++ b/library/Zend/Filter/Alpha.php @@ -91,7 +91,7 @@ public function __construct($allowWhiteSpace = false) if (null === self::$_meansEnglishAlphabet) { $this->_locale = new Zend_Locale('auto'); self::$_meansEnglishAlphabet = in_array($this->_locale->getLanguage(), - array('ja', 'ko', 'zh') + ['ja', 'ko', 'zh'] ); } diff --git a/library/Zend/Filter/Boolean.php b/library/Zend/Filter/Boolean.php index 165ee6dee8..789e53e21f 100644 --- a/library/Zend/Filter/Boolean.php +++ b/library/Zend/Filter/Boolean.php @@ -44,7 +44,7 @@ class Zend_Filter_Boolean implements Zend_Filter_Interface const YES = 256; const ALL = 511; - protected $_constants = array( + protected $_constants = [ self::BOOLEAN => 'boolean', self::INTEGER => 'integer', self::FLOAT => 'float', @@ -56,7 +56,7 @@ class Zend_Filter_Boolean implements Zend_Filter_Interface self::FALSE_STRING => 'false', self::YES => 'yes', self::ALL => 'all', - ); + ]; /** * Internal type to detect @@ -70,7 +70,7 @@ class Zend_Filter_Boolean implements Zend_Filter_Interface * * @var array */ - protected $_locale = array('auto'); + protected $_locale = ['auto']; /** * Internal mode @@ -90,7 +90,7 @@ public function __construct($options = null) $options = $options->toArray(); } elseif (!is_array($options)) { $options = func_get_args(); - $temp = array(); + $temp = []; if (!empty($options)) { $temp['type'] = array_shift($options); } @@ -182,9 +182,9 @@ public function getLocale() public function setLocale($locale = null) { if (is_string($locale)) { - $locale = array($locale); + $locale = [$locale]; } elseif ($locale instanceof Zend_Locale) { - $locale = array($locale->toString()); + $locale = [$locale->toString()]; } elseif (!is_array($locale)) { require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception('Locale has to be string, array or an instance of Zend_Locale'); @@ -281,7 +281,7 @@ public function filter($value) // EMPTY_ARRAY (array()) if ($type >= self::EMPTY_ARRAY) { $type -= self::EMPTY_ARRAY; - if (is_array($value) && ($value == array())) { + if (is_array($value) && ($value == [])) { return false; } } diff --git a/library/Zend/Filter/Callback.php b/library/Zend/Filter/Callback.php index f7961ea511..a01213109d 100644 --- a/library/Zend/Filter/Callback.php +++ b/library/Zend/Filter/Callback.php @@ -135,11 +135,11 @@ public function setOptions($options) */ public function filter($value) { - $options = array(); + $options = []; if ($this->_options !== null) { if (!is_array($this->_options)) { - $options = array($this->_options); + $options = [$this->_options]; } else { $options = $this->_options; } diff --git a/library/Zend/Filter/Compress.php b/library/Zend/Filter/Compress.php index e9361f7a43..469acc4af3 100644 --- a/library/Zend/Filter/Compress.php +++ b/library/Zend/Filter/Compress.php @@ -42,7 +42,7 @@ class Zend_Filter_Compress implements Zend_Filter_Interface /** * Compression adapter constructor options */ - protected $_adapterOptions = array(); + protected $_adapterOptions = []; /** * Class constructor @@ -179,7 +179,7 @@ public function __call($method, $options) throw new Zend_Filter_Exception("Unknown method '{$method}'"); } - return call_user_func_array(array($adapter, $method), $options); + return call_user_func_array([$adapter, $method], $options); } /** diff --git a/library/Zend/Filter/Compress/Bz2.php b/library/Zend/Filter/Compress/Bz2.php index 6bd4451f7b..a35b5b8f45 100644 --- a/library/Zend/Filter/Compress/Bz2.php +++ b/library/Zend/Filter/Compress/Bz2.php @@ -43,10 +43,10 @@ class Zend_Filter_Compress_Bz2 extends Zend_Filter_Compress_CompressAbstract * * @var array */ - protected $_options = array( + protected $_options = [ 'blocksize' => 4, 'archive' => null, - ); + ]; /** * Class constructor diff --git a/library/Zend/Filter/Compress/Gz.php b/library/Zend/Filter/Compress/Gz.php index 819795c5c9..e2c3fbf5c8 100644 --- a/library/Zend/Filter/Compress/Gz.php +++ b/library/Zend/Filter/Compress/Gz.php @@ -44,11 +44,11 @@ class Zend_Filter_Compress_Gz extends Zend_Filter_Compress_CompressAbstract * * @var array */ - protected $_options = array( + protected $_options = [ 'level' => 9, 'mode' => 'compress', 'archive' => null, - ); + ]; /** * Class constructor diff --git a/library/Zend/Filter/Compress/Rar.php b/library/Zend/Filter/Compress/Rar.php index 934cd03162..c1c6237c5e 100644 --- a/library/Zend/Filter/Compress/Rar.php +++ b/library/Zend/Filter/Compress/Rar.php @@ -45,12 +45,12 @@ class Zend_Filter_Compress_Rar extends Zend_Filter_Compress_CompressAbstract * * @var array */ - protected $_options = array( + protected $_options = [ 'callback' => null, 'archive' => null, 'password' => null, 'target' => '.', - ); + ]; /** * Class constructor @@ -111,7 +111,7 @@ public function getArchive() */ public function setArchive($archive) { - $archive = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $archive); + $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $archive); $this->_options['archive'] = (string) $archive; return $this; @@ -162,7 +162,7 @@ public function setTarget($target) throw new Zend_Filter_Exception("The directory '$target' does not exist"); } - $target = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $target); + $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $target); $this->_options['target'] = (string) $target; return $this; } @@ -203,7 +203,7 @@ public function decompress($content) { $archive = $this->getArchive(); if (file_exists($content)) { - $archive = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, realpath($content)); + $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); } elseif (empty($archive) || !file_exists($archive)) { require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception('RAR Archive not found'); diff --git a/library/Zend/Filter/Compress/Tar.php b/library/Zend/Filter/Compress/Tar.php index d2ce0d89a9..1817acef5e 100644 --- a/library/Zend/Filter/Compress/Tar.php +++ b/library/Zend/Filter/Compress/Tar.php @@ -43,11 +43,11 @@ class Zend_Filter_Compress_Tar extends Zend_Filter_Compress_CompressAbstract * * @var array */ - protected $_options = array( + protected $_options = [ 'archive' => null, 'target' => '.', 'mode' => null, - ); + ]; /** * Class constructor @@ -87,7 +87,7 @@ public function getArchive() */ public function setArchive($archive) { - $archive = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $archive); + $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $archive); $this->_options['archive'] = (string) $archive; return $this; @@ -116,7 +116,7 @@ public function setTarget($target) throw new Zend_Filter_Exception("The directory '$target' does not exist"); } - $target = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $target); + $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $target); $this->_options['target'] = (string) $target; return $this; } @@ -212,7 +212,7 @@ public function decompress($content) { $archive = $this->getArchive(); if (file_exists($content)) { - $archive = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, realpath($content)); + $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); } elseif (empty($archive) || !file_exists($archive)) { require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception('Tar Archive not found'); diff --git a/library/Zend/Filter/Compress/Zip.php b/library/Zend/Filter/Compress/Zip.php index 9c71a88444..c6a135a2b0 100644 --- a/library/Zend/Filter/Compress/Zip.php +++ b/library/Zend/Filter/Compress/Zip.php @@ -44,10 +44,10 @@ class Zend_Filter_Compress_Zip extends Zend_Filter_Compress_CompressAbstract * * @var array */ - protected $_options = array( + protected $_options = [ 'archive' => null, 'target' => null, - ); + ]; /** * Class constructor @@ -81,7 +81,7 @@ public function getArchive() */ public function setArchive($archive) { - $archive = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $archive); + $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $archive); $this->_options['archive'] = (string) $archive; return $this; @@ -110,7 +110,7 @@ public function setTarget($target) throw new Zend_Filter_Exception("The directory '$target' does not exist"); } - $target = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $target); + $target = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $target); $this->_options['target'] = (string) $target; return $this; } @@ -132,15 +132,15 @@ public function compress($content) } if (file_exists($content)) { - $content = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, realpath($content)); + $content = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); $basename = substr($content, strrpos($content, DIRECTORY_SEPARATOR) + 1); if (is_dir($content)) { $index = strrpos($content, DIRECTORY_SEPARATOR) + 1; $content .= DIRECTORY_SEPARATOR; - $stack = array($content); + $stack = [$content]; while (!empty($stack)) { $current = array_pop($stack); - $files = array(); + $files = []; $dir = dir($current); while (false !== ($node = $dir->read())) { @@ -204,7 +204,7 @@ public function decompress($content) { $archive = $this->getArchive(); if (file_exists($content)) { - $archive = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, realpath($content)); + $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); } elseif (empty($archive) || !file_exists($archive)) { require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception('ZIP Archive not found'); diff --git a/library/Zend/Filter/Encrypt.php b/library/Zend/Filter/Encrypt.php index f43c61cff5..6addb3777a 100644 --- a/library/Zend/Filter/Encrypt.php +++ b/library/Zend/Filter/Encrypt.php @@ -86,7 +86,7 @@ public function setAdapter($options = null) } if (!is_array($options)) { - $options = array(); + $options = []; } if (Zend_Loader::isReadable('Zend/Filter/Encrypt/' . ucfirst($adapter). '.php')) { @@ -120,7 +120,7 @@ public function __call($method, $options) throw new Zend_Filter_Exception("Unknown method '{$method}'"); } - return call_user_func_array(array($this->_adapter, $method), $options); + return call_user_func_array([$this->_adapter, $method], $options); } /** diff --git a/library/Zend/Filter/Encrypt/Mcrypt.php b/library/Zend/Filter/Encrypt/Mcrypt.php index 9b48de89e9..88906192e5 100644 --- a/library/Zend/Filter/Encrypt/Mcrypt.php +++ b/library/Zend/Filter/Encrypt/Mcrypt.php @@ -47,7 +47,7 @@ class Zend_Filter_Encrypt_Mcrypt implements Zend_Filter_Encrypt_Interface * 'modedirectory' => directory where to find the mode * ) */ - protected $_encryption = array( + protected $_encryption = [ 'key' => 'ZendFramework', 'algorithm' => 'blowfish', 'algorithm_directory' => '', @@ -55,7 +55,7 @@ class Zend_Filter_Encrypt_Mcrypt implements Zend_Filter_Encrypt_Interface 'mode_directory' => '', 'vector' => null, 'salt' => false - ); + ]; /** * Internal compression @@ -81,7 +81,7 @@ public function __construct($options) if ($options instanceof Zend_Config) { $options = $options->toArray(); } elseif (is_string($options)) { - $options = array('key' => $options); + $options = ['key' => $options]; } elseif (!is_array($options)) { require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception('Invalid options argument provided to filter'); @@ -114,7 +114,7 @@ public function getEncryption() public function setEncryption($options) { if (is_string($options)) { - $options = array('key' => $options); + $options = ['key' => $options]; } if (!is_array($options)) { @@ -214,7 +214,7 @@ public function getCompression() public function setCompression($compression) { if (is_string($this->_compression)) { - $compression = array('adapter' => $compression); + $compression = ['adapter' => $compression]; } $this->_compression = $compression; diff --git a/library/Zend/Filter/Encrypt/Openssl.php b/library/Zend/Filter/Encrypt/Openssl.php index 7d1f70bd0a..5b106e7ab9 100644 --- a/library/Zend/Filter/Encrypt/Openssl.php +++ b/library/Zend/Filter/Encrypt/Openssl.php @@ -42,11 +42,11 @@ class Zend_Filter_Encrypt_Openssl implements Zend_Filter_Encrypt_Interface * 'envelope' => resulting envelope keys * ) */ - protected $_keys = array( - 'public' => array(), - 'private' => array(), - 'envelope' => array() - ); + protected $_keys = [ + 'public' => [], + 'private' => [], + 'envelope' => [] + ]; /** * Internal passphrase @@ -81,7 +81,7 @@ class Zend_Filter_Encrypt_Openssl implements Zend_Filter_Encrypt_Interface * * @param string|array $options Options for this adapter */ - public function __construct($options = array()) + public function __construct($options = []) { if (!extension_loaded('openssl')) { require_once 'Zend/Filter/Exception.php'; @@ -93,7 +93,7 @@ public function __construct($options = array()) } if (!is_array($options)) { - $options = array('public' => $options); + $options = ['public' => $options]; } if (array_key_exists('passphrase', $options)) { @@ -196,7 +196,7 @@ public function setPublicKey($key) } } } else { - $key = array('public' => $key); + $key = ['public' => $key]; } return $this->_setKeys($key); @@ -230,7 +230,7 @@ public function setPrivateKey($key, $passphrase = null) } } } else { - $key = array('private' => $key); + $key = ['private' => $key]; } if ($passphrase !== null) { @@ -267,7 +267,7 @@ public function setEnvelopeKey($key) } } } else { - $key = array('envelope' => $key); + $key = ['envelope' => $key]; } return $this->_setKeys($key); @@ -314,7 +314,7 @@ public function getCompression() public function setCompression($compression) { if (is_string($this->_compression)) { - $compression = array('adapter' => $compression); + $compression = ['adapter' => $compression]; } $this->_compression = $compression; @@ -353,23 +353,23 @@ public function setPackage($package) */ public function encrypt($value) { - $encrypted = array(); - $encryptedkeys = array(); + $encrypted = []; + $encryptedkeys = []; if (count($this->_keys['public']) == 0) { require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception('Openssl can not encrypt without public keys'); } - $keys = array(); - $fingerprints = array(); + $keys = []; + $fingerprints = []; $count = -1; foreach($this->_keys['public'] as $key => $cert) { $keys[$key] = openssl_pkey_get_public($cert); if ($this->_package) { $details = openssl_pkey_get_details($keys[$key]); if ($details === false) { - $details = array('key' => 'ZendFramework'); + $details = ['key' => 'ZendFramework']; } ++$count; diff --git a/library/Zend/Filter/File/Rename.php b/library/Zend/Filter/File/Rename.php index fb0947b382..d15d0bdc0f 100644 --- a/library/Zend/Filter/File/Rename.php +++ b/library/Zend/Filter/File/Rename.php @@ -35,7 +35,7 @@ class Zend_Filter_File_Rename implements Zend_Filter_Interface /** * Internal array of array(source, target, overwrite) */ - protected $_files = array(); + protected $_files = []; /** * Class constructor @@ -56,7 +56,7 @@ public function __construct($options) if ($options instanceof Zend_Config) { $options = $options->toArray(); } elseif (is_string($options)) { - $options = array('target' => $options); + $options = ['target' => $options]; } elseif (!is_array($options)) { require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception('Invalid options argument provided to filter'); @@ -100,7 +100,7 @@ public function getFile() */ public function setFile($options) { - $this->_files = array(); + $this->_files = []; $this->addFile($options); return $this; @@ -120,7 +120,7 @@ public function setFile($options) public function addFile($options) { if (is_string($options)) { - $options = array('target' => $options); + $options = ['target' => $options]; } elseif (!is_array($options)) { require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception ('Invalid options to rename filter provided'); @@ -206,7 +206,7 @@ public function filter($value) * @return array */ protected function _convertOptions($options) { - $files = array(); + $files = []; foreach ($options as $key => $value) { if (is_array($value)) { $this->_convertOptions($value); @@ -272,7 +272,7 @@ protected function _convertOptions($options) { */ protected function _getFileName($file) { - $rename = array(); + $rename = []; foreach ($this->_files as $value) { if ($value['source'] == '*') { if (!isset($rename['source'])) { diff --git a/library/Zend/Filter/HtmlEntities.php b/library/Zend/Filter/HtmlEntities.php index 0c1dfecb95..11778a6a20 100644 --- a/library/Zend/Filter/HtmlEntities.php +++ b/library/Zend/Filter/HtmlEntities.php @@ -60,7 +60,7 @@ class Zend_Filter_HtmlEntities implements Zend_Filter_Interface * @param string $charSet * @return void */ - public function __construct($options = array()) + public function __construct($options = []) { if ($options instanceof Zend_Config) { $options = $options->toArray(); diff --git a/library/Zend/Filter/Inflector.php b/library/Zend/Filter/Inflector.php index 00eea7d64b..5d2633ad85 100644 --- a/library/Zend/Filter/Inflector.php +++ b/library/Zend/Filter/Inflector.php @@ -63,7 +63,7 @@ class Zend_Filter_Inflector implements Zend_Filter_Interface /** * @var array */ - protected $_rules = array(); + protected $_rules = []; /** * Constructor @@ -76,7 +76,7 @@ public function __construct($options = null) $options = $options->toArray(); } else if (!is_array($options)) { $options = func_get_args(); - $temp = array(); + $temp = []; if (!empty($options)) { $temp['target'] = array_shift($options); @@ -108,7 +108,7 @@ public function __construct($options = null) public function getPluginLoader() { if (!$this->_pluginLoader instanceof Zend_Loader_PluginLoader_Interface) { - $this->_pluginLoader = new Zend_Loader_PluginLoader(array('Zend_Filter_' => 'Zend/Filter/'), __CLASS__); + $this->_pluginLoader = new Zend_Loader_PluginLoader(['Zend_Filter_' => 'Zend/Filter/'], __CLASS__); } return $this->_pluginLoader; @@ -364,7 +364,7 @@ public function getRule($spec, $index) */ public function clearRules() { - $this->_rules = array(); + $this->_rules = []; return $this; } @@ -379,7 +379,7 @@ public function clearRules() public function setFilterRule($spec, $ruleSet) { $spec = $this->_normalizeSpec($spec); - $this->_rules[$spec] = array(); + $this->_rules[$spec] = []; return $this->addFilterRule($spec, $ruleSet); } @@ -394,16 +394,16 @@ public function addFilterRule($spec, $ruleSet) { $spec = $this->_normalizeSpec($spec); if (!isset($this->_rules[$spec])) { - $this->_rules[$spec] = array(); + $this->_rules[$spec] = []; } if (!is_array($ruleSet)) { - $ruleSet = array($ruleSet); + $ruleSet = [$ruleSet]; } if (is_string($this->_rules[$spec])) { $temp = $this->_rules[$spec]; - $this->_rules[$spec] = array(); + $this->_rules[$spec] = []; $this->_rules[$spec][] = $temp; } @@ -460,7 +460,7 @@ public function filter($source) } $pregQuotedTargetReplacementIdentifier = preg_quote($this->_targetReplacementIdentifier, '#'); - $processedParts = array(); + $processedParts = []; foreach ($this->_rules as $ruleName => $ruleValue) { if (isset($source[$ruleName])) { diff --git a/library/Zend/Filter/Input.php b/library/Zend/Filter/Input.php index 2e3dd04142..2e802b68c0 100644 --- a/library/Zend/Filter/Input.php +++ b/library/Zend/Filter/Input.php @@ -69,50 +69,50 @@ class Zend_Filter_Input /** * @var array Input data, before processing. */ - protected $_data = array(); + protected $_data = []; /** * @var array Association of rules to filters. */ - protected $_filterRules = array(); + protected $_filterRules = []; /** * @var array Association of rules to validators. */ - protected $_validatorRules = array(); + protected $_validatorRules = []; /** * @var array After processing data, this contains mapping of valid fields * to field values. */ - protected $_validFields = array(); + protected $_validFields = []; /** * @var array After processing data, this contains mapping of validation * rules that did not pass validation to the array of messages returned * by the validator chain. */ - protected $_invalidMessages = array(); + protected $_invalidMessages = []; /** * @var array After processing data, this contains mapping of validation * rules that did not pass validation to the array of error identifiers * returned by the validator chain. */ - protected $_invalidErrors = array(); + protected $_invalidErrors = []; /** * @var array After processing data, this contains mapping of validation * rules in which some fields were missing to the array of messages * indicating which fields were missing. */ - protected $_missingFields = array(); + protected $_missingFields = []; /** * @var array After processing, this contains a copy of $_data elements * that were not mentioned in any validation rule. */ - protected $_unknownFields = array(); + protected $_unknownFields = []; /** * @var Zend_Filter_Interface The filter object that is run on values @@ -124,19 +124,19 @@ class Zend_Filter_Input * Plugin loaders * @var array */ - protected $_loaders = array(); + protected $_loaders = []; /** * @var array Default values to use when processing filters and validators. */ - protected $_defaults = array( + protected $_defaults = [ self::ALLOW_EMPTY => false, self::BREAK_CHAIN => false, self::ESCAPE_FILTER => 'HtmlEntities', self::MISSING_MESSAGE => "Field '%field%' is required by rule '%rule%', but the field is missing", self::NOT_EMPTY_MESSAGE => "You must give a non-empty value for field '%field%'", self::PRESENCE => self::PRESENCE_OPTIONAL - ); + ]; /** * @var boolean Set to False initially, this is set to True after the @@ -184,7 +184,7 @@ public function __construct($filterRules, $validatorRules, array $data = null, a public function addNamespace($namespaces) { if (!is_array($namespaces)) { - $namespaces = array($namespaces); + $namespaces = [$namespaces]; } foreach ($namespaces as $namespace) { @@ -283,7 +283,7 @@ public function getPluginLoader($type) require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader( - array($prefixSegment => $pathSegment) + [$prefixSegment => $pathSegment] ); } @@ -486,11 +486,11 @@ public function setData(array $data) /** * Reset to initial state */ - $this->_validFields = array(); - $this->_invalidMessages = array(); - $this->_invalidErrors = array(); - $this->_missingFields = array(); - $this->_unknownFields = array(); + $this->_validFields = []; + $this->_invalidMessages = []; + $this->_invalidErrors = []; + $this->_missingFields = []; + $this->_unknownFields = []; $this->_processed = false; @@ -531,7 +531,7 @@ public function setOptions(array $options) break; case self::VALIDATOR_NAMESPACE: if(is_string($value)) { - $value = array($value); + $value = [$value]; } foreach($value AS $prefix) { @@ -543,7 +543,7 @@ public function setOptions(array $options) break; case self::FILTER_NAMESPACE: if(is_string($value)) { - $value = array($value); + $value = [$value]; } foreach($value AS $prefix) { @@ -653,14 +653,14 @@ protected function _filter() * Don't typecast to (array) because it might be a Zend_Filter object */ if (!is_array($filterRule)) { - $filterRule = array($filterRule); + $filterRule = [$filterRule]; } /** * Filters are indexed by integer, metacommands are indexed by string. * Pick out the filters. */ - $filterList = array(); + $filterList = []; foreach ($filterRule as $key => $value) { if (is_int($key)) { $filterList[] = $value; @@ -695,7 +695,7 @@ protected function _filter() */ if ($ruleName == self::RULE_WILDCARD) { foreach (array_keys($this->_data) as $field) { - $this->_filterRule(array_merge($filterRule, array(self::FIELDS => $field))); + $this->_filterRule(array_merge($filterRule, [self::FIELDS => $field])); } } else { $this->_filterRule($filterRule); @@ -798,7 +798,7 @@ protected function _validate() */ if (!$this->_validatorRules) { $this->_validFields = $this->_data; - $this->_data = array(); + $this->_data = []; return; } @@ -811,14 +811,14 @@ protected function _validate() * Don't typecast to (array) because it might be a Zend_Validate object */ if (!is_array($validatorRule)) { - $validatorRule = array($validatorRule); + $validatorRule = [$validatorRule]; } /** * Validators are indexed by integer, metacommands are indexed by string. * Pick out the validators. */ - $validatorList = array(); + $validatorList = []; foreach ($validatorRule as $key => $value) { if (is_int($key)) { $validatorList[$key] = $value; @@ -882,16 +882,16 @@ protected function _validate() } if (!isset($validatorRule[self::MESSAGES])) { - $validatorRule[self::MESSAGES] = array(); + $validatorRule[self::MESSAGES] = []; } else if (!is_array($validatorRule[self::MESSAGES])) { - $validatorRule[self::MESSAGES] = array($validatorRule[self::MESSAGES]); + $validatorRule[self::MESSAGES] = [$validatorRule[self::MESSAGES]]; } else if (array_intersect_key($validatorList, $validatorRule[self::MESSAGES])) { // this seems pointless... it just re-adds what it already has... // I can disable all this and not a single unit test fails... // There are now corresponding numeric keys in the validation rule messages array // Treat it as a named messages list for all rule validators $unifiedMessages = $validatorRule[self::MESSAGES]; - $validatorRule[self::MESSAGES] = array(); + $validatorRule[self::MESSAGES] = []; foreach ($validatorList as $key => $validator) { if (array_key_exists($key, $unifiedMessages)) { @@ -946,7 +946,7 @@ protected function _validate() */ if ($ruleName == self::RULE_WILDCARD) { foreach (array_keys($this->_data) as $field) { - $this->_validateRule(array_merge($validatorRule, array(self::FIELDS => $field))); + $this->_validateRule(array_merge($validatorRule, [self::FIELDS => $field])); } } else { $this->_validateRule($validatorRule); @@ -988,7 +988,7 @@ protected function _validateRule(array $validatorRule) * Get one or more data values from input, and check for missing fields. * Apply defaults if fields are missing. */ - $data = array(); + $data = []; foreach ((array) $validatorRule[self::FIELDS] as $key => $field) { if (array_key_exists($field, $this->_data)) { $data[$field] = $this->_data[$field]; @@ -1027,8 +1027,8 @@ protected function _validateRule(array $validatorRule) if (count((array) $validatorRule[self::FIELDS]) > 1) { if (!$validatorRule[self::ALLOW_EMPTY]) { $emptyFieldsFound = false; - $errorsList = array(); - $messages = array(); + $errorsList = []; + $messages = []; foreach ($data as $fieldKey => $field) { // if there is no Zend_Validate_NotEmpty instance in the rules, we will use the default @@ -1070,7 +1070,7 @@ protected function _validateRule(array $validatorRule) $failed = false; if (!is_array($field)) { - $field = array($field); + $field = [$field]; } // if there is no Zend_Validate_NotEmpty instance in the rules, we will use the default @@ -1097,7 +1097,7 @@ protected function _validateRule(array $validatorRule) if (isset($this->_invalidMessages[$validatorRule[self::RULE]])) { $collectedMessages = $this->_invalidMessages[$validatorRule[self::RULE]]; } else { - $collectedMessages = array(); + $collectedMessages = []; } foreach ($validatorChain->getMessages() as $messageKey => $message) { @@ -1180,7 +1180,7 @@ protected function _getValidator($classBaseName) */ protected function _getFilterOrValidator($type, $classBaseName) { - $args = array(); + $args = []; if (is_array($classBaseName)) { $args = $classBaseName; diff --git a/library/Zend/Filter/LocalizedToNormalized.php b/library/Zend/Filter/LocalizedToNormalized.php index 8e83321542..a1219906c9 100644 --- a/library/Zend/Filter/LocalizedToNormalized.php +++ b/library/Zend/Filter/LocalizedToNormalized.php @@ -43,11 +43,11 @@ class Zend_Filter_LocalizedToNormalized implements Zend_Filter_Interface * Set options * @var array */ - protected $_options = array( + protected $_options = [ 'locale' => null, 'date_format' => null, 'precision' => null - ); + ]; /** * Class constructor diff --git a/library/Zend/Filter/NormalizedToLocalized.php b/library/Zend/Filter/NormalizedToLocalized.php index 60dbb9e065..0f3d807d53 100644 --- a/library/Zend/Filter/NormalizedToLocalized.php +++ b/library/Zend/Filter/NormalizedToLocalized.php @@ -42,11 +42,11 @@ class Zend_Filter_NormalizedToLocalized implements Zend_Filter_Interface /** * Set options */ - protected $_options = array( + protected $_options = [ 'locale' => null, 'date_format' => null, 'precision' => null - ); + ]; /** * Class constructor diff --git a/library/Zend/Filter/Null.php b/library/Zend/Filter/Null.php index c798800416..8cb5122b7d 100644 --- a/library/Zend/Filter/Null.php +++ b/library/Zend/Filter/Null.php @@ -39,14 +39,14 @@ class Zend_Filter_Null implements Zend_Filter_Interface const ZERO = 16; const ALL = 31; - protected $_constants = array( + protected $_constants = [ self::BOOLEAN => 'boolean', self::INTEGER => 'integer', self::EMPTY_ARRAY => 'array', self::STRING => 'string', self::ZERO => 'zero', self::ALL => 'all' - ); + ]; /** * Internal type to detect @@ -66,7 +66,7 @@ public function __construct($options = null) $options = $options->toArray(); } else if (!is_array($options)) { $options = func_get_args(); - $temp = array(); + $temp = []; if (!empty($options)) { $temp = array_shift($options); } @@ -157,7 +157,7 @@ public function filter($value) // EMPTY_ARRAY (array()) if ($type >= self::EMPTY_ARRAY) { $type -= self::EMPTY_ARRAY; - if (is_array($value) && ($value == array())) { + if (is_array($value) && ($value == [])) { return null; } } diff --git a/library/Zend/Filter/PregReplace.php b/library/Zend/Filter/PregReplace.php index 7100c3717d..cbfd741a5f 100644 --- a/library/Zend/Filter/PregReplace.php +++ b/library/Zend/Filter/PregReplace.php @@ -90,7 +90,7 @@ public function __construct($options = null) $options = $options->toArray(); } else if (!is_array($options)) { $options = func_get_args(); - $temp = array(); + $temp = []; if (!empty($options)) { $temp['match'] = array_shift($options); } diff --git a/library/Zend/Filter/RealPath.php b/library/Zend/Filter/RealPath.php index 00881de5f5..8137c0ec6f 100644 --- a/library/Zend/Filter/RealPath.php +++ b/library/Zend/Filter/RealPath.php @@ -117,7 +117,7 @@ public function filter($value) $path = getcwd() . DIRECTORY_SEPARATOR . $path; } - $stack = array(); + $stack = []; $parts = explode(DIRECTORY_SEPARATOR, $path); foreach ($parts as $dir) { if (strlen($dir) && $dir !== '.') { diff --git a/library/Zend/Filter/StringToLower.php b/library/Zend/Filter/StringToLower.php index b208cfe77a..8acf724ca5 100644 --- a/library/Zend/Filter/StringToLower.php +++ b/library/Zend/Filter/StringToLower.php @@ -50,7 +50,7 @@ public function __construct($options = null) $options = $options->toArray(); } else if (!is_array($options)) { $options = func_get_args(); - $temp = array(); + $temp = []; if (!empty($options)) { $temp['encoding'] = array_shift($options); } diff --git a/library/Zend/Filter/StringToUpper.php b/library/Zend/Filter/StringToUpper.php index 8fe362055f..864acea961 100644 --- a/library/Zend/Filter/StringToUpper.php +++ b/library/Zend/Filter/StringToUpper.php @@ -50,7 +50,7 @@ public function __construct($options = null) $options = $options->toArray(); } else if (!is_array($options)) { $options = func_get_args(); - $temp = array(); + $temp = []; if (!empty($options)) { $temp['encoding'] = array_shift($options); } diff --git a/library/Zend/Filter/StringTrim.php b/library/Zend/Filter/StringTrim.php index 4f86d89e2c..f7923964ac 100644 --- a/library/Zend/Filter/StringTrim.php +++ b/library/Zend/Filter/StringTrim.php @@ -113,8 +113,8 @@ public function filter($value) protected function _unicodeTrim($value, $charlist = '\\\\s') { $chars = preg_replace( - array( '/[\^\-\]\\\]/S', '/\\\{4}/S', '/\//'), - array( '\\\\\\0', '\\', '\/' ), + [ '/[\^\-\]\\\]/S', '/\\\{4}/S', '/\//'], + [ '\\\\\\0', '\\', '\/' ], $charlist ); diff --git a/library/Zend/Filter/StripNewlines.php b/library/Zend/Filter/StripNewlines.php index 667c6aae24..fe06511bc1 100644 --- a/library/Zend/Filter/StripNewlines.php +++ b/library/Zend/Filter/StripNewlines.php @@ -43,6 +43,6 @@ class Zend_Filter_StripNewlines implements Zend_Filter_Interface */ public function filter ($value) { - return str_replace(array("\n", "\r"), '', $value); + return str_replace(["\n", "\r"], '', $value); } } diff --git a/library/Zend/Filter/StripTags.php b/library/Zend/Filter/StripTags.php index e1e1935e60..6f181904ac 100644 --- a/library/Zend/Filter/StripTags.php +++ b/library/Zend/Filter/StripTags.php @@ -59,7 +59,7 @@ class Zend_Filter_StripTags implements Zend_Filter_Interface * * @var array */ - protected $_tagsAllowed = array(); + protected $_tagsAllowed = []; /** * Array of allowed attributes for all allowed tags @@ -68,7 +68,7 @@ class Zend_Filter_StripTags implements Zend_Filter_Interface * * @var array */ - protected $_attributesAllowed = array(); + protected $_attributesAllowed = []; /** * Sets the filter options @@ -159,7 +159,7 @@ public function getTagsAllowed() public function setTagsAllowed($tagsAllowed) { if (!is_array($tagsAllowed)) { - $tagsAllowed = array($tagsAllowed); + $tagsAllowed = [$tagsAllowed]; } foreach ($tagsAllowed as $index => $element) { @@ -168,7 +168,7 @@ public function setTagsAllowed($tagsAllowed) // Canonicalize the tag name $tagName = strtolower($element); // Store the tag as allowed with no attributes - $this->_tagsAllowed[$tagName] = array(); + $this->_tagsAllowed[$tagName] = []; } // Otherwise, if a tag was provided with attributes else if (is_string($index) && (is_array($element) || is_string($element))) { @@ -176,10 +176,10 @@ public function setTagsAllowed($tagsAllowed) $tagName = strtolower($index); // Canonicalize the attributes if (is_string($element)) { - $element = array($element); + $element = [$element]; } // Store the tag as allowed with the provided attributes - $this->_tagsAllowed[$tagName] = array(); + $this->_tagsAllowed[$tagName] = []; foreach ($element as $attribute) { if (is_string($attribute)) { // Canonicalize the attribute name @@ -212,7 +212,7 @@ public function getAttributesAllowed() public function setAttributesAllowed($attributesAllowed) { if (!is_array($attributesAllowed)) { - $attributesAllowed = array($attributesAllowed); + $attributesAllowed = [$attributesAllowed]; } // Store each attribute as allowed diff --git a/library/Zend/Filter/Word/CamelCaseToSeparator.php b/library/Zend/Filter/Word/CamelCaseToSeparator.php index bea4b6612c..35c622b8f2 100644 --- a/library/Zend/Filter/Word/CamelCaseToSeparator.php +++ b/library/Zend/Filter/Word/CamelCaseToSeparator.php @@ -36,11 +36,11 @@ class Zend_Filter_Word_CamelCaseToSeparator extends Zend_Filter_Word_Separator_A public function filter($value) { if (self::isUnicodeSupportEnabled()) { - parent::setMatchPattern(array('#(?<=(?:\p{Lu}))(\p{Lu}\p{Ll})#','#(?<=(?:\p{Ll}|\p{Nd}))(\p{Lu})#')); - parent::setReplacement(array($this->_separator . '\1', $this->_separator . '\1')); + parent::setMatchPattern(['#(?<=(?:\p{Lu}))(\p{Lu}\p{Ll})#','#(?<=(?:\p{Ll}|\p{Nd}))(\p{Lu})#']); + parent::setReplacement([$this->_separator . '\1', $this->_separator . '\1']); } else { - parent::setMatchPattern(array('#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#', '#(?<=(?:[a-z0-9]))([A-Z])#')); - parent::setReplacement(array('\1' . $this->_separator . '\2', $this->_separator . '\1')); + parent::setMatchPattern(['#(?<=(?:[A-Z]))([A-Z]+)([A-Z][A-z])#', '#(?<=(?:[a-z0-9]))([A-Z])#']); + parent::setReplacement(['\1' . $this->_separator . '\2', $this->_separator . '\1']); } return parent::filter($value); diff --git a/library/Zend/Filter/Word/SeparatorToCamelCase.php b/library/Zend/Filter/Word/SeparatorToCamelCase.php index ae6f003c0c..d0c7d76965 100644 --- a/library/Zend/Filter/Word/SeparatorToCamelCase.php +++ b/library/Zend/Filter/Word/SeparatorToCamelCase.php @@ -39,11 +39,11 @@ public function filter($value) $pregQuotedSeparator = preg_quote($this->_separator, '#'); if (self::isUnicodeSupportEnabled()) { - parent::setMatchPattern(array('#('.$pregQuotedSeparator.')(\p{L}{1})#','#(^\p{Ll}{1})#')); - parent::setReplacement(array('Zend_Filter_Word_SeparatorToCamelCase', '_strtoupperArray')); + parent::setMatchPattern(['#('.$pregQuotedSeparator.')(\p{L}{1})#','#(^\p{Ll}{1})#']); + parent::setReplacement(['Zend_Filter_Word_SeparatorToCamelCase', '_strtoupperArray']); } else { - parent::setMatchPattern(array('#('.$pregQuotedSeparator.')([A-Za-z]{1})#','#(^[A-Za-z]{1})#')); - parent::setReplacement(array('Zend_Filter_Word_SeparatorToCamelCase', '_strtoupperArray')); + parent::setMatchPattern(['#('.$pregQuotedSeparator.')([A-Za-z]{1})#','#(^[A-Za-z]{1})#']); + parent::setReplacement(['Zend_Filter_Word_SeparatorToCamelCase', '_strtoupperArray']); } return preg_replace_callback($this->_matchPattern, $this->_replacement, $value); diff --git a/library/Zend/Form.php b/library/Zend/Form.php index f16b05f547..34cbf467a2 100644 --- a/library/Zend/Form.php +++ b/library/Zend/Form.php @@ -59,13 +59,13 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * Form metadata and attributes * @var array */ - protected $_attribs = array(); + protected $_attribs = []; /** * Decorators for rendering * @var array */ - protected $_decorators = array(); + protected $_decorators = []; /** * Default display group class @@ -89,13 +89,13 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * Display group prefix paths * @var array */ - protected $_displayGroupPrefixPaths = array(); + protected $_displayGroupPrefixPaths = []; /** * Groups of elements grouped for display purposes * @var array */ - protected $_displayGroups = array(); + protected $_displayGroups = []; /** * Global decorators to apply to all elements @@ -107,13 +107,13 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * Prefix paths to use when creating elements * @var array */ - protected $_elementPrefixPaths = array(); + protected $_elementPrefixPaths = []; /** * Form elements * @var array */ - protected $_elements = array(); + protected $_elements = []; /** * Array to which elements belong (if any) @@ -125,7 +125,7 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * Custom form-level error messages * @var array */ - protected $_errorMessages = array(); + protected $_errorMessages = []; /** * Are there errors in the form? @@ -161,19 +161,19 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * Plugin loaders * @var array */ - protected $_loaders = array(); + protected $_loaders = []; /** * Allowed form methods * @var array */ - protected $_methods = array('delete', 'get', 'post', 'put'); + protected $_methods = ['delete', 'get', 'post', 'put']; /** * Order in which to display and iterate elements * @var array */ - protected $_order = array(); + protected $_order = []; /** * Whether internal order has been updated or not @@ -185,13 +185,13 @@ class Zend_Form implements Iterator, Countable, Zend_Validate_Interface * Sub form prefix paths * @var array */ - protected $_subFormPrefixPaths = array(); + protected $_subFormPrefixPaths = []; /** * Sub forms * @var array */ - protected $_subForms = array(); + protected $_subForms = []; /** * @var Zend_Translate @@ -248,23 +248,23 @@ public function __construct($options = null) */ public function __clone() { - $elements = array(); + $elements = []; foreach ($this->getElements() as $name => $element) { $elements[] = clone $element; } $this->setElements($elements); - $subForms = array(); + $subForms = []; foreach ($this->getSubForms() as $name => $subForm) { $subForms[$name] = clone $subForm; } $this->setSubForms($subForms); - $displayGroups = array(); + $displayGroups = []; foreach ($this->_displayGroups as $group) { /** @var Zend_Form_DisplayGroup $clone */ $clone = clone $group; - $elements = array(); + $elements = []; foreach ($clone->getElements() as $name => $e) { $elements[] = $this->getElement($name); } @@ -360,10 +360,10 @@ public function setOptions(array $options) unset($options['subForms']); } - $forbidden = array( + $forbidden = [ 'Options', 'Config', 'PluginLoader', 'SubForms', 'Translator', 'Attrib', 'Default', - ); + ]; foreach ($options as $key => $value) { $normalized = ucfirst($key); @@ -463,7 +463,7 @@ public function getPluginLoader($type = null) require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader( - array('Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/') + ['Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/'] ); } @@ -506,7 +506,7 @@ public function addPrefixPath($prefix, $path, $type = null) $nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_'; $prefix = rtrim($prefix, $nsSeparator); $path = rtrim($path, DIRECTORY_SEPARATOR); - foreach (array(self::DECORATOR, self::ELEMENT) as $type) { + foreach ([self::DECORATOR, self::ELEMENT] as $type) { $cType = ucfirst(strtolower($type)); $pluginPath = $path . DIRECTORY_SEPARATOR . $cType . DIRECTORY_SEPARATOR; $pluginPrefix = $prefix . $nsSeparator . $cType; @@ -560,11 +560,11 @@ public function addPrefixPaths(array $spec) */ public function addElementPrefixPath($prefix, $path, $type = null) { - $this->_elementPrefixPaths[] = array( + $this->_elementPrefixPaths[] = [ 'prefix' => $prefix, 'path' => $path, 'type' => $type, - ); + ]; /** @var Zend_Form_Element $element */ foreach ($this->getElements() as $element) { @@ -606,10 +606,10 @@ public function addElementPrefixPaths(array $spec) */ public function addDisplayGroupPrefixPath($prefix, $path) { - $this->_displayGroupPrefixPaths[] = array( + $this->_displayGroupPrefixPaths[] = [ 'prefix' => $prefix, 'path' => $path, - ); + ]; /** @var Zend_Form_DisplayGroup $group */ foreach ($this->getDisplayGroups() as $group) { @@ -749,7 +749,7 @@ public function removeAttrib($key) */ public function clearAttribs() { - $this->_attribs = array(); + $this->_attribs = []; return $this; } @@ -920,7 +920,7 @@ public function getId() $id = substr($id, 0, strlen($id) - 2); } $id = str_replace('][', '-', $id); - $id = str_replace(array(']', '['), '-', $id); + $id = str_replace([']', '['], '-', $id); $id = trim($id, '-'); return $id; @@ -1042,7 +1042,7 @@ public function addElement($element, $name = null, $options = null) $this->_elements[$name] = $this->createElement($element, $name, $options); } elseif ($element instanceof Zend_Form_Element) { - $prefixPaths = array(); + $prefixPaths = []; $prefixPaths['decorator'] = $this->getPluginLoader('decorator')->getPaths(); if (!empty($this->_elementPrefixPaths)) { $prefixPaths = array_merge($prefixPaths, $this->_elementPrefixPaths); @@ -1100,7 +1100,7 @@ public function createElement($type, $name, $options = null) throw new Zend_Form_Exception('Element name must be a string'); } - $prefixPaths = array(); + $prefixPaths = []; $prefixPaths['decorator'] = $this->getPluginLoader('decorator')->getPaths(); if (!empty($this->_elementPrefixPaths)) { $prefixPaths = array_merge($prefixPaths, $this->_elementPrefixPaths); @@ -1111,7 +1111,7 @@ public function createElement($type, $name, $options = null) } if ((null === $options) || !is_array($options)) { - $options = array('prefixPath' => $prefixPaths); + $options = ['prefixPath' => $prefixPaths]; if (is_array($this->_elementDecorators)) { $options['decorators'] = $this->_elementDecorators; @@ -1157,7 +1157,7 @@ public function addElements(array $elements) if (is_array($spec)) { $argc = count($spec); - $options = array(); + $options = []; if (isset($spec['type'])) { $type = $spec['type']; if (isset($spec['name'])) { @@ -1268,7 +1268,7 @@ public function clearElements() unset($this->_order[$key]); } } - $this->_elements = array(); + $this->_elements = []; $this->_orderUpdated = true; return $this; } @@ -1369,7 +1369,7 @@ public function getValue($name) */ public function getValues($suppressArrayNotation = false) { - $values = array(); + $values = []; $eBelongTo = null; if ($this->isArray()) { @@ -1378,7 +1378,7 @@ public function getValues($suppressArrayNotation = false) /** @var Zend_Form_Element $element */ foreach ($this->getElements() as $key => $element) { if (!$element->getIgnore()) { - $merge = array(); + $merge = []; if (($belongsTo = $element->getBelongsTo()) !== $eBelongTo) { if ('' !== (string)$belongsTo) { $key = $belongsTo . '[' . $key . ']'; @@ -1390,7 +1390,7 @@ public function getValues($suppressArrayNotation = false) } /** @var Zend_Form_SubForm $subForm */ foreach ($this->getSubForms() as $key => $subForm) { - $merge = array(); + $merge = []; if (!$subForm->isArray()) { $merge[$key] = $subForm->getValues(); } else { @@ -1422,7 +1422,7 @@ public function getValues($suppressArrayNotation = false) */ public function getValidValues($data, $suppressArrayNotation = false) { - $values = array(); + $values = []; $eBelongTo = null; if ($this->isArray()) { @@ -1439,7 +1439,7 @@ public function getValidValues($data, $suppressArrayNotation = false) } if (isset($check[$key])) { if($element->isValid($check[$key], $context)) { - $merge = array(); + $merge = []; if ($belongsTo !== $eBelongTo && '' !== (string)$belongsTo) { $key = $belongsTo . '[' . $key . ']'; } @@ -1452,7 +1452,7 @@ public function getValidValues($data, $suppressArrayNotation = false) } /** @var Zend_Form_SubForm $form */ foreach ($this->getSubForms() as $key => $form) { - $merge = array(); + $merge = []; if (isset($data[$key]) && !$form->isArray()) { $tmp = $form->getValidValues($data[$key]); if (!empty($tmp)) { @@ -1497,7 +1497,7 @@ public function getUnfilteredValue($name) */ public function getUnfilteredValues() { - $values = array(); + $values = []; /** @var Zend_Form_Element $element */ foreach ($this->getElements() as $key => $element) { $values[$key] = $element->getUnfilteredValue(); @@ -1776,7 +1776,7 @@ public function clearSubForms() unset($this->_order[$key]); } } - $this->_subForms = array(); + $this->_subForms = []; $this->_orderUpdated = true; return $this; } @@ -1821,7 +1821,7 @@ public function getDefaultDisplayGroupClass() */ public function addDisplayGroup(array $elements, $name, $options = null) { - $group = array(); + $group = []; foreach ($elements as $element) { if($element instanceof Zend_Form_Element) { $elementName = $element->getName(); @@ -1853,10 +1853,10 @@ public function addDisplayGroup(array $elements, $name, $options = null) $options['form'] = $this; $options['elements'] = $group; } else { - $options = array( + $options = [ 'form' => $this, 'elements' => $group, - ); + ]; } if (isset($options['displayGroupClass'])) { @@ -1938,7 +1938,7 @@ public function addDisplayGroups(array $groups) } $argc = count($spec); - $options = array(); + $options = []; if (isset($spec['elements'])) { $elements = $spec['elements']; @@ -2061,7 +2061,7 @@ public function clearDisplayGroups() $this->_order[$name] = $element->getOrder(); } } - $this->_displayGroups = array(); + $this->_displayGroups = []; $this->_orderUpdated = true; return $this; } @@ -2156,8 +2156,8 @@ protected function _dissolveArrayValue($value, $arrayPath) protected function _dissolveArrayUnsetKey($array, $arrayPath, $key) { $unset =& $array; - $path = trim(strtr((string)$arrayPath, array('[' => '/', ']' => '')), '/'); - $segs = ('' !== $path) ? explode('/', $path) : array(); + $path = trim(strtr((string)$arrayPath, ['[' => '/', ']' => '']), '/'); + $segs = ('' !== $path) ? explode('/', $path) : []; foreach ($segs as $seg) { if (!array_key_exists($seg, (array)$unset)) { @@ -2186,13 +2186,13 @@ protected function _attachToArray($value, $arrayPath) $arrayKey = trim(substr($arrayPath, $arrayPos + 1), ']'); // Attach - $value = array($arrayKey => $value); + $value = [$arrayKey => $value]; // Set the next search point in the path $arrayPath = trim(substr($arrayPath, 0, $arrayPos), ']'); } - $value = array($arrayPath => $value); + $value = [$arrayPath => $value]; return $value; } @@ -2210,19 +2210,19 @@ protected function _attachToArray($value, $arrayPath) */ public function getElementsAndSubFormsOrdered() { - $ordered = array(); + $ordered = []; foreach ($this->_order as $name => $order) { $order = isset($order) ? $order : count($ordered); if ($this->$name instanceof Zend_Form_Element || $this->$name instanceof Zend_Form) { - array_splice($ordered, $order, 0, array($this->$name)); + array_splice($ordered, $order, 0, [$this->$name]); } else if ($this->$name instanceof Zend_Form_DisplayGroup) { - $subordered = array(); + $subordered = []; /** @var Zend_Form_Element $element */ foreach ($this->$name->getElements() as $element) { $suborder = $element->getOrder(); $suborder = (null !== $suborder) ? $suborder : count($subordered); - array_splice($subordered, $suborder, 0, array($element)); + array_splice($subordered, $suborder, 0, [$element]); } if (!empty($subordered)) { array_splice($ordered, $order, 0, $subordered); @@ -2246,7 +2246,7 @@ protected function _array_replace_recursive(array $into) foreach ($from as $key => $value) { if (is_array($value)) { if (!isset($into[$key])) { - $into[$key] = array(); + $into[$key] = []; } $into[$key] = $this->_array_replace_recursive($into[$key], $from[$key]); } else { @@ -2445,7 +2445,7 @@ public function getErrorMessages() */ public function clearErrorMessages() { - $this->_errorMessages = array(); + $this->_errorMessages = []; return $this; } @@ -2555,7 +2555,7 @@ public function hasErrors() */ public function getErrors($name = null, $suppressArrayNotation = false) { - $errors = array(); + $errors = []; if (null !== $name) { if (isset($this->_elements[$name])) { return $this->getElement($name)->getErrors(); @@ -2570,7 +2570,7 @@ public function getErrors($name = null, $suppressArrayNotation = false) } /** @var Zend_Form_SubForm $subForm */ foreach ($this->getSubForms() as $key => $subForm) { - $merge = array(); + $merge = []; if (!$subForm->isArray()) { $merge[$key] = $subForm->getErrors(); } else { @@ -2620,7 +2620,7 @@ public function getMessages($name = null, $suppressArrayNotation = false) return $customMessages; } - $messages = array(); + $messages = []; /** @var Zend_Form_Element $element */ foreach ($this->getElements() as $name => $element) { @@ -2635,7 +2635,7 @@ public function getMessages($name = null, $suppressArrayNotation = false) $merge = $subForm->getMessages(null, true); if (!empty($merge)) { if (!$subForm->isArray()) { - $merge = array($key => $merge); + $merge = [$key => $merge]; } else { $merge = $this->_attachToArray($merge, $subForm->getElementsBelongTo()); @@ -2730,10 +2730,10 @@ public function addDecorator($decorator, $options = null) $name = get_class($decorator); } elseif (is_string($decorator)) { $name = $decorator; - $decorator = array( + $decorator = [ 'decorator' => $name, 'options' => $options, - ); + ]; } elseif (is_array($decorator)) { foreach ($decorator as $name => $spec) { break; @@ -2743,10 +2743,10 @@ public function addDecorator($decorator, $options = null) throw new Zend_Form_Exception('Invalid alias provided to addDecorator; must be alphanumeric string'); } if (is_string($spec)) { - $decorator = array( + $decorator = [ 'decorator' => $spec, 'options' => $options, - ); + ]; } elseif ($spec instanceof Zend_Form_Decorator_Interface) { $decorator = $spec; } @@ -2773,13 +2773,13 @@ public function addDecorators(array $decorators) if (is_string($decoratorInfo) || $decoratorInfo instanceof Zend_Form_Decorator_Interface) { if (!is_numeric($decoratorName)) { - $this->addDecorator(array($decoratorName => $decoratorInfo)); + $this->addDecorator([$decoratorName => $decoratorInfo]); } else { $this->addDecorator($decoratorInfo); } } elseif (is_array($decoratorInfo)) { $argc = count($decoratorInfo); - $options = array(); + $options = []; if (isset($decoratorInfo['decorator'])) { $decorator = $decoratorInfo['decorator']; if (isset($decoratorInfo['options'])) { @@ -2899,7 +2899,7 @@ public function removeDecorator($name) */ public function clearDecorators() { - $this->_decorators = array(); + $this->_decorators = []; return $this; } @@ -2915,7 +2915,7 @@ public function setElementDecorators(array $decorators, array $elements = null, { if (is_array($elements)) { if ($include) { - $elementObjs = array(); + $elementObjs = []; foreach ($elements as $name) { if (null !== ($element = $this->getElement($name))) { $elementObjs[] = $element; @@ -3380,7 +3380,7 @@ public function loadDefaultDecorators() $decorators = $this->getDecorators(); if (empty($decorators)) { $this->addDecorator('FormElements') - ->addDecorator('HtmlTag', array('tag' => 'dl', 'class' => 'zend_form')) + ->addDecorator('HtmlTag', ['tag' => 'dl', 'class' => 'zend_form']) ->addDecorator('Form'); } return $this; @@ -3409,7 +3409,7 @@ public function removeFromIteration($name) protected function _sort() { if ($this->_orderUpdated) { - $items = array(); + $items = []; $index = 0; foreach ($this->_order as $key => $order) { if (null === $order) { @@ -3461,7 +3461,7 @@ protected function _loadDecorator(array $decorator, $name) $decoratorNames = array_keys($this->_decorators); $order = array_flip($decoratorNames); $order[$newName] = $order[$name]; - $decoratorsExchange = array(); + $decoratorsExchange = []; unset($order[$name]); asort($order); foreach ($order as $key => $index) { diff --git a/library/Zend/Form/Decorator/Abstract.php b/library/Zend/Form/Decorator/Abstract.php index c03a2b3672..14e605bac0 100644 --- a/library/Zend/Form/Decorator/Abstract.php +++ b/library/Zend/Form/Decorator/Abstract.php @@ -54,7 +54,7 @@ abstract class Zend_Form_Decorator_Abstract implements Zend_Form_Decorator_Inter * Decorator options * @var array */ - protected $_options = array(); + protected $_options = []; /** * Separator between new content and old @@ -162,7 +162,7 @@ public function removeOption($key) */ public function clearOptions() { - $this->_options = array(); + $this->_options = []; return $this; } diff --git a/library/Zend/Form/Decorator/Captcha/ReCaptcha.php b/library/Zend/Form/Decorator/Captcha/ReCaptcha.php index c89fb25a49..7d2e0e01c8 100644 --- a/library/Zend/Form/Decorator/Captcha/ReCaptcha.php +++ b/library/Zend/Form/Decorator/Captcha/ReCaptcha.php @@ -67,14 +67,14 @@ public function render($content) // Create hidden fields for holding the final recaptcha values // Placing "id" in "attribs" to ensure it is not overwritten with the name - $hidden = $view->formHidden(array( + $hidden = $view->formHidden([ 'name' => $challengeName, - 'attribs' => array('id' => $challengeId), - )); - $hidden .= $view->formHidden(array( + 'attribs' => ['id' => $challengeId], + ]); + $hidden .= $view->formHidden([ 'name' => $responseName, - 'attribs' => array('id' => $responseId), - )); + 'attribs' => ['id' => $responseId], + ]); // Create a window.onload event so that we can bind to the form. // Once bound, add an onsubmit event that will replace the hidden field diff --git a/library/Zend/Form/Decorator/Fieldset.php b/library/Zend/Form/Decorator/Fieldset.php index 2b132dac7e..3b32e99413 100644 --- a/library/Zend/Form/Decorator/Fieldset.php +++ b/library/Zend/Form/Decorator/Fieldset.php @@ -41,14 +41,14 @@ class Zend_Form_Decorator_Fieldset extends Zend_Form_Decorator_Abstract * Attribs that should be removed prior to rendering * @var array */ - public $stripAttribs = array( + public $stripAttribs = [ 'action', 'enctype', 'helper', 'method', 'name', 'accept-charset', - ); + ]; /** * Fieldset legend diff --git a/library/Zend/Form/Decorator/File.php b/library/Zend/Form/Decorator/File.php index 2343ec1e9f..bfcb6b79b4 100644 --- a/library/Zend/Form/Decorator/File.php +++ b/library/Zend/Form/Decorator/File.php @@ -48,7 +48,7 @@ class Zend_Form_Decorator_File * Attributes that should not be passed to helper * @var array */ - protected $_attribBlacklist = array('helper', 'placement', 'separator', 'value'); + protected $_attribBlacklist = ['helper', 'placement', 'separator', 'value']; /** * Default placement: append @@ -104,7 +104,7 @@ public function render($content) $separator = $this->getSeparator(); $placement = $this->getPlacement(); - $markup = array(); + $markup = []; $size = $element->getMaxFileSize(); if ($size > 0) { $element->setMaxFileSize(0); @@ -112,9 +112,9 @@ public function render($content) } if (Zend_File_Transfer_Adapter_Http::isApcAvailable()) { - $markup[] = $view->formHidden(ini_get('apc.rfc1867_name'), uniqid(), array('id' => 'progress_key')); + $markup[] = $view->formHidden(ini_get('apc.rfc1867_name'), uniqid(), ['id' => 'progress_key']); } else if (Zend_File_Transfer_Adapter_Http::isUploadProgressAvailable()) { - $markup[] = $view->formHidden('UPLOAD_IDENTIFIER', uniqid(), array('id' => 'progress_key')); + $markup[] = $view->formHidden('UPLOAD_IDENTIFIER', uniqid(), ['id' => 'progress_key']); } $helper = $element->helper; diff --git a/library/Zend/Form/Decorator/FormElements.php b/library/Zend/Form/Decorator/FormElements.php index 956d10102f..8b05e8e3ab 100644 --- a/library/Zend/Form/Decorator/FormElements.php +++ b/library/Zend/Form/Decorator/FormElements.php @@ -76,10 +76,10 @@ public function render($content) $belongsTo = ($form instanceof Zend_Form) ? $form->getElementsBelongTo() : null; $elementContent = ''; - $displayGroups = ($form instanceof Zend_Form) ? $form->getDisplayGroups() : array(); + $displayGroups = ($form instanceof Zend_Form) ? $form->getDisplayGroups() : []; $separator = $this->getSeparator(); $translator = $form->getTranslator(); - $items = array(); + $items = []; $view = $form->getView(); foreach ($form as $item) { $item->setView($view); diff --git a/library/Zend/Form/Decorator/FormErrors.php b/library/Zend/Form/Decorator/FormErrors.php index 29ca94e729..62e21450b1 100644 --- a/library/Zend/Form/Decorator/FormErrors.php +++ b/library/Zend/Form/Decorator/FormErrors.php @@ -42,7 +42,7 @@ class Zend_Form_Decorator_FormErrors extends Zend_Form_Decorator_Abstract * Default values for markup options * @var array */ - protected $_defaults = array( + protected $_defaults = [ 'ignoreSubForms' => false, 'showCustomFormErrors' => true, 'onlyCustomFormErrors' => false, @@ -52,7 +52,7 @@ class Zend_Form_Decorator_FormErrors extends Zend_Form_Decorator_Abstract 'markupListItemEnd' => '', 'markupListItemStart' => '
  • ', 'markupListStart' => '
      ', - ); + ]; /**#@+ * Markup options diff --git a/library/Zend/Form/Decorator/Image.php b/library/Zend/Form/Decorator/Image.php index cfad799997..aa3c96d2f8 100644 --- a/library/Zend/Form/Decorator/Image.php +++ b/library/Zend/Form/Decorator/Image.php @@ -45,7 +45,7 @@ class Zend_Form_Decorator_Image extends Zend_Form_Decorator_Abstract * Attributes that should not be passed to helper * @var array */ - protected $_attribBlacklist = array('helper', 'placement', 'separator', 'tag'); + protected $_attribBlacklist = ['helper', 'placement', 'separator', 'tag']; /** * Default placement: append @@ -139,7 +139,7 @@ public function render($content) if (null !== $tag) { require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); - $decorator->setOptions(array('tag' => $tag)); + $decorator->setOptions(['tag' => $tag]); $image = $decorator->render($image); } diff --git a/library/Zend/Form/Decorator/Label.php b/library/Zend/Form/Decorator/Label.php index d922f5bab9..974acae85b 100644 --- a/library/Zend/Form/Decorator/Label.php +++ b/library/Zend/Form/Decorator/Label.php @@ -247,7 +247,7 @@ public function __call($method, $args) { $tail = substr($method, -6); $head = substr($method, 0, 3); - if (in_array($head, array('get', 'set')) + if (in_array($head, ['get', 'set']) && (('Prefix' == $tail) || ('Suffix' == $tail)) ) { $position = substr($method, -6); @@ -435,12 +435,12 @@ public function render($content) require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); if (null !== $this->_tagClass) { - $decorator->setOptions(array('tag' => $tag, + $decorator->setOptions(['tag' => $tag, 'id' => $id . '-label', - 'class' => $tagClass)); + 'class' => $tagClass]); } else { - $decorator->setOptions(array('tag' => $tag, - 'id' => $id . '-label')); + $decorator->setOptions(['tag' => $tag, + 'id' => $id . '-label']); } $label = $decorator->render($label); diff --git a/library/Zend/Form/Decorator/ViewHelper.php b/library/Zend/Form/Decorator/ViewHelper.php index 92d54e75ef..c9394d6c33 100644 --- a/library/Zend/Form/Decorator/ViewHelper.php +++ b/library/Zend/Form/Decorator/ViewHelper.php @@ -47,11 +47,11 @@ class Zend_Form_Decorator_ViewHelper extends Zend_Form_Decorator_Abstract * Element types that represent buttons * @var array */ - protected $_buttonTypes = array( + protected $_buttonTypes = [ 'Zend_Form_Element_Button', 'Zend_Form_Element_Reset', 'Zend_Form_Element_Submit', - ); + ]; /** * View helper to use when rendering @@ -246,7 +246,7 @@ public function render($content) // Check list separator if (isset($attribs['listsep']) - && in_array($helper, array('formMultiCheckbox', 'formRadio', 'formSelect')) + && in_array($helper, ['formMultiCheckbox', 'formRadio', 'formSelect']) ) { $listsep = $attribs['listsep']; unset($attribs['listsep']); diff --git a/library/Zend/Form/DisplayGroup.php b/library/Zend/Form/DisplayGroup.php index a18f236437..4c4118d63a 100644 --- a/library/Zend/Form/DisplayGroup.php +++ b/library/Zend/Form/DisplayGroup.php @@ -33,13 +33,13 @@ class Zend_Form_DisplayGroup implements Iterator,Countable * Group attributes * @var array */ - protected $_attribs = array(); + protected $_attribs = []; /** * Display group decorators * @var array */ - protected $_decorators = array(); + protected $_decorators = []; /** * Description @@ -57,13 +57,13 @@ class Zend_Form_DisplayGroup implements Iterator,Countable * Element order * @var array */ - protected $_elementOrder = array(); + protected $_elementOrder = []; /** * Elements * @var array */ - protected $_elements = array(); + protected $_elements = []; /** * Form object to which the display group is currently registered @@ -155,10 +155,10 @@ public function init() */ public function setOptions(array $options) { - $forbidden = array( + $forbidden = [ 'Options', 'Config', 'PluginLoader', 'View', 'Translator', 'Attrib' - ); + ]; foreach ($options as $key => $value) { $normalized = ucfirst($key); @@ -278,7 +278,7 @@ public function removeAttrib($key) */ public function clearAttribs() { - $this->_attribs = array(); + $this->_attribs = []; return $this; } @@ -385,7 +385,7 @@ public function getId() $id = substr($id, 0, strlen($id) - 2); } $id = str_replace('][', '-', $id); - $id = str_replace(array(']', '['), '-', $id); + $id = str_replace([']', '['], '-', $id); $id = trim($id, '-'); return $id; @@ -558,7 +558,7 @@ public function removeElement($name) */ public function clearElements() { - $this->_elements = array(); + $this->_elements = []; $this->_groupUpdated = true; return $this; } @@ -668,7 +668,7 @@ public function loadDefaultDecorators() $decorators = $this->getDecorators(); if (empty($decorators)) { $this->addDecorator('FormElements') - ->addDecorator('HtmlTag', array('tag' => 'dl')) + ->addDecorator('HtmlTag', ['tag' => 'dl']) ->addDecorator('Fieldset') ->addDecorator('DtDdWrapper'); } @@ -707,10 +707,10 @@ public function addDecorator($decorator, $options = null) $name = get_class($decorator); } elseif (is_string($decorator)) { $name = $decorator; - $decorator = array( + $decorator = [ 'decorator' => $name, 'options' => $options, - ); + ]; } elseif (is_array($decorator)) { foreach ($decorator as $name => $spec) { break; @@ -720,10 +720,10 @@ public function addDecorator($decorator, $options = null) throw new Zend_Form_Exception('Invalid alias provided to addDecorator; must be alphanumeric string'); } if (is_string($spec)) { - $decorator = array( + $decorator = [ 'decorator' => $spec, 'options' => $options, - ); + ]; } elseif ($spec instanceof Zend_Form_Decorator_Interface) { $decorator = $spec; } @@ -749,13 +749,13 @@ public function addDecorators(array $decorators) if (is_string($decoratorInfo) || $decoratorInfo instanceof Zend_Form_Decorator_Interface) { if (!is_numeric($decoratorName)) { - $this->addDecorator(array($decoratorName => $decoratorInfo)); + $this->addDecorator([$decoratorName => $decoratorInfo]); } else { $this->addDecorator($decoratorInfo); } } elseif (is_array($decoratorInfo)) { $argc = count($decoratorInfo); - $options = array(); + $options = []; if (isset($decoratorInfo['decorator'])) { $decorator = $decoratorInfo['decorator']; if (isset($decoratorInfo['options'])) { @@ -872,7 +872,7 @@ public function removeDecorator($name) */ public function clearDecorators() { - $this->_decorators = array(); + $this->_decorators = []; return $this; } @@ -1116,12 +1116,12 @@ public function count() protected function _sort() { if ($this->_groupUpdated || !is_array($this->_elementOrder)) { - $elementOrder = array(); + $elementOrder = []; foreach ($this->getElements() as $key => $element) { $elementOrder[$key] = $element->getOrder(); } - $items = array(); + $items = []; $index = 0; foreach ($elementOrder as $key => $order) { if (null === $order) { @@ -1162,7 +1162,7 @@ protected function _loadDecorator(array $decorator, $name) $decoratorNames = array_keys($this->_decorators); $order = array_flip($decoratorNames); $order[$newName] = $order[$name]; - $decoratorsExchange = array(); + $decoratorsExchange = []; unset($order[$name]); asort($order); foreach ($order as $key => $index) { diff --git a/library/Zend/Form/Element.php b/library/Zend/Form/Element.php index 0c5e32c057..22e40032db 100644 --- a/library/Zend/Form/Element.php +++ b/library/Zend/Form/Element.php @@ -77,7 +77,7 @@ class Zend_Form_Element implements Zend_Validate_Interface * Element decorators * @var array */ - protected $_decorators = array(); + protected $_decorators = []; /** * Element description @@ -95,13 +95,13 @@ class Zend_Form_Element implements Zend_Validate_Interface * Custom error messages * @var array */ - protected $_errorMessages = array(); + protected $_errorMessages = []; /** * Validation errors * @var array */ - protected $_errors = array(); + protected $_errors = []; /** * Separator to use when concatenating aggregate error messages (for @@ -114,7 +114,7 @@ class Zend_Form_Element implements Zend_Validate_Interface * Element filters * @var array */ - protected $_filters = array(); + protected $_filters = []; /** * Ignore flag (used when retrieving values at form level) @@ -150,13 +150,13 @@ class Zend_Form_Element implements Zend_Validate_Interface * Plugin loaders for filter and validator chains * @var array */ - protected $_loaders = array(); + protected $_loaders = []; /** * Formatted validation error messages * @var array */ - protected $_messages = array(); + protected $_messages = []; /** * Element name @@ -197,13 +197,13 @@ class Zend_Form_Element implements Zend_Validate_Interface * Array of initialized validators * @var array Validators */ - protected $_validators = array(); + protected $_validators = []; /** * Array of un-initialized validators * @var array */ - protected $_validatorRules = array(); + protected $_validatorRules = []; /** * Element value @@ -324,12 +324,12 @@ public function loadDefaultDecorators() if (empty($decorators)) { $this->addDecorator('ViewHelper') ->addDecorator('Errors') - ->addDecorator('Description', array('tag' => 'p', 'class' => 'description')) - ->addDecorator('HtmlTag', array( + ->addDecorator('Description', ['tag' => 'p', 'class' => 'description']) + ->addDecorator('HtmlTag', [ 'tag' => 'dd', - 'id' => array('callback' => array(get_class($this), 'resolveElementId')) - )) - ->addDecorator('Label', array('tag' => 'dt')); + 'id' => ['callback' => [get_class($this), 'resolveElementId']] + ]) + ->addDecorator('Label', ['tag' => 'dt']); } return $this; } @@ -371,7 +371,7 @@ public function setOptions(array $options) foreach ($options as $key => $value) { $method = 'set' . ucfirst($key); - if (in_array($method, array('setTranslator', 'setPluginLoader', 'setView'))) { + if (in_array($method, ['setTranslator', 'setPluginLoader', 'setView'])) { if (!is_object($value)) { continue; } @@ -563,7 +563,7 @@ public function getId() $id = substr($id, 0, strlen($id) - 2); } $id = str_replace('][', '-', $id); - $id = str_replace(array(']', '['), '-', $id); + $id = str_replace([']', '['], '-', $id); $id = trim($id, '-'); return $id; @@ -605,7 +605,7 @@ public function getValue() $valueFiltered = $this->_value; if ($this->isArray() && is_array($valueFiltered)) { - array_walk_recursive($valueFiltered, array($this, '_filterValue')); + array_walk_recursive($valueFiltered, [$this, '_filterValue']); } else { $this->_filterValue($valueFiltered, $valueFiltered); } @@ -1067,7 +1067,7 @@ public function getPluginLoader($type) if (!isset($this->_loaders[$type])) { require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader( - array('Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/') + ['Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/'] ); } return $this->_loaders[$type]; @@ -1108,7 +1108,7 @@ public function addPrefixPath($prefix, $path, $type = null) $nsSeparator = (false !== strpos($prefix, '\\'))?'\\':'_'; $prefix = rtrim($prefix, $nsSeparator) . $nsSeparator; $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; - foreach (array(self::DECORATOR, self::FILTER, self::VALIDATE) as $type) { + foreach ([self::DECORATOR, self::FILTER, self::VALIDATE] as $type) { $cType = ucfirst(strtolower($type)); $loader = $this->getPluginLoader($type); $loader->addPrefixPath($prefix . $cType, $path . $cType . DIRECTORY_SEPARATOR); @@ -1175,7 +1175,7 @@ public function addPrefixPaths(array $spec) * @return Zend_Form_Element * @throws Zend_Form_Exception if invalid validator type */ - public function addValidator($validator, $breakChainOnFailure = false, $options = array()) + public function addValidator($validator, $breakChainOnFailure = false, $options = []) { if ($validator instanceof Zend_Validate_Interface) { $name = get_class($validator); @@ -1185,11 +1185,11 @@ public function addValidator($validator, $breakChainOnFailure = false, $options } } elseif (is_string($validator)) { $name = $validator; - $validator = array( + $validator = [ 'validator' => $validator, 'breakChainOnFailure' => $breakChainOnFailure, 'options' => $options, - ); + ]; } else { require_once 'Zend/Form/Exception.php'; throw new Zend_Form_Exception('Invalid validator provided to addValidator; must be string or Zend_Validate_Interface'); @@ -1217,7 +1217,7 @@ public function addValidators(array $validators) } elseif (is_array($validatorInfo)) { $argc = count($validatorInfo); $breakChainOnFailure = false; - $options = array(); + $options = []; if (isset($validatorInfo['validator'])) { $validator = $validatorInfo['validator']; if (isset($validatorInfo['breakChainOnFailure'])) { @@ -1301,7 +1301,7 @@ public function getValidator($name) */ public function getValidators() { - $validators = array(); + $validators = []; foreach ($this->_validators as $key => $value) { if ($value instanceof Zend_Validate_Interface) { $validators[$key] = $value; @@ -1346,7 +1346,7 @@ public function removeValidator($name) */ public function clearValidators() { - $this->_validators = array(); + $this->_validators = []; return $this; } @@ -1381,7 +1381,7 @@ public function isValid($value, $context = null) && !$this->getValidator('NotEmpty')) { $validators = $this->getValidators(); - $notEmpty = array('validator' => 'NotEmpty', 'breakChainOnFailure' => true); + $notEmpty = ['validator' => 'NotEmpty', 'breakChainOnFailure' => true]; array_unshift($validators, $notEmpty); $this->setValidators($validators); } @@ -1401,8 +1401,8 @@ public function isValid($value, $context = null) $translator = $this->getTranslator(); } - $this->_messages = array(); - $this->_errors = array(); + $this->_messages = []; + $this->_errors = []; $result = true; $isArray = $this->isArray(); foreach ($this->getValidators() as $key => $validator) { @@ -1421,8 +1421,8 @@ public function isValid($value, $context = null) } if ($isArray && is_array($value)) { - $messages = array(); - $errors = array(); + $messages = []; + $errors = []; if (empty($value)) { if ($this->isRequired() || (!$this->isRequired() && !$this->getAllowEmpty()) @@ -1530,7 +1530,7 @@ public function getErrorMessages() */ public function clearErrorMessages() { - $this->_errorMessages = array(); + $this->_errorMessages = []; return $this; } @@ -1653,16 +1653,16 @@ public function getMessages() * @param string|Zend_Filter_Interface $filter * @return Zend_Form_Element */ - public function addFilter($filter, $options = array()) + public function addFilter($filter, $options = []) { if ($filter instanceof Zend_Filter_Interface) { $name = get_class($filter); } elseif (is_string($filter)) { $name = $filter; - $filter = array( + $filter = [ 'filter' => $filter, 'options' => $options, - ); + ]; $this->_filters[$name] = $filter; } else { require_once 'Zend/Form/Exception.php'; @@ -1689,7 +1689,7 @@ public function addFilters(array $filters) $this->addFilter($filterInfo); } elseif (is_array($filterInfo)) { $argc = count($filterInfo); - $options = array(); + $options = []; if (isset($filterInfo['filter'])) { $filter = $filterInfo['filter']; if (isset($filterInfo['options'])) { @@ -1769,7 +1769,7 @@ public function getFilter($name) */ public function getFilters() { - $filters = array(); + $filters = []; foreach ($this->_filters as $key => $value) { if ($value instanceof Zend_Filter_Interface) { $filters[$key] = $value; @@ -1814,7 +1814,7 @@ public function removeFilter($name) */ public function clearFilters() { - $this->_filters = array(); + $this->_filters = []; return $this; } @@ -1881,10 +1881,10 @@ public function addDecorator($decorator, $options = null) $name = get_class($decorator); } elseif (is_string($decorator)) { $name = $decorator; - $decorator = array( + $decorator = [ 'decorator' => $name, 'options' => $options, - ); + ]; } elseif (is_array($decorator)) { foreach ($decorator as $name => $spec) { break; @@ -1894,10 +1894,10 @@ public function addDecorator($decorator, $options = null) throw new Zend_Form_Exception('Invalid alias provided to addDecorator; must be alphanumeric string'); } if (is_string($spec)) { - $decorator = array( + $decorator = [ 'decorator' => $spec, 'options' => $options, - ); + ]; } elseif ($spec instanceof Zend_Form_Decorator_Interface) { $decorator = $spec; } @@ -1923,13 +1923,13 @@ public function addDecorators(array $decorators) if (is_string($decoratorInfo) || $decoratorInfo instanceof Zend_Form_Decorator_Interface) { if (!is_numeric($decoratorName)) { - $this->addDecorator(array($decoratorName => $decoratorInfo)); + $this->addDecorator([$decoratorName => $decoratorInfo]); } else { $this->addDecorator($decoratorInfo); } } elseif (is_array($decoratorInfo)) { $argc = count($decoratorInfo); - $options = array(); + $options = []; if (isset($decoratorInfo['decorator'])) { $decorator = $decoratorInfo['decorator']; if (isset($decoratorInfo['options'])) { @@ -2050,7 +2050,7 @@ public function removeDecorator($name) */ public function clearDecorators() { - $this->_decorators = array(); + $this->_decorators = []; return $this; } @@ -2127,7 +2127,7 @@ protected function _loadFilter(array $filter) $filterNames = array_keys($this->_filters); $order = array_flip($filterNames); $order[$name] = $order[$origName]; - $filtersExchange = array(); + $filtersExchange = []; unset($order[$origName]); asort($order); foreach ($order as $key => $index) { @@ -2206,7 +2206,7 @@ protected function _loadValidator(array $validator) $validatorNames = array_keys($this->_validators); $order = array_flip($validatorNames); $order[$name] = $order[$origName]; - $validatorsExchange = array(); + $validatorsExchange = []; unset($order[$origName]); asort($order); foreach ($order as $key => $index) { @@ -2244,7 +2244,7 @@ protected function _loadDecorator(array $decorator, $name) $decoratorNames = array_keys($this->_decorators); $order = array_flip($decoratorNames); $order[$newName] = $order[$name]; - $decoratorsExchange = array(); + $decoratorsExchange = []; unset($order[$name]); asort($order); foreach ($order as $key => $index) { @@ -2277,7 +2277,7 @@ protected function _getErrorMessages() $message = $translator->translate($message); } if ($this->isArray() || is_array($value)) { - $aggregateMessages = array(); + $aggregateMessages = []; foreach ($value as $val) { $aggregateMessages[] = str_replace('%value%', $val, $message); } diff --git a/library/Zend/Form/Element/Captcha.php b/library/Zend/Form/Element/Captcha.php index d18ba8403f..267dab2c73 100644 --- a/library/Zend/Form/Element/Captcha.php +++ b/library/Zend/Form/Element/Captcha.php @@ -71,7 +71,7 @@ public function getCaptcha() * @param string|array|Zend_Captcha_Adapter $captcha * @param array $options */ - public function setCaptcha($captcha, $options = array()) + public function setCaptcha($captcha, $options = []) { if ($captcha instanceof Zend_Captcha_Adapter) { $instance = $captcha; @@ -94,7 +94,7 @@ public function setCaptcha($captcha, $options = array()) } else { $r = new ReflectionClass($name); if ($r->hasMethod('__construct')) { - $instance = $r->newInstanceArgs(array($options)); + $instance = $r->newInstanceArgs([$options]); } else { $instance = $r->newInstance(); } @@ -137,7 +137,7 @@ public function __construct($spec, $options = null) public function setOptions(array $options) { $captcha = null; - $captchaOptions = array(); + $captchaOptions = []; if (array_key_exists('captcha', $options)) { $captcha = $options['captcha']; @@ -175,7 +175,7 @@ public function render(Zend_View_Interface $view = null) array_unshift($decorators, $decorator); } - $decorator = array('Captcha', array('captcha' => $captcha)); + $decorator = ['Captcha', ['captcha' => $captcha]]; $key = get_class($this->_getDecorator($decorator[0], $decorator[1])); if ($captcha instanceof Zend_Captcha_Word && !array_key_exists($key, $decorators)) { @@ -206,7 +206,7 @@ public function getPluginLoader($type) if (!isset($this->_loaders[$type])) { require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader( - array('Zend_Captcha' => 'Zend/Captcha/') + ['Zend_Captcha' => 'Zend/Captcha/'] ); } return $this->_loaders[$type]; @@ -260,9 +260,9 @@ public function loadDefaultDecorators() $decorators = $this->getDecorators(); if (empty($decorators)) { $this->addDecorator('Errors') - ->addDecorator('Description', array('tag' => 'p', 'class' => 'description')) - ->addDecorator('HtmlTag', array('tag' => 'dd', 'id' => $this->getName() . '-element')) - ->addDecorator('Label', array('tag' => 'dt')); + ->addDecorator('Description', ['tag' => 'p', 'class' => 'description']) + ->addDecorator('HtmlTag', ['tag' => 'dd', 'id' => $this->getName() . '-element']) + ->addDecorator('Label', ['tag' => 'dt']); } return $this; } diff --git a/library/Zend/Form/Element/Checkbox.php b/library/Zend/Form/Element/Checkbox.php index b6057fa3a2..1c67f0ea04 100644 --- a/library/Zend/Form/Element/Checkbox.php +++ b/library/Zend/Form/Element/Checkbox.php @@ -50,10 +50,10 @@ class Zend_Form_Element_Checkbox extends Zend_Form_Element_Xhtml * Options that will be passed to the view helper * @var array */ - public $options = array( + public $options = [ 'checkedValue' => '1', 'uncheckedValue' => '0', - ); + ]; /** * Value when checked @@ -95,7 +95,7 @@ public function setOptions(array $options) parent::setOptions($options); $curValue = $this->getValue(); - $test = array($this->getCheckedValue(), $this->getUncheckedValue()); + $test = [$this->getCheckedValue(), $this->getUncheckedValue()]; if (!in_array($curValue, $test)) { $this->setValue($curValue); } diff --git a/library/Zend/Form/Element/File.php b/library/Zend/Form/Element/File.php index 0f3e162d89..9cdb533375 100644 --- a/library/Zend/Form/Element/File.php +++ b/library/Zend/Form/Element/File.php @@ -130,9 +130,9 @@ public function getPluginLoader($type) if (!array_key_exists($type, $this->_loaders)) { require_once 'Zend/Loader/PluginLoader.php'; - $loader = new Zend_Loader_PluginLoader(array( + $loader = new Zend_Loader_PluginLoader([ 'Zend_File_Transfer_Adapter' => 'Zend/File/Transfer/Adapter/', - )); + ]); $this->setPluginLoader($loader, self::TRANSFER_ADAPTER); } @@ -188,7 +188,7 @@ public function setTransferAdapter($adapter) throw new Zend_Form_Element_Exception('Invalid adapter specified'); } - foreach (array('filter', 'validate') as $type) { + foreach (['filter', 'validate'] as $type) { $loader = $this->getPluginLoader($type); $this->_adapter->setPluginLoader($loader, $type); } @@ -219,7 +219,7 @@ public function getTransferAdapter() * @param mixed $options * @return Zend_Form_Element_File */ - public function addValidator($validator, $breakChainOnFailure = false, $options = array()) + public function addValidator($validator, $breakChainOnFailure = false, $options = []) { $adapter = $this->getTransferAdapter(); $adapter->addValidator($validator, $breakChainOnFailure, $options, $this->getName()); @@ -280,7 +280,7 @@ public function getValidators() $adapter = $this->getTransferAdapter(); $validators = $adapter->getValidators($this->getName()); if ($validators === null) { - $validators = array(); + $validators = []; } return $validators; @@ -381,7 +381,7 @@ public function getFilters() $filters = $adapter->getFilters($this->getName()); if ($filters === null) { - $filters = array(); + $filters = []; } return $filters; } @@ -433,9 +433,9 @@ public function isValid($value, $context = null) } if (!$this->isRequired()) { - $adapter->setOptions(array('ignoreNoFile' => true), $this->getName()); + $adapter->setOptions(['ignoreNoFile' => true], $this->getName()); } else { - $adapter->setOptions(array('ignoreNoFile' => false), $this->getName()); + $adapter->setOptions(['ignoreNoFile' => false], $this->getName()); if ($this->autoInsertNotEmptyValidator() && !$this->getValidator('NotEmpty')) { $this->addValidator('NotEmpty', true); } @@ -897,7 +897,7 @@ protected function _getErrorMessages() } if ($this->isArray() || is_array($value)) { - $aggregateMessages = array(); + $aggregateMessages = []; foreach ($value as $val) { $aggregateMessages[] = str_replace('%value%', $val, $message); } diff --git a/library/Zend/Form/Element/Hash.php b/library/Zend/Form/Element/Hash.php index a5f99f345f..09a9211c43 100644 --- a/library/Zend/Form/Element/Hash.php +++ b/library/Zend/Form/Element/Hash.php @@ -131,7 +131,7 @@ public function initCsrfValidator() $rightHash = null; } - $this->addValidator('Identical', true, array($rightHash)); + $this->addValidator('Identical', true, [$rightHash]); return $this; } diff --git a/library/Zend/Form/Element/Image.php b/library/Zend/Form/Element/Image.php index 1c94335815..19c11aa764 100644 --- a/library/Zend/Form/Element/Image.php +++ b/library/Zend/Form/Element/Image.php @@ -68,8 +68,8 @@ public function loadDefaultDecorators() $this->addDecorator('Tooltip') ->addDecorator('Image') ->addDecorator('Errors') - ->addDecorator('HtmlTag', array('tag' => 'dd')) - ->addDecorator('Label', array('tag' => 'dt')); + ->addDecorator('HtmlTag', ['tag' => 'dd']) + ->addDecorator('Label', ['tag' => 'dt']); } return $this; } diff --git a/library/Zend/Form/Element/Multi.php b/library/Zend/Form/Element/Multi.php index 9fb9511528..8cf46229bf 100644 --- a/library/Zend/Form/Element/Multi.php +++ b/library/Zend/Form/Element/Multi.php @@ -38,7 +38,7 @@ abstract class Zend_Form_Element_Multi extends Zend_Form_Element_Xhtml * Array of options for multi-item * @var array */ - public $options = array(); + public $options = []; /** * Flag: autoregister inArray validator? @@ -56,7 +56,7 @@ abstract class Zend_Form_Element_Multi extends Zend_Form_Element_Xhtml * Which values are translated already? * @var array */ - protected $_translated = array(); + protected $_translated = []; /** * Retrieve separator @@ -88,7 +88,7 @@ public function setSeparator($separator) protected function _getMultiOptions() { if (null === $this->options || !is_array($this->options)) { - $this->options = array(); + $this->options = []; } return $this->options; @@ -205,8 +205,8 @@ public function removeMultiOption($option) */ public function clearMultiOptions() { - $this->options = array(); - $this->_translated = array(); + $this->options = []; + $this->_translated = []; return $this; } @@ -246,7 +246,7 @@ public function isValid($value, $context = null) if ($this->registerInArrayValidator()) { if (!$this->getValidator('InArray')) { $multiOptions = $this->getMultiOptions(); - $options = array(); + $options = []; foreach ($multiOptions as $opt_value => $opt_label) { // optgroup instead of option label @@ -261,7 +261,7 @@ public function isValid($value, $context = null) $this->addValidator( 'InArray', true, - array($options) + [$options] ); } } diff --git a/library/Zend/Form/Element/Submit.php b/library/Zend/Form/Element/Submit.php index 9198e3a5ba..6770e262c6 100644 --- a/library/Zend/Form/Element/Submit.php +++ b/library/Zend/Form/Element/Submit.php @@ -50,7 +50,7 @@ class Zend_Form_Element_Submit extends Zend_Form_Element_Xhtml public function __construct($spec, $options = null) { if (is_string($spec) && ((null !== $options) && is_string($options))) { - $options = array('label' => $options); + $options = ['label' => $options]; } if (!isset($options['ignore'])) { diff --git a/library/Zend/Form/SubForm.php b/library/Zend/Form/SubForm.php index 78b0242d43..51db58ff01 100644 --- a/library/Zend/Form/SubForm.php +++ b/library/Zend/Form/SubForm.php @@ -52,7 +52,7 @@ public function loadDefaultDecorators() $decorators = $this->getDecorators(); if (empty($decorators)) { $this->addDecorator('FormElements') - ->addDecorator('HtmlTag', array('tag' => 'dl')) + ->addDecorator('HtmlTag', ['tag' => 'dl']) ->addDecorator('Fieldset') ->addDecorator('DtDdWrapper'); } diff --git a/library/Zend/Gdata.php b/library/Zend/Gdata.php index 7ffabc9063..c51f420436 100644 --- a/library/Zend/Gdata.php +++ b/library/Zend/Gdata.php @@ -63,24 +63,24 @@ class Zend_Gdata extends Zend_Gdata_App * * @var array */ - protected $_registeredPackages = array( + protected $_registeredPackages = [ 'Zend_Gdata_Kind', 'Zend_Gdata_Extension', 'Zend_Gdata', 'Zend_Gdata_App_Extension', - 'Zend_Gdata_App'); + 'Zend_Gdata_App']; /** * Namespaces used for Gdata data * * @var array */ - public static $namespaces = array( - array('gd', 'http://schemas.google.com/g/2005', 1, 0), - array('openSearch', 'http://a9.com/-/spec/opensearchrss/1.0/', 1, 0), - array('openSearch', 'http://a9.com/-/spec/opensearch/1.1/', 2, 0), - array('rss', 'http://blogs.law.harvard.edu/tech/rss', 1, 0) - ); + public static $namespaces = [ + ['gd', 'http://schemas.google.com/g/2005', 1, 0], + ['openSearch', 'http://a9.com/-/spec/opensearchrss/1.0/', 1, 0], + ['openSearch', 'http://a9.com/-/spec/opensearch/1.1/', 2, 0], + ['rss', 'http://blogs.law.harvard.edu/tech/rss', 1, 0] + ]; /** * Client object used to communicate @@ -207,7 +207,7 @@ public function getEntry($location, $className='Zend_Gdata_Entry') * if requests results in one * @return Zend_Http_Response The response object */ - public function performHttpRequest($method, $url, $headers = array(), $body = null, $contentType = null, $remainingRedirects = null) + public function performHttpRequest($method, $url, $headers = [], $body = null, $contentType = null, $remainingRedirects = null) { if ($this->_httpClient instanceof Zend_Gdata_HttpClient) { $filterResult = $this->_httpClient->filterHttpRequest($method, $url, $headers, $body, $contentType); diff --git a/library/Zend/Gdata/Analytics.php b/library/Zend/Gdata/Analytics.php index bbc74ea80d..f142749d4b 100644 --- a/library/Zend/Gdata/Analytics.php +++ b/library/Zend/Gdata/Analytics.php @@ -67,10 +67,10 @@ class Zend_Gdata_Analytics extends Zend_Gdata const ANALYTICS_FEED_URI = 'https://www.googleapis.com/analytics/v2.4/data'; const ANALYTICS_ACCOUNT_FEED_URI = 'https://www.googleapis.com/analytics/v2.4/management/accounts'; - public static $namespaces = array( - array('analytics', 'http://schemas.google.com/analytics/2009', 1, 0), - array('ga', 'http://schemas.google.com/ga/2009', 1, 0) - ); + public static $namespaces = [ + ['analytics', 'http://schemas.google.com/analytics/2009', 1, 0], + ['ga', 'http://schemas.google.com/ga/2009', 1, 0] + ]; /** * Create Gdata object diff --git a/library/Zend/Gdata/Analytics/DataEntry.php b/library/Zend/Gdata/Analytics/DataEntry.php index db6fad8978..a03ee7b709 100644 --- a/library/Zend/Gdata/Analytics/DataEntry.php +++ b/library/Zend/Gdata/Analytics/DataEntry.php @@ -35,11 +35,11 @@ class Zend_Gdata_Analytics_DataEntry extends Zend_Gdata_Entry /** * @var array */ - protected $_dimensions = array(); + protected $_dimensions = []; /** * @var array */ - protected $_metrics = array(); + protected $_metrics = []; /** * @param DOMElement $element diff --git a/library/Zend/Gdata/Analytics/DataQuery.php b/library/Zend/Gdata/Analytics/DataQuery.php index 237c306e39..6f54946b92 100644 --- a/library/Zend/Gdata/Analytics/DataQuery.php +++ b/library/Zend/Gdata/Analytics/DataQuery.php @@ -201,19 +201,19 @@ class Zend_Gdata_Analytics_DataQuery extends Zend_Gdata_Query /** * @var array */ - protected $_dimensions = array(); + protected $_dimensions = []; /** * @var array */ - protected $_metrics = array(); + protected $_metrics = []; /** * @var array */ - protected $_sort = array(); + protected $_sort = []; /** * @var array */ - protected $_filters = array(); + protected $_filters = []; /** * @param string $id @@ -312,7 +312,7 @@ public function setEndDate($date) */ public function addFilter($filter) { - $this->_filters[] = array($filter, true); + $this->_filters[] = [$filter, true]; return $this; } @@ -322,7 +322,7 @@ public function addFilter($filter) */ public function addOrFilter($filter) { - $this->_filters[] = array($filter, false); + $this->_filters[] = [$filter, false]; return $this; } @@ -343,7 +343,7 @@ public function addSort($sort, $descending=false) */ public function clearSort() { - $this->_sort = array(); + $this->_sort = []; return $this; } diff --git a/library/Zend/Gdata/App.php b/library/Zend/Gdata/App.php index 1508743d7f..7c4315062c 100644 --- a/library/Zend/Gdata/App.php +++ b/library/Zend/Gdata/App.php @@ -123,9 +123,9 @@ class Zend_Gdata_App * * @var array */ - protected $_registeredPackages = array( + protected $_registeredPackages = [ 'Zend_Gdata_App_Extension', - 'Zend_Gdata_App'); + 'Zend_Gdata_App']; /** * Maximum number of redirects to follow during HTTP operations @@ -259,9 +259,9 @@ public function setHttpClient($client, $userAgent = $applicationId . ' Zend_Framework_Gdata/' . Zend_Version::VERSION; $client->setHeaders('User-Agent', $userAgent); - $client->setConfig(array( + $client->setConfig([ 'strictredirects' => true - ) + ] ); $this->_httpClient = $client; self::setStaticHttpClient($client); @@ -293,9 +293,9 @@ public static function getStaticHttpClient() $client = new Zend_Http_Client(); $userAgent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION; $client->setHeaders('User-Agent', $userAgent); - $client->setConfig(array( + $client->setConfig([ 'strictredirects' => true - ) + ] ); self::$_staticHttpClient = $client; } @@ -490,14 +490,14 @@ public function getMinorProtocolVersion() */ public function prepareRequest($method, $url = null, - $headers = array(), + $headers = [], $data = null, $contentTypeOverride = null) { // As a convenience, if $headers is null, we'll convert it back to // an empty array. if ($headers === null) { - $headers = array(); + $headers = []; } $rawData = null; @@ -574,9 +574,9 @@ public function prepareRequest($method, $finalContentType = $contentTypeOverride; } - return array('method' => $method, 'url' => $url, + return ['method' => $method, 'url' => $url, 'data' => $rawData, 'headers' => $headers, - 'contentType' => $finalContentType); + 'contentType' => $finalContentType]; } /** @@ -602,7 +602,7 @@ public function performHttpRequest($method, $url, $headers = null, $remainingRedirects = self::getMaxRedirects(); } if ($headers === null) { - $headers = array(); + $headers = []; } // Append a Gdata version header if protocol v2 or higher is in use. // (Protocol v1 does not use this header.) @@ -644,7 +644,7 @@ public function performHttpRequest($method, $url, $headers = null, // In addition to standard headers to reset via resetParameters(), // also reset the Slug and If-Match headers $this->_httpClient->resetParameters(); - $this->_httpClient->setHeaders(array('Slug', 'If-Match')); + $this->_httpClient->setHeaders(['Slug', 'If-Match']); // Set the params for the new request to be performed $this->_httpClient->setHeaders($headers); @@ -658,7 +658,7 @@ public function performHttpRequest($method, $url, $headers = null, } - $this->_httpClient->setConfig(array('maxredirects' => 0)); + $this->_httpClient->setConfig(['maxredirects' => 0]); // Set the proper adapter if we are handling a streaming upload $usingMimeStream = false; @@ -766,7 +766,7 @@ public static function import($uri, $client = null, * useObjectMapping() function. */ public function importUrl($url, $className='Zend_Gdata_App_Feed', - $extraHeaders = array()) + $extraHeaders = []) { $response = $this->get($url, $extraHeaders); @@ -875,7 +875,7 @@ public static function importFile($filename, * @throws Zend_Gdata_App_HttpException * @return Zend_Http_Response */ - public function get($uri, $extraHeaders = array()) + public function get($uri, $extraHeaders = []) { $requestData = $this->prepareRequest('GET', $uri, $extraHeaders); return $this->performHttpRequest( @@ -947,7 +947,7 @@ public function delete($data, $remainingRedirects = null) if (is_string($data)) { $requestData = $this->prepareRequest('DELETE', $data); } else { - $headers = array(); + $headers = []; $requestData = $this->prepareRequest( 'DELETE', null, $headers, $data); @@ -973,7 +973,7 @@ public function delete($data, $remainingRedirects = null) * insertion. */ public function insertEntry($data, $uri, $className='Zend_Gdata_App_Entry', - $extraHeaders = array()) + $extraHeaders = []) { if (!class_exists($className, false)) { require_once 'Zend/Loader.php'; @@ -1008,7 +1008,7 @@ public function insertEntry($data, $uri, $className='Zend_Gdata_App_Entry', * @throws Zend_Gdata_App_Exception */ public function updateEntry($data, $uri = null, $className = null, - $extraHeaders = array()) + $extraHeaders = []) { if ($className === null && $data instanceof Zend_Gdata_App_Entry) { $className = get_class($data); @@ -1132,10 +1132,10 @@ public function retrieveAllEntriesForFeed($feed) { */ public function enableRequestDebugLogging($logfile) { - $this->_httpClient->setConfig(array( + $this->_httpClient->setConfig([ 'adapter' => 'Zend_Gdata_App_LoggingHttpClientAdapterSocket', 'logfile' => $logfile - )); + ]); } /** diff --git a/library/Zend/Gdata/App/Base.php b/library/Zend/Gdata/App/Base.php index 4635840370..9361459449 100644 --- a/library/Zend/Gdata/App/Base.php +++ b/library/Zend/Gdata/App/Base.php @@ -60,12 +60,12 @@ abstract class Zend_Gdata_App_Base /** * @var array Leftover elements which were not handled */ - protected $_extensionElements = array(); + protected $_extensionElements = []; /** * @var array Leftover attributes which were not handled */ - protected $_extensionAttributes = array(); + protected $_extensionAttributes = []; /** * @var string XML child text node content @@ -78,7 +78,7 @@ abstract class Zend_Gdata_App_Base * form 'prefix-majorVersion-minorVersion', and the value is the * output from getGreatestBoundedValue(). */ - protected static $_namespaceLookupCache = array(); + protected static $_namespaceLookupCache = []; /** * List of namespaces, as a three-dimensional array. The first dimension @@ -95,21 +95,21 @@ abstract class Zend_Gdata_App_Base * @see registerAllNamespaces() * @var array */ - protected $_namespaces = array( - 'atom' => array( - 1 => array( + protected $_namespaces = [ + 'atom' => [ + 1 => [ 0 => 'http://www.w3.org/2005/Atom' - ) - ), - 'app' => array( - 1 => array( + ] + ], + 'app' => [ + 1 => [ 0 => 'http://purl.org/atom/app#' - ), - 2 => array( + ], + 2 => [ 0 => 'http://www.w3.org/2007/app' - ) - ) - ); + ] + ] + ]; public function __construct() { @@ -267,9 +267,9 @@ protected function takeAttributeFromDOM($attribute) $attribute->namespaceURI . ':' . $attribute->name): $attribute->name; $this->_extensionAttributes[$arrayIndex] = - array('namespaceUri' => $attribute->namespaceURI, + ['namespaceUri' => $attribute->namespaceURI, 'name' => $attribute->localName, - 'value' => $attribute->nodeValue); + 'value' => $attribute->nodeValue]; } /** @@ -444,7 +444,7 @@ public function registerNamespace($prefix, */ public static function flushNamespaceLookupCache() { - self::$_namespaceLookupCache = array(); + self::$_namespaceLookupCache = []; } /** @@ -479,7 +479,7 @@ public function __get($name) { $method = 'get'.ucfirst($name); if (method_exists($this, $method)) { - return call_user_func(array(&$this, $method)); + return call_user_func([&$this, $method]); } else if (property_exists($this, "_${name}")) { return $this->{'_' . $name}; } else { @@ -505,7 +505,7 @@ public function __set($name, $val) { $method = 'set'.ucfirst($name); if (method_exists($this, $method)) { - return call_user_func(array(&$this, $method), $val); + return call_user_func([&$this, $method], $val); } else if (isset($this->{'_' . $name}) || ($this->{'_' . $name} === null)) { $this->{'_' . $name} = $val; } else { @@ -554,7 +554,7 @@ public function __unset($name) { if (isset($this->{'_' . $name})) { if (is_array($this->{'_' . $name})) { - $this->{'_' . $name} = array(); + $this->{'_' . $name} = []; } else { $this->{'_' . $name} = null; } diff --git a/library/Zend/Gdata/App/BaseMediaSource.php b/library/Zend/Gdata/App/BaseMediaSource.php index 7e136ac455..23a1df942c 100644 --- a/library/Zend/Gdata/App/BaseMediaSource.php +++ b/library/Zend/Gdata/App/BaseMediaSource.php @@ -112,7 +112,7 @@ public function __get($name) { $method = 'get'.ucfirst($name); if (method_exists($this, $method)) { - return call_user_func(array(&$this, $method)); + return call_user_func([&$this, $method]); } else if (property_exists($this, "_${name}")) { return $this->{'_' . $name}; } else { @@ -136,7 +136,7 @@ public function __set($name, $val) { $method = 'set'.ucfirst($name); if (method_exists($this, $method)) { - return call_user_func(array(&$this, $method), $val); + return call_user_func([&$this, $method], $val); } else if (isset($this->{'_' . $name}) || ($this->{'_' . $name} === null)) { $this->{'_' . $name} = $val; } else { diff --git a/library/Zend/Gdata/App/Entry.php b/library/Zend/Gdata/App/Entry.php index db8cb251ce..5b30ca50d1 100644 --- a/library/Zend/Gdata/App/Entry.php +++ b/library/Zend/Gdata/App/Entry.php @@ -201,7 +201,7 @@ protected function takeChildFromDOM($child) * @return Zend_Gdata_App_Entry The updated entry. * @throws Zend_Gdata_App_Exception */ - public function save($uri = null, $className = null, $extraHeaders = array()) + public function save($uri = null, $className = null, $extraHeaders = []) { return $this->getService()->updateEntry($this, $uri, @@ -238,7 +238,7 @@ public function delete() * null if the server reports that no changes have been made. * @throws Zend_Gdata_App_Exception */ - public function reload($uri = null, $className = null, $extraHeaders = array()) + public function reload($uri = null, $className = null, $extraHeaders = []) { // Get URI $editLink = $this->getEditLink(); diff --git a/library/Zend/Gdata/App/Feed.php b/library/Zend/Gdata/App/Feed.php index 2e07bd0bd4..f22b93ef47 100755 --- a/library/Zend/Gdata/App/Feed.php +++ b/library/Zend/Gdata/App/Feed.php @@ -56,7 +56,7 @@ class Zend_Gdata_App_Feed extends Zend_Gdata_App_FeedSourceParent * * @var array */ - protected $_entry = array(); + protected $_entry = []; /** * Current location in $_entry array diff --git a/library/Zend/Gdata/App/FeedEntryParent.php b/library/Zend/Gdata/App/FeedEntryParent.php index 89c6fcc150..9cd9d5d83c 100755 --- a/library/Zend/Gdata/App/FeedEntryParent.php +++ b/library/Zend/Gdata/App/FeedEntryParent.php @@ -97,11 +97,11 @@ abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base */ protected $_etag = NULL; - protected $_author = array(); - protected $_category = array(); - protected $_contributor = array(); + protected $_author = []; + protected $_category = []; + protected $_contributor = []; protected $_id = null; - protected $_link = array(); + protected $_link = []; protected $_rights = null; protected $_title = null; protected $_updated = null; diff --git a/library/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php b/library/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php index ee85da807f..380815041c 100644 --- a/library/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php +++ b/library/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php @@ -87,7 +87,7 @@ public function connect($host, $port = 80, $secure = false) * @param string $body * @return string Request as string */ - public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '') + public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') { $request = parent::write($method, $uri, $http_ver, $headers, $body); $this->log("\n\n" . $request); diff --git a/library/Zend/Gdata/AuthSub.php b/library/Zend/Gdata/AuthSub.php index 3958706ccc..db8a0819f9 100644 --- a/library/Zend/Gdata/AuthSub.php +++ b/library/Zend/Gdata/AuthSub.php @@ -124,7 +124,7 @@ public static function getAuthSubSessionToken( // Parse Google's response if ($response->isSuccessful()) { - $goog_resp = array(); + $goog_resp = []; foreach (explode("\n", $response->getBody()) as $l) { $l = chop($l); if ($l) { @@ -236,10 +236,10 @@ public static function getHttpClient($token, $client = null) throw new Zend_Gdata_App_HttpException('Client is not an instance of Zend_Gdata_HttpClient.'); } $useragent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION; - $client->setConfig(array( + $client->setConfig([ 'strictredirects' => true, 'useragent' => $useragent - ) + ] ); $client->setAuthSubToken($token); return $client; diff --git a/library/Zend/Gdata/Books.php b/library/Zend/Gdata/Books.php index 48c5bb867c..b5a1dfe78b 100755 --- a/library/Zend/Gdata/Books.php +++ b/library/Zend/Gdata/Books.php @@ -72,10 +72,10 @@ class Zend_Gdata_Books extends Zend_Gdata * * @var array */ - public static $namespaces = array( - array('gbs', 'http://schemas.google.com/books/2008', 1, 0), - array('dc', 'http://purl.org/dc/terms', 1, 0) - ); + public static $namespaces = [ + ['gbs', 'http://schemas.google.com/books/2008', 1, 0], + ['dc', 'http://purl.org/dc/terms', 1, 0] + ]; /** * Create Zend_Gdata_Books object diff --git a/library/Zend/Gdata/Books/VolumeEntry.php b/library/Zend/Gdata/Books/VolumeEntry.php index 1ac15ffc54..6b8d53c529 100644 --- a/library/Zend/Gdata/Books/VolumeEntry.php +++ b/library/Zend/Gdata/Books/VolumeEntry.php @@ -114,18 +114,18 @@ class Zend_Gdata_Books_VolumeEntry extends Zend_Gdata_Entry const ANNOTATION_LINK_REL = 'http://schemas.google.com/books/2008/annotation'; protected $_comments = null; - protected $_creators = array(); - protected $_dates = array(); - protected $_descriptions = array(); + protected $_creators = []; + protected $_dates = []; + protected $_descriptions = []; protected $_embeddability = null; - protected $_formats = array(); - protected $_identifiers = array(); - protected $_languages = array(); - protected $_publishers = array(); + protected $_formats = []; + protected $_identifiers = []; + protected $_languages = []; + protected $_publishers = []; protected $_rating = null; protected $_review = null; - protected $_subjects = array(); - protected $_titles = array(); + protected $_subjects = []; + protected $_titles = []; protected $_viewability = null; /** diff --git a/library/Zend/Gdata/Calendar.php b/library/Zend/Gdata/Calendar.php index 6169d9ca5f..add1aa09fe 100644 --- a/library/Zend/Gdata/Calendar.php +++ b/library/Zend/Gdata/Calendar.php @@ -70,9 +70,9 @@ class Zend_Gdata_Calendar extends Zend_Gdata * * @var array */ - public static $namespaces = array( - array('gCal', 'http://schemas.google.com/gCal/2005', 1, 0) - ); + public static $namespaces = [ + ['gCal', 'http://schemas.google.com/gCal/2005', 1, 0] + ]; /** * Create Gdata_Calendar object diff --git a/library/Zend/Gdata/Calendar/ListEntry.php b/library/Zend/Gdata/Calendar/ListEntry.php index 1e232a97fa..9cf3f0a4ab 100644 --- a/library/Zend/Gdata/Calendar/ListEntry.php +++ b/library/Zend/Gdata/Calendar/ListEntry.php @@ -80,7 +80,7 @@ class Zend_Gdata_Calendar_ListEntry extends Zend_Gdata_Entry protected $_hidden = null; protected $_selected = null; protected $_timezone = null; - protected $_where = array(); + protected $_where = []; public function __construct($element = null) { diff --git a/library/Zend/Gdata/ClientLogin.php b/library/Zend/Gdata/ClientLogin.php index 2e8d9bffe7..3b5f74cf5c 100644 --- a/library/Zend/Gdata/ClientLogin.php +++ b/library/Zend/Gdata/ClientLogin.php @@ -105,11 +105,11 @@ public static function getHttpClient($email, $password, $service = 'xapi', // Build the HTTP client for authentication $client->setUri($loginUri); $useragent = $source . ' Zend_Framework_Gdata/' . Zend_Version::VERSION; - $client->setConfig(array( + $client->setConfig([ 'maxredirects' => 0, 'strictredirects' => true, 'useragent' => $useragent - ) + ] ); $client->setParameterPost('accountType', $accountType); $client->setParameterPost('Email', (string) $email); @@ -143,7 +143,7 @@ public static function getHttpClient($email, $password, $service = 'xapi', ob_end_clean(); // Parse Google's response - $goog_resp = array(); + $goog_resp = []; foreach (explode("\n", $response->getBody()) as $l) { $l = chop($l); if ($l) { @@ -155,10 +155,10 @@ public static function getHttpClient($email, $password, $service = 'xapi', if ($response->getStatus() == 200) { $client->setClientLoginToken($goog_resp['Auth']); $useragent = $source . ' Zend_Framework_Gdata/' . Zend_Version::VERSION; - $client->setConfig(array( + $client->setConfig([ 'strictredirects' => true, 'useragent' => $useragent - ) + ] ); return $client; diff --git a/library/Zend/Gdata/Docs.php b/library/Zend/Gdata/Docs.php index ec056c863a..bd372ab216 100755 --- a/library/Zend/Gdata/Docs.php +++ b/library/Zend/Gdata/Docs.php @@ -72,7 +72,7 @@ class Zend_Gdata_Docs extends Zend_Gdata /** * @var array */ - protected static $SUPPORTED_FILETYPES = array( + protected static $SUPPORTED_FILETYPES = [ 'TXT' => 'text/plain', 'CSV' => 'text/csv', 'TSV' => 'text/tab-separated-values', @@ -89,7 +89,7 @@ class Zend_Gdata_Docs extends Zend_Gdata 'XLSX' => 'application/vnd.ms-excel', 'PPT' => 'application/vnd.ms-powerpoint', 'PPS' => 'application/vnd.ms-powerpoint' - ); + ]; /** * Create Gdata_Docs object @@ -289,7 +289,7 @@ public function createFolder($folderName, $folderResourceId = null) $title = new Zend_Gdata_App_Extension_Title($folderName); $entry = new Zend_Gdata_Entry(); - $entry->setCategory(array($category)); + $entry->setCategory([$category]); $entry->setTitle($title); $uri = self::DOCUMENTS_LIST_FEED_URI; diff --git a/library/Zend/Gdata/DublinCore.php b/library/Zend/Gdata/DublinCore.php index edeb5454d1..550fc5570e 100755 --- a/library/Zend/Gdata/DublinCore.php +++ b/library/Zend/Gdata/DublinCore.php @@ -44,9 +44,9 @@ class Zend_Gdata_DublinCore extends Zend_Gdata * * @var array */ - public static $namespaces = array( - array('dc', 'http://purl.org/dc/terms', 1, 0) - ); + public static $namespaces = [ + ['dc', 'http://purl.org/dc/terms', 1, 0] + ]; /** * Create Zend_Gdata_DublinCore object diff --git a/library/Zend/Gdata/Exif.php b/library/Zend/Gdata/Exif.php index 9d82d70698..cfa13f07c9 100755 --- a/library/Zend/Gdata/Exif.php +++ b/library/Zend/Gdata/Exif.php @@ -44,9 +44,9 @@ class Zend_Gdata_Exif extends Zend_Gdata * * @var array */ - public static $namespaces = array( - array('exif', 'http://schemas.google.com/photos/exif/2007', 1, 0) - ); + public static $namespaces = [ + ['exif', 'http://schemas.google.com/photos/exif/2007', 1, 0] + ]; /** * Create Zend_Gdata_Exif object diff --git a/library/Zend/Gdata/Extension/When.php b/library/Zend/Gdata/Extension/When.php index ba545f0c9b..0cf3897e16 100644 --- a/library/Zend/Gdata/Extension/When.php +++ b/library/Zend/Gdata/Extension/When.php @@ -44,7 +44,7 @@ class Zend_Gdata_Extension_When extends Zend_Gdata_Extension { protected $_rootElement = 'when'; - protected $_reminders = array(); + protected $_reminders = []; protected $_startTime = null; protected $_valueString = null; protected $_endTime = null; diff --git a/library/Zend/Gdata/Gapps.php b/library/Zend/Gdata/Gapps.php index 7f2924ef4f..358621700e 100644 --- a/library/Zend/Gdata/Gapps.php +++ b/library/Zend/Gdata/Gapps.php @@ -122,9 +122,9 @@ class Zend_Gdata_Gapps extends Zend_Gdata * * @var array */ - public static $namespaces = array( - array('apps', 'http://schemas.google.com/apps/2006', 1, 0) - ); + public static $namespaces = [ + ['apps', 'http://schemas.google.com/apps/2006', 1, 0] + ]; /** * Create Gdata_Gapps object @@ -216,7 +216,7 @@ public static function import($uri, $client = null, $className='Zend_Gdata_App_F * @throws Zend_Gdata_Gapps_ServiceException * @return Zend_Http_Response */ - public function get($uri, $extraHeaders = array()) + public function get($uri, $extraHeaders = []) { try { return parent::get($uri, $extraHeaders); @@ -874,7 +874,7 @@ public function __call($method, $args) { if ($foundClassName != null) { $reflectionObj = new ReflectionClass($foundClassName); // Prepend the domain to the query - $args = array_merge(array($this->getDomain()), $args); + $args = array_merge([$this->getDomain()], $args); return $reflectionObj->newInstanceArgs($args); } else { require_once 'Zend/Gdata/App/Exception.php'; diff --git a/library/Zend/Gdata/Gapps/EmailListEntry.php b/library/Zend/Gdata/Gapps/EmailListEntry.php index d5078db213..fe1c7f745b 100644 --- a/library/Zend/Gdata/Gapps/EmailListEntry.php +++ b/library/Zend/Gdata/Gapps/EmailListEntry.php @@ -75,7 +75,7 @@ class Zend_Gdata_Gapps_EmailListEntry extends Zend_Gdata_Entry * * @var Zend_Gdata_Extension_FeedLink */ - protected $_feedLink = array(); + protected $_feedLink = []; /** * Create a new instance. diff --git a/library/Zend/Gdata/Gapps/GroupEntry.php b/library/Zend/Gdata/Gapps/GroupEntry.php index 7dadd9a18a..d5b968a07c 100644 --- a/library/Zend/Gdata/Gapps/GroupEntry.php +++ b/library/Zend/Gdata/Gapps/GroupEntry.php @@ -60,7 +60,7 @@ class Zend_Gdata_Gapps_GroupEntry extends Zend_Gdata_Entry * * @var Zend_Gdata_Gapps_Extension_Property */ - protected $_property = array(); + protected $_property = []; /** * Create a new instance. diff --git a/library/Zend/Gdata/Gapps/MemberEntry.php b/library/Zend/Gdata/Gapps/MemberEntry.php index 8b7862295b..23a50af9c3 100644 --- a/library/Zend/Gdata/Gapps/MemberEntry.php +++ b/library/Zend/Gdata/Gapps/MemberEntry.php @@ -60,7 +60,7 @@ class Zend_Gdata_Gapps_MemberEntry extends Zend_Gdata_Entry * * @var Zend_Gdata_Gapps_Extension_Property */ - protected $_property = array(); + protected $_property = []; /** * Create a new instance. diff --git a/library/Zend/Gdata/Gapps/OwnerEntry.php b/library/Zend/Gdata/Gapps/OwnerEntry.php index 82391adfc5..07f303debc 100644 --- a/library/Zend/Gdata/Gapps/OwnerEntry.php +++ b/library/Zend/Gdata/Gapps/OwnerEntry.php @@ -60,7 +60,7 @@ class Zend_Gdata_Gapps_OwnerEntry extends Zend_Gdata_Entry * * @var Zend_Gdata_Gapps_Extension_Property */ - protected $_property = array(); + protected $_property = []; /** * Create a new instance. diff --git a/library/Zend/Gdata/Gapps/ServiceException.php b/library/Zend/Gdata/Gapps/ServiceException.php index 674ba4d156..f1177c1e0b 100644 --- a/library/Zend/Gdata/Gapps/ServiceException.php +++ b/library/Zend/Gdata/Gapps/ServiceException.php @@ -59,7 +59,7 @@ class Zend_Gdata_Gapps_ServiceException extends Zend_Exception * * @var array */ - protected $_errors = array(); + protected $_errors = []; /** * Create a new ServiceException. @@ -103,7 +103,7 @@ public function addError($error) { * @throws Zend_Gdata_App_Exception */ public function setErrors($array) { - $this->_errors = array(); + $this->_errors = []; foreach ($array as $error) { $this->addError($error); } diff --git a/library/Zend/Gdata/Gapps/UserEntry.php b/library/Zend/Gdata/Gapps/UserEntry.php index ca718f9b1e..9e7ffcc926 100644 --- a/library/Zend/Gdata/Gapps/UserEntry.php +++ b/library/Zend/Gdata/Gapps/UserEntry.php @@ -98,7 +98,7 @@ class Zend_Gdata_Gapps_UserEntry extends Zend_Gdata_Entry * * @var Zend_Gdata_Extension_FeedLink */ - protected $_feedLink = array(); + protected $_feedLink = []; /** * Create a new instance. diff --git a/library/Zend/Gdata/Geo.php b/library/Zend/Gdata/Geo.php index 85e4876deb..77c828deb7 100755 --- a/library/Zend/Gdata/Geo.php +++ b/library/Zend/Gdata/Geo.php @@ -47,10 +47,10 @@ class Zend_Gdata_Geo extends Zend_Gdata * * @var array */ - public static $namespaces = array( - array('georss', 'http://www.georss.org/georss', 1, 0), - array('gml', 'http://www.opengis.net/gml', 1, 0) - ); + public static $namespaces = [ + ['georss', 'http://www.georss.org/georss', 1, 0], + ['gml', 'http://www.opengis.net/gml', 1, 0] + ]; /** diff --git a/library/Zend/Gdata/HttpAdapterStreamingProxy.php b/library/Zend/Gdata/HttpAdapterStreamingProxy.php index aa2efeb54c..3d8d33cd01 100644 --- a/library/Zend/Gdata/HttpAdapterStreamingProxy.php +++ b/library/Zend/Gdata/HttpAdapterStreamingProxy.php @@ -55,7 +55,7 @@ class Zend_Gdata_HttpAdapterStreamingProxy extends Zend_Http_Client_Adapter_Prox * @param string $body * @return string Request as string */ - public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '') + public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') { // If no proxy is set, throw an error if (! $this->config['proxy_host']) { diff --git a/library/Zend/Gdata/HttpAdapterStreamingSocket.php b/library/Zend/Gdata/HttpAdapterStreamingSocket.php index b7a09cded6..3128368b2c 100644 --- a/library/Zend/Gdata/HttpAdapterStreamingSocket.php +++ b/library/Zend/Gdata/HttpAdapterStreamingSocket.php @@ -56,7 +56,7 @@ class Zend_Gdata_HttpAdapterStreamingSocket extends Zend_Http_Client_Adapter_Soc * @param string $body * @return string Request as string */ - public function write($method, $uri, $http_ver = '1.1', $headers = array(), + public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') { // Make sure we're properly connected diff --git a/library/Zend/Gdata/HttpClient.php b/library/Zend/Gdata/HttpClient.php index 060c081b5f..5e0946a6ea 100644 --- a/library/Zend/Gdata/HttpClient.php +++ b/library/Zend/Gdata/HttpClient.php @@ -207,7 +207,7 @@ public function setClientLoginToken($token) { * @return array The processed values in an associative array, * using the same names as the params */ - public function filterHttpRequest($method, $url, $headers = array(), $body = null, $contentType = null) { + public function filterHttpRequest($method, $url, $headers = [], $body = null, $contentType = null) { if ($this->getAuthSubToken() != null) { // AuthSub authentication if ($this->getAuthSubPrivateKeyId() != null) { @@ -240,7 +240,7 @@ public function filterHttpRequest($method, $url, $headers = array(), $body = nul } elseif ($this->getClientLoginToken() != null) { $headers['authorization'] = 'GoogleLogin auth=' . $this->getClientLoginToken(); } - return array('method' => $method, 'url' => $url, 'body' => $body, 'headers' => $headers, 'contentType' => $contentType); + return ['method' => $method, 'url' => $url, 'body' => $body, 'headers' => $headers, 'contentType' => $contentType]; } /** diff --git a/library/Zend/Gdata/Kind/EventEntry.php b/library/Zend/Gdata/Kind/EventEntry.php index ce9461a773..4f1a328bc3 100644 --- a/library/Zend/Gdata/Kind/EventEntry.php +++ b/library/Zend/Gdata/Kind/EventEntry.php @@ -97,16 +97,16 @@ */ class Zend_Gdata_Kind_EventEntry extends Zend_Gdata_Entry { - protected $_who = array(); - protected $_when = array(); - protected $_where = array(); + protected $_who = []; + protected $_when = []; + protected $_where = []; protected $_recurrence = null; protected $_eventStatus = null; protected $_comments = null; protected $_transparency = null; protected $_visibility = null; - protected $_recurrenceException = array(); - protected $_extendedProperty = array(); + protected $_recurrenceException = []; + protected $_extendedProperty = []; protected $_originalEvent = null; protected $_entryLink = null; diff --git a/library/Zend/Gdata/Media.php b/library/Zend/Gdata/Media.php index 2d09325e07..83bdc761eb 100755 --- a/library/Zend/Gdata/Media.php +++ b/library/Zend/Gdata/Media.php @@ -44,9 +44,9 @@ class Zend_Gdata_Media extends Zend_Gdata * * @var array */ - public static $namespaces = array( - array('media', 'http://search.yahoo.com/mrss/', 1, 0) - ); + public static $namespaces = [ + ['media', 'http://search.yahoo.com/mrss/', 1, 0] + ]; /** * Create Gdata_Media object diff --git a/library/Zend/Gdata/Media/Extension/MediaGroup.php b/library/Zend/Gdata/Media/Extension/MediaGroup.php index 7735aa5631..518ab3c6c8 100755 --- a/library/Zend/Gdata/Media/Extension/MediaGroup.php +++ b/library/Zend/Gdata/Media/Extension/MediaGroup.php @@ -118,12 +118,12 @@ class Zend_Gdata_Media_Extension_MediaGroup extends Zend_Gdata_Extension /** * @var array */ - protected $_content = array(); + protected $_content = []; /** * @var array */ - protected $_category = array(); + protected $_category = []; /** * @var Zend_Gdata_Media_Extension_MediaCopyright @@ -133,7 +133,7 @@ class Zend_Gdata_Media_Extension_MediaGroup extends Zend_Gdata_Extension /** * @var array */ - protected $_credit = array(); + protected $_credit = []; /** * @var Zend_Gdata_Media_Extension_MediaDescription @@ -143,7 +143,7 @@ class Zend_Gdata_Media_Extension_MediaGroup extends Zend_Gdata_Extension /** * @var array */ - protected $_hash = array(); + protected $_hash = []; /** * @var Zend_Gdata_Media_Extension_MediaKeywords @@ -153,27 +153,27 @@ class Zend_Gdata_Media_Extension_MediaGroup extends Zend_Gdata_Extension /** * @var array */ - protected $_player = array(); + protected $_player = []; /** * @var array */ - protected $_rating = array(); + protected $_rating = []; /** * @var array */ - protected $_restriction = array(); + protected $_restriction = []; /** * @var array */ - protected $_mediaText = array(); + protected $_mediaText = []; /** * @var array */ - protected $_thumbnail = array(); + protected $_thumbnail = []; /** * @var string diff --git a/library/Zend/Gdata/MediaMimeStream.php b/library/Zend/Gdata/MediaMimeStream.php index 8973e7e0b8..ca93f0b8b0 100644 --- a/library/Zend/Gdata/MediaMimeStream.php +++ b/library/Zend/Gdata/MediaMimeStream.php @@ -102,7 +102,7 @@ public function __construct($xmlString = null, $filePath = null, $entry = $this->wrapEntry($xmlString, $fileContentType); $closingBoundary = new Zend_Gdata_MimeBodyString("\r\n--{$this->_boundaryString}--\r\n"); $file = new Zend_Gdata_MimeFile($this->_fileHandle); - $this->_parts = array($entry, $file, $closingBoundary); + $this->_parts = [$entry, $file, $closingBoundary]; $fileSize = filesize($filePath); $this->_totalSize = $entry->getSize() + $fileSize diff --git a/library/Zend/Gdata/Photos.php b/library/Zend/Gdata/Photos.php index d052b7c0c3..7697fc0800 100755 --- a/library/Zend/Gdata/Photos.php +++ b/library/Zend/Gdata/Photos.php @@ -112,14 +112,14 @@ class Zend_Gdata_Photos extends Zend_Gdata * * @var array */ - public static $namespaces = array( - array('gphoto', 'http://schemas.google.com/photos/2007', 1, 0), - array('photo', 'http://www.pheed.com/pheed/', 1, 0), - array('exif', 'http://schemas.google.com/photos/exif/2007', 1, 0), - array('georss', 'http://www.georss.org/georss', 1, 0), - array('gml', 'http://www.opengis.net/gml', 1, 0), - array('media', 'http://search.yahoo.com/mrss/', 1, 0) - ); + public static $namespaces = [ + ['gphoto', 'http://schemas.google.com/photos/2007', 1, 0], + ['photo', 'http://www.pheed.com/pheed/', 1, 0], + ['exif', 'http://schemas.google.com/photos/exif/2007', 1, 0], + ['georss', 'http://www.georss.org/georss', 1, 0], + ['gml', 'http://www.opengis.net/gml', 1, 0], + ['media', 'http://search.yahoo.com/mrss/', 1, 0] + ]; /** * Create Zend_Gdata_Photos object diff --git a/library/Zend/Gdata/Photos/AlbumEntry.php b/library/Zend/Gdata/Photos/AlbumEntry.php index 0e2243c147..e790d71669 100755 --- a/library/Zend/Gdata/Photos/AlbumEntry.php +++ b/library/Zend/Gdata/Photos/AlbumEntry.php @@ -204,7 +204,7 @@ public function __construct($element = null) $category = new Zend_Gdata_App_Extension_Category( 'http://schemas.google.com/photos/2007#album', 'http://schemas.google.com/g/2005#kind'); - $this->setCategory(array($category)); + $this->setCategory([$category]); } /** diff --git a/library/Zend/Gdata/Photos/AlbumFeed.php b/library/Zend/Gdata/Photos/AlbumFeed.php index 0addc7a949..9264770654 100755 --- a/library/Zend/Gdata/Photos/AlbumFeed.php +++ b/library/Zend/Gdata/Photos/AlbumFeed.php @@ -124,11 +124,11 @@ class Zend_Gdata_Photos_AlbumFeed extends Zend_Gdata_Feed */ protected $_gphotoCommentingEnabled = null; - protected $_entryKindClassMapping = array( + protected $_entryKindClassMapping = [ 'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry', 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry' - ); + ]; public function __construct($element = null) { diff --git a/library/Zend/Gdata/Photos/CommentEntry.php b/library/Zend/Gdata/Photos/CommentEntry.php index 8eb68f7060..c1409f6211 100755 --- a/library/Zend/Gdata/Photos/CommentEntry.php +++ b/library/Zend/Gdata/Photos/CommentEntry.php @@ -96,7 +96,7 @@ public function __construct($element = null) $category = new Zend_Gdata_App_Extension_Category( 'http://schemas.google.com/photos/2007#comment', 'http://schemas.google.com/g/2005#kind'); - $this->setCategory(array($category)); + $this->setCategory([$category]); } /** diff --git a/library/Zend/Gdata/Photos/PhotoEntry.php b/library/Zend/Gdata/Photos/PhotoEntry.php index 9ce381c762..54c4a65008 100755 --- a/library/Zend/Gdata/Photos/PhotoEntry.php +++ b/library/Zend/Gdata/Photos/PhotoEntry.php @@ -226,7 +226,7 @@ public function __construct($element = null) $category = new Zend_Gdata_App_Extension_Category( 'http://schemas.google.com/photos/2007#photo', 'http://schemas.google.com/g/2005#kind'); - $this->setCategory(array($category)); + $this->setCategory([$category]); } /** diff --git a/library/Zend/Gdata/Photos/PhotoFeed.php b/library/Zend/Gdata/Photos/PhotoFeed.php index d2795c53d4..2a3fd0d784 100755 --- a/library/Zend/Gdata/Photos/PhotoFeed.php +++ b/library/Zend/Gdata/Photos/PhotoFeed.php @@ -139,10 +139,10 @@ class Zend_Gdata_Photos_PhotoFeed extends Zend_Gdata_Feed protected $_entryClassName = 'Zend_Gdata_Photos_PhotoEntry'; protected $_feedClassName = 'Zend_Gdata_Photos_PhotoFeed'; - protected $_entryKindClassMapping = array( + protected $_entryKindClassMapping = [ 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry' - ); + ]; public function __construct($element = null) { diff --git a/library/Zend/Gdata/Photos/TagEntry.php b/library/Zend/Gdata/Photos/TagEntry.php index 378a6d3586..f436c7937d 100755 --- a/library/Zend/Gdata/Photos/TagEntry.php +++ b/library/Zend/Gdata/Photos/TagEntry.php @@ -72,7 +72,7 @@ public function __construct($element = null) $category = new Zend_Gdata_App_Extension_Category( 'http://schemas.google.com/photos/2007#tag', 'http://schemas.google.com/g/2005#kind'); - $this->setCategory(array($category)); + $this->setCategory([$category]); } /** diff --git a/library/Zend/Gdata/Photos/UserEntry.php b/library/Zend/Gdata/Photos/UserEntry.php index 00b5fc1816..675ecac22a 100755 --- a/library/Zend/Gdata/Photos/UserEntry.php +++ b/library/Zend/Gdata/Photos/UserEntry.php @@ -142,7 +142,7 @@ public function __construct($element = null) $category = new Zend_Gdata_App_Extension_Category( 'http://schemas.google.com/photos/2007#user', 'http://schemas.google.com/g/2005#kind'); - $this->setCategory(array($category)); + $this->setCategory([$category]); } /** diff --git a/library/Zend/Gdata/Photos/UserFeed.php b/library/Zend/Gdata/Photos/UserFeed.php index 9f5b86231d..5a653b039f 100755 --- a/library/Zend/Gdata/Photos/UserFeed.php +++ b/library/Zend/Gdata/Photos/UserFeed.php @@ -96,12 +96,12 @@ class Zend_Gdata_Photos_UserFeed extends Zend_Gdata_Feed protected $_entryClassName = 'Zend_Gdata_Photos_UserEntry'; protected $_feedClassName = 'Zend_Gdata_Photos_UserFeed'; - protected $_entryKindClassMapping = array( + protected $_entryKindClassMapping = [ 'http://schemas.google.com/photos/2007#album' => 'Zend_Gdata_Photos_AlbumEntry', 'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry', 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry' - ); + ]; public function __construct($element = null) { diff --git a/library/Zend/Gdata/Query.php b/library/Zend/Gdata/Query.php index 80f780f5de..337f4e8d07 100644 --- a/library/Zend/Gdata/Query.php +++ b/library/Zend/Gdata/Query.php @@ -45,7 +45,7 @@ class Zend_Gdata_Query * * @var array */ - protected $_params = array(); + protected $_params = []; /** * Default URL @@ -82,7 +82,7 @@ public function __construct($url = null) */ public function getQueryString() { - $queryArray = array(); + $queryArray = []; foreach ($this->_params as $name => $value) { if (substr($name, 0, 1) == '_') { continue; @@ -101,7 +101,7 @@ public function getQueryString() */ public function resetParameters() { - $this->_params = array(); + $this->_params = []; } /** @@ -397,7 +397,7 @@ public function __get($name) { $method = 'get'.ucfirst($name); if (method_exists($this, $method)) { - return call_user_func(array(&$this, $method)); + return call_user_func([&$this, $method]); } else { require_once 'Zend/Gdata/App/Exception.php'; throw new Zend_Gdata_App_Exception('Property ' . $name . ' does not exist'); @@ -408,7 +408,7 @@ public function __set($name, $val) { $method = 'set'.ucfirst($name); if (method_exists($this, $method)) { - return call_user_func(array(&$this, $method), $val); + return call_user_func([&$this, $method], $val); } else { require_once 'Zend/Gdata/App/Exception.php'; throw new Zend_Gdata_App_Exception('Property ' . $name . ' does not exist'); diff --git a/library/Zend/Gdata/Spreadsheets.php b/library/Zend/Gdata/Spreadsheets.php index 8887b01ae2..1c35389e0b 100644 --- a/library/Zend/Gdata/Spreadsheets.php +++ b/library/Zend/Gdata/Spreadsheets.php @@ -106,11 +106,11 @@ class Zend_Gdata_Spreadsheets extends Zend_Gdata * * @var array */ - public static $namespaces = array( - array('gs', 'http://schemas.google.com/spreadsheets/2006', 1, 0), - array( - 'gsx', 'http://schemas.google.com/spreadsheets/2006/extended', 1, 0) - ); + public static $namespaces = [ + ['gs', 'http://schemas.google.com/spreadsheets/2006', 1, 0], + [ + 'gsx', 'http://schemas.google.com/spreadsheets/2006/extended', 1, 0] + ]; /** * Create Gdata_Spreadsheets object @@ -319,7 +319,7 @@ public function updateCell($row, $col, $inputValue, $key, $wkshtId = 'default') public function insertRow($rowData, $key, $wkshtId = 'default') { $newEntry = new Zend_Gdata_Spreadsheets_ListEntry(); - $newCustomArr = array(); + $newCustomArr = []; foreach ($rowData as $k => $v) { $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom(); $newCustom->setText($v)->setColumnName($k); @@ -344,7 +344,7 @@ public function insertRow($rowData, $key, $wkshtId = 'default') */ public function updateRow($entry, $newRowData) { - $newCustomArr = array(); + $newCustomArr = []; foreach ($newRowData as $k => $v) { $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom(); $newCustom->setText($v)->setColumnName($k); @@ -375,9 +375,9 @@ public function getSpreadsheetListFeedContents($location) { $listFeed = $this->getListFeed($location); $listFeed = $this->retrieveAllEntriesForFeed($listFeed); - $spreadsheetContents = array(); + $spreadsheetContents = []; foreach ($listFeed as $listEntry) { - $rowContents = array(); + $rowContents = []; $customArray = $listEntry->getCustom(); foreach ($customArray as $custom) { $rowContents[$custom->getColumnName()] = $custom->getText(); @@ -420,9 +420,9 @@ public function getSpreadsheetCellFeedContents($location, $range = null, $empty $cellFeed = $this->getCellFeed($cellQuery); $cellFeed = $this->retrieveAllEntriesForFeed($cellFeed); - $spreadsheetContents = array(); + $spreadsheetContents = []; foreach ($cellFeed as $cellEntry) { - $cellContents = array(); + $cellContents = []; $cell = $cellEntry->getCell(); $cellContents['formula'] = $cell->getInputValue(); $cellContents['value'] = $cell->getText(); diff --git a/library/Zend/Gdata/Spreadsheets/ListEntry.php b/library/Zend/Gdata/Spreadsheets/ListEntry.php index 3f950c1aa7..d05a1371d6 100644 --- a/library/Zend/Gdata/Spreadsheets/ListEntry.php +++ b/library/Zend/Gdata/Spreadsheets/ListEntry.php @@ -50,14 +50,14 @@ class Zend_Gdata_Spreadsheets_ListEntry extends Zend_Gdata_Entry * indexed by order added to this entry. * @var array */ - protected $_custom = array(); + protected $_custom = []; /** * List of custom row elements (Zend_Gdata_Spreadsheets_Extension_Custom), * indexed by element name. * @var array */ - protected $_customByName = array(); + protected $_customByName = []; /** * Constructs a new Zend_Gdata_Spreadsheets_ListEntry object. @@ -136,7 +136,7 @@ public function getCustomByName($name = null) */ public function setCustom($custom) { - $this->_custom = array(); + $this->_custom = []; foreach ($custom as $c) { $this->addCustom($c); } diff --git a/library/Zend/Http/Client.php b/library/Zend/Http/Client.php index b704249cc2..8ff722d627 100644 --- a/library/Zend/Http/Client.php +++ b/library/Zend/Http/Client.php @@ -120,7 +120,7 @@ class Zend_Http_Client * * @var array */ - protected $config = array( + protected $config = [ 'maxredirects' => 5, 'strictredirects' => false, 'useragent' => 'Zend_Http_Client', @@ -133,7 +133,7 @@ class Zend_Http_Client 'output_stream' => false, 'encodecookies' => true, 'rfc3986_strict' => false - ); + ]; /** * The adapter used to perform the actual connection to the server @@ -154,7 +154,7 @@ class Zend_Http_Client * * @var array */ - protected $headers = array(); + protected $headers = []; /** * HTTP request method @@ -168,14 +168,14 @@ class Zend_Http_Client * * @var array */ - protected $paramsGet = array(); + protected $paramsGet = []; /** * Associative array of POST parameters * * @var array */ - protected $paramsPost = array(); + protected $paramsPost = []; /** * Request body content type (for POST requests) @@ -213,7 +213,7 @@ class Zend_Http_Client * * @var array */ - protected $files = array(); + protected $files = []; /** * Ordered list of keys from key/value pair data to include in body @@ -223,7 +223,7 @@ class Zend_Http_Client * * @var array */ - protected $body_field_order = array(); + protected $body_field_order = []; /** * The client's cookie jar @@ -355,7 +355,7 @@ public function getUri($as_string = false) * @return Zend_Http_Client * @throws Zend_Http_Client_Exception */ - public function setConfig($config = array()) + public function setConfig($config = []) { if ($config instanceof Zend_Config) { $config = $config->toArray(); @@ -470,7 +470,7 @@ public function setHeaders($name, $value = null) if (is_string($value)) { $value = trim($value); } - $this->headers[$normalized_name] = array($name, $value); + $this->headers[$normalized_name] = [$name, $value]; return $this; } @@ -542,7 +542,7 @@ public function setParameterPost($name, $value = null) */ protected function _setParameter($type, $name, $value) { - $parray = array(); + $parray = []; $type = strtolower($type); switch ($type) { case 'get': @@ -619,11 +619,11 @@ public function setAuth($user, $password = '', $type = self::AUTH_BASIC) throw new Zend_Http_Client_Exception("Invalid or not supported authentication type: '$type'"); } - $this->auth = array( + $this->auth = [ 'user' => (string) $user, 'password' => (string) $password, 'type' => $type - ); + ]; } return $this; @@ -722,7 +722,7 @@ public function setCookie($cookie, $value = null) $value = addslashes($value); if (! isset($this->headers['cookie'])) { - $this->headers['cookie'] = array('Cookie', ''); + $this->headers['cookie'] = ['Cookie', '']; } $this->headers['cookie'][1] .= $cookie . '=' . $value . '; '; } @@ -767,12 +767,12 @@ public function setFileUpload($filename, $formname, $data = null, $ctype = null) // Force enctype to multipart/form-data $this->setEncType(self::ENC_FORMDATA); - $this->files[] = array( + $this->files[] = [ 'formname' => $formname, 'filename' => basename($filename), 'ctype' => $ctype, 'data' => $data - ); + ]; $this->body_field_order[$formname] = self::VTYPE_FILE; @@ -864,14 +864,14 @@ public function getUnmaskStatus() public function resetParameters($clearAll = false) { // Reset parameter data - $this->paramsGet = array(); - $this->paramsPost = array(); - $this->files = array(); + $this->paramsGet = []; + $this->paramsPost = []; + $this->files = []; $this->raw_post_data = null; $this->enctype = null; if($clearAll) { - $this->headers = array(); + $this->headers = []; $this->last_request = null; $this->last_response = null; } else { @@ -968,7 +968,7 @@ public function getAdapter() */ public function setStream($streamfile = true) { - $this->setConfig(array("output_stream" => $streamfile)); + $this->setConfig(["output_stream" => $streamfile]); return $this; } @@ -1182,7 +1182,7 @@ public function request($method = null) */ protected function _prepareHeaders() { - $headers = array(); + $headers = []; // Set the host header if (! isset($this->headers['host'])) { @@ -1311,7 +1311,7 @@ protected function _prepareBody() case self::VTYPE_FILE: foreach ($this->files as $file) { if ($file['formname']===$fieldName) { - $fhead = array(self::CONTENT_TYPE => $file['ctype']); + $fhead = [self::CONTENT_TYPE => $file['ctype']]; $body .= self::encodeFormData($boundary, $file['formname'], $file['data'], $file['filename'], $fhead); } } @@ -1391,7 +1391,7 @@ protected function _getParametersRecursive($parray, $urlencode = false) if (! is_array($parray)) { return $parray; } - $parameters = array(); + $parameters = []; foreach ($parray as $name => $value) { if ($urlencode) { @@ -1405,13 +1405,13 @@ protected function _getParametersRecursive($parray, $urlencode = false) if ($urlencode) { $subval = urlencode($subval); } - $parameters[] = array($name, $subval); + $parameters[] = [$name, $subval]; } } else { if ($urlencode) { $value = urlencode($value); } - $parameters[] = array($name, $value); + $parameters[] = [$name, $value]; } } @@ -1468,7 +1468,7 @@ protected function _detectFileMimeType($file) * @param array $headers Associative array of optional headers @example ("Content-Transfer-Encoding" => "binary") * @return string */ - public static function encodeFormData($boundary, $name, $value, $filename = null, $headers = array()) + public static function encodeFormData($boundary, $name, $value, $filename = null, $headers = []) { $ret = "--{$boundary}\r\n" . 'Content-Disposition: form-data; name="' . $name .'"'; @@ -1550,7 +1550,7 @@ protected static function _flattenParametersArray($parray, $prefix = null) return $parray; } - $parameters = array(); + $parameters = []; foreach($parray as $name => $value) { @@ -1569,7 +1569,7 @@ protected static function _flattenParametersArray($parray, $prefix = null) $parameters = array_merge($parameters, self::_flattenParametersArray($value, $key)); } else { - $parameters[] = array($key, $value); + $parameters[] = [$key, $value]; } } diff --git a/library/Zend/Http/Client/Adapter/Curl.php b/library/Zend/Http/Client/Adapter/Curl.php index d71da2a790..529baae565 100644 --- a/library/Zend/Http/Client/Adapter/Curl.php +++ b/library/Zend/Http/Client/Adapter/Curl.php @@ -52,14 +52,14 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac * * @var array */ - protected $_config = array(); + protected $_config = []; /** * What host/port are we connected to? * * @var array */ - protected $_connected_to = array(null, null); + protected $_connected_to = [null, null]; /** * The curl session handle @@ -103,7 +103,7 @@ public function __construct() require_once 'Zend/Http/Client/Adapter/Exception.php'; throw new Zend_Http_Client_Adapter_Exception('cURL extension has to be loaded to use this Zend_Http_Client adapter.'); } - $this->_invalidOverwritableCurlOptions = array( + $this->_invalidOverwritableCurlOptions = [ CURLOPT_HTTPGET, CURLOPT_POST, CURLOPT_PUT, @@ -119,7 +119,7 @@ public function __construct() CURLOPT_CONNECTTIMEOUT, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_1_0, - ); + ]; } /** @@ -129,7 +129,7 @@ public function __construct() * @param Zend_Config | array $config * @return Zend_Http_Client_Adapter_Curl */ - public function setConfig($config = array()) + public function setConfig($config = []) { if ($config instanceof Zend_Config) { $config = $config->toArray(); @@ -184,7 +184,7 @@ public function getConfig() public function setCurlOption($option, $value) { if (!isset($this->_config['curloptions'])) { - $this->_config['curloptions'] = array(); + $this->_config['curloptions'] = []; } $this->_config['curloptions'][$option] = $value; return $this; @@ -262,7 +262,7 @@ public function connect($host, $port = 80, $secure = false) } // Update connected_to - $this->_connected_to = array($host, $port); + $this->_connected_to = [$host, $port]; } /** @@ -276,7 +276,7 @@ public function connect($host, $port = 80, $secure = false) * @return string $request * @throws Zend_Http_Client_Adapter_Exception If connection fails, connected to wrong host, no PUT file defined, unsupported method, or unsupported cURL option */ - public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $body = '') + public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = '') { // Make sure we're properly connected if (!$this->_curl) { @@ -383,7 +383,7 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $bo if($this->out_stream) { // headers will be read into the response curl_setopt($this->_curl, CURLOPT_HEADER, false); - curl_setopt($this->_curl, CURLOPT_HEADERFUNCTION, array($this, "readHeader")); + curl_setopt($this->_curl, CURLOPT_HEADERFUNCTION, [$this, "readHeader"]); // and data will be written into the file curl_setopt($this->_curl, CURLOPT_FILE, $this->out_stream); } else { @@ -499,7 +499,7 @@ public function close() curl_close($this->_curl); } $this->_curl = null; - $this->_connected_to = array(null, null); + $this->_connected_to = [null, null]; } /** diff --git a/library/Zend/Http/Client/Adapter/Interface.php b/library/Zend/Http/Client/Adapter/Interface.php index 3ed8a77724..ca26df0c80 100644 --- a/library/Zend/Http/Client/Adapter/Interface.php +++ b/library/Zend/Http/Client/Adapter/Interface.php @@ -40,7 +40,7 @@ interface Zend_Http_Client_Adapter_Interface * * @param array $config */ - public function setConfig($config = array()); + public function setConfig($config = []); /** * Connect to the remote server @@ -61,7 +61,7 @@ public function connect($host, $port = 80, $secure = false); * @param string $body * @return string Request as text */ - public function write($method, $url, $http_ver = '1.1', $headers = array(), $body = ''); + public function write($method, $url, $http_ver = '1.1', $headers = [], $body = ''); /** * Read response from server diff --git a/library/Zend/Http/Client/Adapter/Proxy.php b/library/Zend/Http/Client/Adapter/Proxy.php index 090e570cba..a6194d1ead 100644 --- a/library/Zend/Http/Client/Adapter/Proxy.php +++ b/library/Zend/Http/Client/Adapter/Proxy.php @@ -56,7 +56,7 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket * * @var array */ - protected $config = array( + protected $config = [ 'ssltransport' => 'ssl', 'sslcert' => null, 'sslpassphrase' => null, @@ -67,7 +67,7 @@ class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket 'proxy_pass' => '', 'proxy_auth' => Zend_Http_Client::AUTH_BASIC, 'persistent' => false, - ); + ]; /** * Whether HTTPS CONNECT was already negotiated with the proxy or not @@ -125,7 +125,7 @@ public function connect($host, $port = 80, $secure = false) * @throws Zend_Http_Client_Adapter_Exception */ public function write( - $method, $uri, $http_ver = '1.1', $headers = array(), $body = '' + $method, $uri, $http_ver = '1.1', $headers = [], $body = '' ) { // If no proxy is set, fall back to default Socket adapter @@ -240,7 +240,7 @@ public function write( * @throws Zend_Http_Client_Adapter_Exception */ protected function connectHandshake( - $host, $port = 443, $http_ver = '1.1', array &$headers = array() + $host, $port = 443, $http_ver = '1.1', array &$headers = [] ) { $request = "CONNECT $host:$port HTTP/$http_ver\r\n" . @@ -296,12 +296,12 @@ protected function connectHandshake( // If all is good, switch socket to secure mode. We have to fall back // through the different modes - $modes = array( + $modes = [ STREAM_CRYPTO_METHOD_TLS_CLIENT, STREAM_CRYPTO_METHOD_SSLv3_CLIENT, STREAM_CRYPTO_METHOD_SSLv23_CLIENT, STREAM_CRYPTO_METHOD_SSLv2_CLIENT - ); + ]; $success = false; foreach($modes as $mode) { diff --git a/library/Zend/Http/Client/Adapter/Socket.php b/library/Zend/Http/Client/Adapter/Socket.php index e9c6f3ecc5..eb3f6699eb 100644 --- a/library/Zend/Http/Client/Adapter/Socket.php +++ b/library/Zend/Http/Client/Adapter/Socket.php @@ -58,7 +58,7 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf * * @var array */ - protected $connected_to = array(null, null); + protected $connected_to = [null, null]; /** * Stream for storing output @@ -72,13 +72,13 @@ class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interf * * @var array */ - protected $config = array( + protected $config = [ 'persistent' => false, 'ssltransport' => 'ssl', 'sslcert' => null, 'sslpassphrase' => null, 'sslusecontext' => false - ); + ]; /** * Request method - will be set by write() and might be used by read() @@ -107,7 +107,7 @@ public function __construct() * * @param Zend_Config | array $config */ - public function setConfig($config = array()) + public function setConfig($config = []) { if ($config instanceof Zend_Config) { $config = $config->toArray(); @@ -249,7 +249,7 @@ public function connect($host, $port = 80, $secure = false) } // Update connected_to - $this->connected_to = array($host, $port); + $this->connected_to = [$host, $port]; } } @@ -263,7 +263,7 @@ public function connect($host, $port = 80, $secure = false) * @param string $body * @return string Request as string */ - public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '') + public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') { // Make sure we're properly connected if (! $this->socket) { @@ -497,7 +497,7 @@ public function close() { if (is_resource($this->socket)) @fclose($this->socket); $this->socket = null; - $this->connected_to = array(null, null); + $this->connected_to = [null, null]; } /** diff --git a/library/Zend/Http/Client/Adapter/Test.php b/library/Zend/Http/Client/Adapter/Test.php index fc70b8af1f..4dcbc75fc2 100644 --- a/library/Zend/Http/Client/Adapter/Test.php +++ b/library/Zend/Http/Client/Adapter/Test.php @@ -54,7 +54,7 @@ class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interfac * * @var array */ - protected $config = array(); + protected $config = []; /** * Buffer of responses to be returned by the read() method. Can be @@ -62,7 +62,7 @@ class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interfac * * @var array */ - protected $responses = array("HTTP/1.1 400 Bad Request\r\n\r\n"); + protected $responses = ["HTTP/1.1 400 Bad Request\r\n\r\n"]; /** * Current position in the response buffer @@ -103,7 +103,7 @@ public function setNextRequestWillFail($flag) * * @param Zend_Config | array $config */ - public function setConfig($config = array()) + public function setConfig($config = []) { if ($config instanceof Zend_Config) { $config = $config->toArray(); @@ -149,7 +149,7 @@ public function connect($host, $port = 80, $secure = false) * @param string $body * @return string Request as string */ - public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '') + public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') { $host = $uri->getHost(); $host = (strtolower($uri->getScheme()) == 'https' ? 'sslv2://' . $host : $host); diff --git a/library/Zend/Http/CookieJar.php b/library/Zend/Http/CookieJar.php index a76d1fcf10..858c1b3d40 100644 --- a/library/Zend/Http/CookieJar.php +++ b/library/Zend/Http/CookieJar.php @@ -101,14 +101,14 @@ class Zend_Http_CookieJar implements Countable, IteratorAggregate * * @var array */ - protected $cookies = array(); + protected $cookies = []; /** * The Zend_Http_Cookie array * * @var array */ - protected $_rawCookies = array(); + protected $_rawCookies = []; /** * Construct a new CookieJar object @@ -134,8 +134,8 @@ public function addCookie($cookie, $ref_uri = null, $encodeValue = true) if ($cookie instanceof Zend_Http_Cookie) { $domain = $cookie->getDomain(); $path = $cookie->getPath(); - if (! isset($this->cookies[$domain])) $this->cookies[$domain] = array(); - if (! isset($this->cookies[$domain][$path])) $this->cookies[$domain][$path] = array(); + if (! isset($this->cookies[$domain])) $this->cookies[$domain] = []; + if (! isset($this->cookies[$domain][$path])) $this->cookies[$domain][$path] = []; $this->cookies[$domain][$path][$cookie->getName()] = $cookie; $this->_rawCookies[] = $cookie; } else { @@ -212,7 +212,7 @@ public function getMatchingCookies($uri, $matchSessionCookies = true, $cookies = $this->_flattenCookiesArray($cookies, self::COOKIE_OBJECT); // Next, run Cookie->match on all cookies to check secure, time and session mathcing - $ret = array(); + $ret = []; foreach ($cookies as $cookie) if ($cookie->match($uri, $matchSessionCookies, $now)) $ret[] = $cookie; @@ -287,7 +287,7 @@ public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT) */ protected function _flattenCookiesArray($ptr, $ret_as = self::COOKIE_OBJECT) { if (is_array($ptr)) { - $ret = ($ret_as == self::COOKIE_STRING_CONCAT || $ret_as == self::COOKIE_STRING_CONCAT_STRICT) ? '' : array(); + $ret = ($ret_as == self::COOKIE_STRING_CONCAT || $ret_as == self::COOKIE_STRING_CONCAT_STRICT) ? '' : []; foreach ($ptr as $item) { if ($ret_as == self::COOKIE_STRING_CONCAT_STRICT) { $postfix_combine = (!is_array($item) ? ' ' : ''); @@ -302,7 +302,7 @@ protected function _flattenCookiesArray($ptr, $ret_as = self::COOKIE_OBJECT) { } elseif ($ptr instanceof Zend_Http_Cookie) { switch ($ret_as) { case self::COOKIE_STRING_ARRAY: - return array($ptr->__toString()); + return [$ptr->__toString()]; break; case self::COOKIE_STRING_CONCAT_STRICT: @@ -314,7 +314,7 @@ protected function _flattenCookiesArray($ptr, $ret_as = self::COOKIE_OBJECT) { case self::COOKIE_OBJECT: default: - return array($ptr); + return [$ptr]; break; } } @@ -330,7 +330,7 @@ protected function _flattenCookiesArray($ptr, $ret_as = self::COOKIE_OBJECT) { */ protected function _matchDomain($domain) { - $ret = array(); + $ret = []; foreach (array_keys($this->cookies) as $cdom) { if (Zend_Http_Cookie::matchCookieDomain($cdom, $domain)) { @@ -350,13 +350,13 @@ protected function _matchDomain($domain) */ protected function _matchPath($domains, $path) { - $ret = array(); + $ret = []; foreach ($domains as $dom => $paths_array) { foreach (array_keys($paths_array) as $cpath) { if (Zend_Http_Cookie::matchCookiePath($cpath, $path)) { if (! isset($ret[$dom])) { - $ret[$dom] = array(); + $ret[$dom] = []; } $ret[$dom][$cpath] = $paths_array[$cpath]; @@ -422,7 +422,7 @@ public function isEmpty() */ public function reset() { - $this->cookies = $this->_rawCookies = array(); + $this->cookies = $this->_rawCookies = []; return $this; } } diff --git a/library/Zend/Http/Header/SetCookie.php b/library/Zend/Http/Header/SetCookie.php index 9cf7837167..c28f545a75 100644 --- a/library/Zend/Http/Header/SetCookie.php +++ b/library/Zend/Http/Header/SetCookie.php @@ -133,7 +133,7 @@ public static function fromString($headerLine, $bypassHeaderFieldName = false) } $multipleHeaders = preg_split('#(?setExpires($headerValue); break; case 'domain' : $header->setDomain($headerValue); break; case 'path' : $header->setPath($headerValue); break; diff --git a/library/Zend/Http/Response.php b/library/Zend/Http/Response.php index af3e2dbb19..3be629c7b1 100644 --- a/library/Zend/Http/Response.php +++ b/library/Zend/Http/Response.php @@ -44,7 +44,7 @@ class Zend_Http_Response * * @var array */ - protected static $messages = array( + protected static $messages = [ // Informational 1xx 100 => 'Continue', 101 => 'Switching Protocols', @@ -96,7 +96,7 @@ class Zend_Http_Response 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', 509 => 'Bandwidth Limit Exceeded' - ); + ]; /** * The HTTP version (1.0, 1.1) @@ -125,7 +125,7 @@ class Zend_Http_Response * * @var array */ - protected $headers = array(); + protected $headers = []; /** * The HTTP response body @@ -499,7 +499,7 @@ public static function extractVersion($response_str) */ public static function extractHeaders($response_str) { - $headers = array(); + $headers = []; // First, split body and headers. Headers are separated from the // message at exactly the sequence "\r\n\r\n" @@ -533,7 +533,7 @@ public static function extractHeaders($response_str) if (isset($headers[$h_name])) { if (! is_array($headers[$h_name])) { - $headers[$h_name] = array($headers[$h_name]); + $headers[$h_name] = [$headers[$h_name]]; } $headers[$h_name][] = ltrim($h_value); @@ -677,7 +677,7 @@ public static function decodeDeflate($body) * @link http://framework.zend.com/issues/browse/ZF-6040 */ $zlibHeader = unpack('n', substr($body, 0, 2)); - if ($zlibHeader[1] % 31 == 0 && ord($body[0]) == 0x78 && in_array(ord($body[1]), array(0x01, 0x5e, 0x9c, 0xda))) { + if ($zlibHeader[1] % 31 == 0 && ord($body[0]) == 0x78 && in_array(ord($body[1]), [0x01, 0x5e, 0x9c, 0xda])) { return gzuncompress($body); } else { return gzinflate($body); diff --git a/library/Zend/Http/UserAgent.php b/library/Zend/Http/UserAgent.php index 5f7226fd9d..741456ac32 100644 --- a/library/Zend/Http/UserAgent.php +++ b/library/Zend/Http/UserAgent.php @@ -80,7 +80,7 @@ class Zend_Http_UserAgent implements Serializable * * @var array */ - protected $_browserTypeClass = array(); + protected $_browserTypeClass = []; /** * Array to store config @@ -90,12 +90,12 @@ class Zend_Http_UserAgent implements Serializable * * @var array */ - protected $_config = array( + protected $_config = [ 'identification_sequence' => self::DEFAULT_IDENTIFICATION_SEQUENCE, - 'storage' => array( + 'storage' => [ 'adapter' => self::DEFAULT_PERSISTENT_STORAGE_ADAPTER, - ), - ); + ], + ]; /** * Identified device @@ -122,20 +122,20 @@ class Zend_Http_UserAgent implements Serializable * Plugin loaders * @var array */ - protected $_loaders = array(); + protected $_loaders = []; /** * Valid plugin loader types * @var array */ - protected $_loaderTypes = array('storage', 'device'); + protected $_loaderTypes = ['storage', 'device']; /** * Trace of items matched to identify the browser type * * @var array */ - protected $_matchLog = array(); + protected $_matchLog = []; /** * Server variable @@ -172,14 +172,14 @@ public function __construct($options = null) public function serialize() { $device = $this->getDevice(); - $spec = array( + $spec = [ 'browser_type' => $this->_browserType, 'config' => $this->_config, 'device_class' => get_class($device), 'device' => $device->serialize(), 'user_agent' => $this->getServerValue('http_user_agent'), 'http_accept' => $this->getServerValue('http_accept'), - ); + ]; return serialize($spec); } @@ -249,7 +249,7 @@ public function setOptions($options) } // And then loop through the remaining options - $config = array(); + $config = []; foreach ($options as $key => $value) { switch (strtolower($key)) { case 'browser_type': @@ -296,7 +296,7 @@ protected function _match($deviceClass) // Call match method on device class return call_user_func( - array($deviceClass, 'match'), + [$deviceClass, 'match'], $userAgent, $this->getServer() ); @@ -432,7 +432,7 @@ public function getStorage($browser = null) $adapter = $loader->load($adapter); $loader = $this->getPluginLoader('storage'); } - $options = array('browser_type' => $browser); + $options = ['browser_type' => $browser]; if (isset($config['options'])) { $options = array_merge($options, $config['options']); } @@ -500,7 +500,7 @@ public function getConfig() * @param mixed $config (option) Config array * @return Zend_Http_UserAgent */ - public function setConfig($config = array()) + public function setConfig($config = []) { if ($config instanceof Zend_Config) { $config = $config->toArray(); @@ -516,7 +516,7 @@ public function setConfig($config = array()) } if ($config instanceof Traversable) { - $tmp = array(); + $tmp = []; foreach ($config as $key => $value) { $tmp[$key] = $value; } @@ -649,7 +649,7 @@ public function setServer($server) if ($server instanceof ArrayObject) { $server = $server->getArrayCopy(); } elseif ($server instanceof Traversable) { - $tmp = array(); + $tmp = []; foreach ($server as $key => $value) { $tmp[$key] = $value; } diff --git a/library/Zend/Http/UserAgent/AbstractDevice.php b/library/Zend/Http/UserAgent/AbstractDevice.php index 75d057f1cf..9f36be792b 100644 --- a/library/Zend/Http/UserAgent/AbstractDevice.php +++ b/library/Zend/Http/UserAgent/AbstractDevice.php @@ -73,28 +73,28 @@ abstract class Zend_Http_UserAgent_AbstractDevice * * @var array */ - protected $_images = array( + protected $_images = [ 'jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp', - ); + ]; /** * Browser/Device features * * @var array */ - protected $_aFeatures = array(); + protected $_aFeatures = []; /** * Browser/Device features groups * * @var array */ - protected $_aGroup = array(); + protected $_aGroup = []; /** * Constructor @@ -104,7 +104,7 @@ abstract class Zend_Http_UserAgent_AbstractDevice * @param array $config * @return void */ - public function __construct($userAgent = null, array $server = array(), array $config = array()) + public function __construct($userAgent = null, array $server = [], array $config = []) { if (is_array($userAgent)) { // Restoring from serialized array @@ -126,14 +126,14 @@ public function __construct($userAgent = null, array $server = array(), array $c */ public function serialize() { - $spec = array( + $spec = [ '_aFeatures' => $this->_aFeatures, '_aGroup' => $this->_aGroup, '_browser' => $this->_browser, '_browserVersion' => $this->_browserVersion, '_userAgent' => $this->_userAgent, '_images' => $this->_images, - ); + ]; return serialize($spec); } @@ -238,7 +238,7 @@ public function setFeature($feature, $value = false, $group = '') public function setGroup($group, $feature) { if (!isset($this->_aGroup[$group])) { - $this->_aGroup[$group] = array(); + $this->_aGroup[$group] = []; } if (!in_array($feature, $this->_aGroup[$group])) { $this->_aGroup[$group][] = $feature; @@ -285,7 +285,7 @@ public function getAllGroups() */ protected function _getDefaultFeatures() { - $server = array(); + $server = []; // gets info from user agent chain $uaExtract = $this->extractFromUserAgent($this->getUserAgent()); @@ -408,7 +408,7 @@ public static function extractFromUserAgent($userAgent) $pattern = "(([^/\s]*)(/(\S*))?)(\s*\[[a-zA-Z][a-zA-Z]\])?\s*(\\((([^()]|(\\([^()]*\\)))*)\\))?\s*"; preg_match("#^$pattern#", $userAgent, $match); - $comment = array(); + $comment = []; if (isset($match[7])) { $comment = explode(';', $match[7]); } @@ -419,7 +419,7 @@ public static function extractFromUserAgent($userAgent) $result['others']['full'] = $end; } - $match2 = array(); + $match2 = []; if (isset($result['others'])) { preg_match_all('/(([^\/\s]*)(\/)?([^\/\(\)\s]*)?)(\s\((([^\)]*)*)\))?/i', $result['others']['full'], $match2); } @@ -450,21 +450,21 @@ public static function extractFromUserAgent($userAgent) $max = count($match2[0]); for ($i = 0; $i < $max; $i ++) { if (!empty($match2[0][$i])) { - $result['others']['detail'][] = array( + $result['others']['detail'][] = [ $match2[0][$i], $match2[2][$i], $match2[4][$i], - ); + ]; } } } /** Security level */ - $security = array( + $security = [ 'N' => 'no security', 'U' => 'strong security', 'I' => 'weak security', - ); + ]; if (!empty($result['browser_token'])) { if (isset($security[$result['browser_token']])) { $result['security_level'] = $security[$result['browser_token']]; @@ -524,7 +524,7 @@ public static function extractFromUserAgent($userAgent) if (isset($result['device_os_token'])) { if (strpos($result['device_os_token'], 'Win') !== false) { - $windows = array( + $windows = [ 'Windows NT 6.1' => 'Windows 7', 'Windows NT 6.0' => 'Windows Vista', 'Windows NT 5.2' => 'Windows Server 2003', @@ -539,7 +539,7 @@ public static function extractFromUserAgent($userAgent) 'Windows 95' => 'Windows 95', 'Win95' => 'Windows 95', 'Windows CE' => 'Windows CE', - ); + ]; if (isset($windows[$result['device_os_token']])) { $result['device_os_name'] = $windows[$result['device_os_token']]; } else { @@ -549,11 +549,11 @@ public static function extractFromUserAgent($userAgent) } // iphone - $apple_device = array( + $apple_device = [ 'iPhone', 'iPod', 'iPad', - ); + ]; if (isset($result['compatibility_flag'])) { if (in_array($result['compatibility_flag'], $apple_device)) { $result['device'] = strtolower($result['compatibility_flag']); @@ -616,7 +616,7 @@ public static function extractFromUserAgent($userAgent) if (strpos($result['browser_version'], '.') > 2 || (int) $result['browser_version'] > 20) { $temp = explode('.', $result['browser_version']); $build = (int) $temp[0]; - $awkVersion = array( + $awkVersion = [ 48 => '0.8', 73 => '0.9', 85 => '1.0', @@ -624,7 +624,7 @@ public static function extractFromUserAgent($userAgent) 124 => '1.2', 300 => '1.3', 400 => '2.0', - ); + ]; foreach ($awkVersion as $k => $v) { if ($build >= $k) { $result['browser_version'] = $v; @@ -652,10 +652,10 @@ public static function extractFromUserAgent($userAgent) // exception : if the last one is 'Red Hat' or 'Debian' => // use rv: to find browser_version */ - if (in_array($result['others']['detail'][$last][1], array( + if (in_array($result['others']['detail'][$last][1], [ 'Debian', 'Hat', - ))) { + ])) { $searchRV = true; } $result['browser_name'] = $result['others']['detail'][$last][1]; @@ -766,7 +766,7 @@ protected function _loadFeaturesAdapter() $config = $this->_config; $browserType = $this->getType(); if (!isset($config[$browserType]) || !isset($config[$browserType]['features'])) { - return array(); + return []; } $config = $config[$browserType]['features']; @@ -790,7 +790,7 @@ protected function _loadFeaturesAdapter() } } - return call_user_func(array($className, 'getFromRequest'), $this->_server, $this->_config); + return call_user_func([$className, 'getFromRequest'], $this->_server, $this->_config); } /** diff --git a/library/Zend/Http/UserAgent/Bot.php b/library/Zend/Http/UserAgent/Bot.php index ad0c8dc1ed..caac8d8934 100644 --- a/library/Zend/Http/UserAgent/Bot.php +++ b/library/Zend/Http/UserAgent/Bot.php @@ -38,7 +38,7 @@ class Zend_Http_UserAgent_Bot extends Zend_Http_UserAgent_AbstractDevice * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ // The most common ones. 'googlebot', 'msnbot', @@ -103,7 +103,7 @@ class Zend_Http_UserAgent_Bot extends Zend_Http_UserAgent_AbstractDevice 'yahoo! slurp', 'yandex', 'zyborg', - ); + ]; /** * Comparison of the UserAgent chain and browser signatures diff --git a/library/Zend/Http/UserAgent/Checker.php b/library/Zend/Http/UserAgent/Checker.php index aba65d475b..4f74ef2651 100644 --- a/library/Zend/Http/UserAgent/Checker.php +++ b/library/Zend/Http/UserAgent/Checker.php @@ -38,7 +38,7 @@ class Zend_Http_UserAgent_Checker extends Zend_Http_UserAgent_Desktop * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ 'abilogic', 'checklink', 'checker', @@ -50,7 +50,7 @@ class Zend_Http_UserAgent_Checker extends Zend_Http_UserAgent_Desktop 'sitebar', 'xenu', 'sleuth', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures diff --git a/library/Zend/Http/UserAgent/Console.php b/library/Zend/Http/UserAgent/Console.php index 9ce93e6616..06f712108a 100644 --- a/library/Zend/Http/UserAgent/Console.php +++ b/library/Zend/Http/UserAgent/Console.php @@ -37,11 +37,11 @@ class Zend_Http_UserAgent_Console extends Zend_Http_UserAgent_Desktop * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ 'playstation', 'wii', 'libnup', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures diff --git a/library/Zend/Http/UserAgent/Device.php b/library/Zend/Http/UserAgent/Device.php index 5df661a6fc..8b5a025907 100644 --- a/library/Zend/Http/UserAgent/Device.php +++ b/library/Zend/Http/UserAgent/Device.php @@ -42,7 +42,7 @@ interface Zend_Http_UserAgent_Device extends Serializable * @param array $config * @return void */ - public function __construct($userAgent = null, array $server = array(), array $config = array()); + public function __construct($userAgent = null, array $server = [], array $config = []); /** * Attempt to match the user agent diff --git a/library/Zend/Http/UserAgent/Email.php b/library/Zend/Http/UserAgent/Email.php index 34d1949535..868fdc89d5 100644 --- a/library/Zend/Http/UserAgent/Email.php +++ b/library/Zend/Http/UserAgent/Email.php @@ -37,9 +37,9 @@ class Zend_Http_UserAgent_Email extends Zend_Http_UserAgent_Desktop * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ 'thunderbird', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures diff --git a/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php b/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php index a045942397..db9aaaac61 100644 --- a/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php +++ b/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php @@ -67,7 +67,7 @@ public function __construct() public static function getFromRequest($request, array $config) { $browscap = get_browser($request['http_user_agent'], true); - $features = array(); + $features = []; if (is_array($browscap)) { foreach ($browscap as $key => $value) { diff --git a/library/Zend/Http/UserAgent/Feed.php b/library/Zend/Http/UserAgent/Feed.php index 41d7c741f3..b8fa21bdee 100644 --- a/library/Zend/Http/UserAgent/Feed.php +++ b/library/Zend/Http/UserAgent/Feed.php @@ -37,12 +37,12 @@ class Zend_Http_UserAgent_Feed extends Zend_Http_UserAgent_AbstractDevice * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ 'bloglines', 'everyfeed', 'feedfetcher', 'gregarius', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures diff --git a/library/Zend/Http/UserAgent/Mobile.php b/library/Zend/Http/UserAgent/Mobile.php index 3450552db2..4ead34145f 100644 --- a/library/Zend/Http/UserAgent/Mobile.php +++ b/library/Zend/Http/UserAgent/Mobile.php @@ -42,7 +42,7 @@ class Zend_Http_UserAgent_Mobile extends Zend_Http_UserAgent_AbstractDevice * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ 'iphone', 'ipod', 'ipad', @@ -162,25 +162,25 @@ class Zend_Http_UserAgent_Mobile extends Zend_Http_UserAgent_AbstractDevice 'j2me', 'klondike', 'kbrowser' - ); + ]; /** * @var array */ - protected static $_haTerms = array( + protected static $_haTerms = [ 'midp', 'wml', 'vnd.rim', 'vnd.wap', 'j2me', - ); + ]; /** * first 4 letters of mobile User Agent chains * * @var array */ - protected static $_uaBegin = array( + protected static $_uaBegin = [ 'w3c ', 'acs-', 'alav', @@ -266,7 +266,7 @@ class Zend_Http_UserAgent_Mobile extends Zend_Http_UserAgent_AbstractDevice 'winw', 'xda', 'xda-', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures @@ -325,7 +325,7 @@ public static function userAgentStart($userAgent) * * @return void */ - public function __construct($userAgent = null, array $server = array(), array $config = array()) + public function __construct($userAgent = null, array $server = [], array $config = []) { // For mobile detection, an adapter must be defined if (empty($config['mobile']['features'])) { @@ -375,7 +375,7 @@ protected function _defineFeatures() } // image format - $this->_images = array(); + $this->_images = []; if ($this->getFeature('png')) { $this->_images[] = 'png'; diff --git a/library/Zend/Http/UserAgent/Offline.php b/library/Zend/Http/UserAgent/Offline.php index 97eee11a93..605a5f9805 100644 --- a/library/Zend/Http/UserAgent/Offline.php +++ b/library/Zend/Http/UserAgent/Offline.php @@ -37,14 +37,14 @@ class Zend_Http_UserAgent_Offline extends Zend_Http_UserAgent_Desktop * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ 'wget', 'webzip', 'webcopier', 'downloader', 'superbot', 'offline', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures diff --git a/library/Zend/Http/UserAgent/Probe.php b/library/Zend/Http/UserAgent/Probe.php index 9b83bc5e0f..0134be0ae4 100644 --- a/library/Zend/Http/UserAgent/Probe.php +++ b/library/Zend/Http/UserAgent/Probe.php @@ -37,10 +37,10 @@ class Zend_Http_UserAgent_Probe extends Zend_Http_UserAgent_AbstractDevice * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ 'witbe', 'netvigie', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures diff --git a/library/Zend/Http/UserAgent/Spam.php b/library/Zend/Http/UserAgent/Spam.php index 5d29be54e8..0a385bfe13 100644 --- a/library/Zend/Http/UserAgent/Spam.php +++ b/library/Zend/Http/UserAgent/Spam.php @@ -37,9 +37,9 @@ class Zend_Http_UserAgent_Spam extends Zend_Http_UserAgent_AbstractDevice * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ '', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures diff --git a/library/Zend/Http/UserAgent/Text.php b/library/Zend/Http/UserAgent/Text.php index c308b25a6a..5ee1ef2717 100644 --- a/library/Zend/Http/UserAgent/Text.php +++ b/library/Zend/Http/UserAgent/Text.php @@ -37,11 +37,11 @@ class Zend_Http_UserAgent_Text extends Zend_Http_UserAgent_AbstractDevice * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ 'lynx', 'retawq', 'w3m', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures diff --git a/library/Zend/Http/UserAgent/Validator.php b/library/Zend/Http/UserAgent/Validator.php index a75daccc63..987e1b6ff2 100644 --- a/library/Zend/Http/UserAgent/Validator.php +++ b/library/Zend/Http/UserAgent/Validator.php @@ -37,7 +37,7 @@ class Zend_Http_UserAgent_Validator extends Zend_Http_UserAgent_Desktop * * @var array */ - protected static $_uaSignatures = array( + protected static $_uaSignatures = [ 'htmlvalidator', 'csscheck', 'cynthia', @@ -47,7 +47,7 @@ class Zend_Http_UserAgent_Validator extends Zend_Http_UserAgent_Desktop 'jigsaw', 'w3c_validator', 'wdg_validator', - ); + ]; /** * Comparison of the UserAgent chain and User Agent signatures diff --git a/library/Zend/Json.php b/library/Zend/Json.php index e884f422fa..8b46d9fe69 100644 --- a/library/Zend/Json.php +++ b/library/Zend/Json.php @@ -127,7 +127,7 @@ public static function decode($encodedValue, $objectDecodeType = Zend_Json::TYPE * @param array $options Additional options used during encoding * @return string JSON encoded object */ - public static function encode($valueToEncode, $cycleCheck = false, $options = array()) + public static function encode($valueToEncode, $cycleCheck = false, $options = []) { if (is_object($valueToEncode)) { if (method_exists($valueToEncode, 'toJson')) { @@ -138,7 +138,7 @@ public static function encode($valueToEncode, $cycleCheck = false, $options = ar } // Pre-encoding look for Zend_Json_Expr objects and replacing by tmp ids - $javascriptExpressions = array(); + $javascriptExpressions = []; if(isset($options['enableJsonExprFinder']) && ($options['enableJsonExprFinder'] == true) ) { @@ -199,12 +199,12 @@ protected static function _recursiveJsonExprFinder(&$value, array &$javascriptEx if ($value instanceof Zend_Json_Expr) { // TODO: Optimize with ascii keys, if performance is bad $magicKey = "____" . $currentKey . "_" . (count($javascriptExpressions)); - $javascriptExpressions[] = array( + $javascriptExpressions[] = [ //if currentKey is integer, encodeUnicodeString call is not required. "magicKey" => (is_int($currentKey)) ? $magicKey : Zend_Json_Encoder::encodeUnicodeString($magicKey), "value" => $value->__toString(), - ); + ]; $value = $magicKey; } elseif (is_array($value)) { foreach ($value as $k => $v) { @@ -231,7 +231,7 @@ protected static function _recursiveJsonExprFinder(&$value, array &$javascriptEx */ protected static function _getXmlValue($simpleXmlElementObject) { $pattern = '/^[\s]*new Zend_Json_Expr[\s]*\([\s]*[\"\']{1}(.*)[\"\']{1}[\s]*\)[\s]*$/'; - $matchings = array(); + $matchings = []; $match = preg_match ($pattern, $simpleXmlElementObject, $matchings); if ($match) { return new Zend_Json_Expr($matchings[1]); @@ -284,18 +284,18 @@ protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttribu if (!empty($value)) { $attributes['@text'] = $value; } - return array($name => $attributes); + return [$name => $attributes]; } else { - return array($name => $value); + return [$name => $value]; } } else { - $childArray= array(); + $childArray= []; foreach ($children as $child) { $childname = $child->getName(); $element = self::_processXml($child,$ignoreXmlAttributes,$recursionDepth+1); if (array_key_exists($childname, $childArray)) { if (empty($subChild[$childname])) { - $childArray[$childname] = array($childArray[$childname]); + $childArray[$childname] = [$childArray[$childname]]; $subChild[$childname] = true; } $childArray[$childname][] = $element[$childname]; @@ -312,7 +312,7 @@ protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttribu if (!empty($value)) { $childArray['@text'] = $value; } - return array($name => $childArray); + return [$name => $childArray]; } } @@ -376,7 +376,7 @@ public static function fromXml($xmlStringContents, $ignoreXmlAttributes=true) * @param array $options Encoding options * @return string */ - public static function prettyPrint($json, $options = array()) + public static function prettyPrint($json, $options = []) { $tokens = preg_split('|([\{\}\]\[,])|', $json, -1, PREG_SPLIT_DELIM_CAPTURE); $result = ''; diff --git a/library/Zend/Json/Decoder.php b/library/Zend/Json/Decoder.php index 1188616c7f..9c08fe7f71 100644 --- a/library/Zend/Json/Decoder.php +++ b/library/Zend/Json/Decoder.php @@ -103,7 +103,7 @@ protected function __construct($source, $decodeType) $this->_offset = 0; // Normalize and set $decodeType - if (!in_array($decodeType, array(Zend_Json::TYPE_ARRAY, Zend_Json::TYPE_OBJECT))) + if (!in_array($decodeType, [Zend_Json::TYPE_ARRAY, Zend_Json::TYPE_OBJECT])) { $decodeType = Zend_Json::TYPE_ARRAY; } @@ -198,7 +198,7 @@ protected function _decodeValue() */ protected function _decodeObject() { - $members = array(); + $members = []; $tok = $this->_getNextToken(); while ($tok && $tok != self::RBRACE) { @@ -260,7 +260,7 @@ protected function _decodeObject() */ protected function _decodeArray() { - $result = array(); + $result = []; $starttok = $tok = $this->_getNextToken(); // Move past the '[' $index = 0; diff --git a/library/Zend/Json/Encoder.php b/library/Zend/Json/Encoder.php index 9013b285c3..c144eb8a49 100644 --- a/library/Zend/Json/Encoder.php +++ b/library/Zend/Json/Encoder.php @@ -41,14 +41,14 @@ class Zend_Json_Encoder * * @var array */ - protected $_options = array(); + protected $_options = []; /** * Array of visited objects; used to prevent cycling. * * @var array */ - protected $_visited = array(); + protected $_visited = []; /** * Constructor @@ -57,7 +57,7 @@ class Zend_Json_Encoder * @param array $options Additional options used during encoding * @return void */ - protected function __construct($cycleCheck = false, $options = array()) + protected function __construct($cycleCheck = false, $options = []) { $this->_cycleCheck = $cycleCheck; $this->_options = $options; @@ -71,7 +71,7 @@ protected function __construct($cycleCheck = false, $options = array()) * @param array $options Additional options used during encoding * @return string The encoded value */ - public static function encode($value, $cycleCheck = false, $options = array()) + public static function encode($value, $cycleCheck = false, $options = []) { $encoder = new self(($cycleCheck) ? true : false, $options); return $encoder->_encodeValue($value); @@ -191,7 +191,7 @@ protected function _wasVisited(&$value) */ protected function _encodeArray(&$array) { - $tmpArray = array(); + $tmpArray = []; // Check for associative array if (!empty($array) && (array_keys($array) !== range(0, count($array) - 1))) { @@ -256,14 +256,14 @@ protected function _encodeString(&$string) { // Escape these characters with a backslash: // " \ / \n \r \t \b \f - $search = array('\\', "\n", "\t", "\r", "\b", "\f", '"', '/'); - $replace = array('\\\\', '\\n', '\\t', '\\r', '\\b', '\\f', '\"', '\\/'); + $search = ['\\', "\n", "\t", "\r", "\b", "\f", '"', '/']; + $replace = ['\\\\', '\\n', '\\t', '\\r', '\\b', '\\f', '\"', '\\/']; $string = str_replace($search, $replace, $string); // Escape certain ASCII characters: // 0x08 => \b // 0x0c => \f - $string = str_replace(array(chr(0x08), chr(0x0C)), array('\b', '\f'), $string); + $string = str_replace([chr(0x08), chr(0x0C)], ['\b', '\f'], $string); $string = self::encodeUnicodeString($string); return '"' . $string . '"'; @@ -282,7 +282,7 @@ private static function _encodeConstants(ReflectionClass $cls) $result = "constants : {"; $constants = $cls->getConstants(); - $tmpArray = array(); + $tmpArray = []; if (!empty($constants)) { foreach ($constants as $key => $value) { $tmpArray[] = "$key: " . self::encode($value); @@ -374,7 +374,7 @@ private static function _encodeVariables(ReflectionClass $cls) $result = "variables:{"; $cnt = 0; - $tmpArray = array(); + $tmpArray = []; foreach ($properties as $prop) { if (! $prop->isPublic()) { continue; diff --git a/library/Zend/Json/Server.php b/library/Zend/Json/Server.php index 589eb5d707..49456ae64a 100644 --- a/library/Zend/Json/Server.php +++ b/library/Zend/Json/Server.php @@ -346,10 +346,10 @@ public function getServiceMap() */ protected function _addMethodServiceMap(Zend_Server_Method_Definition $method) { - $serviceInfo = array( + $serviceInfo = [ 'name' => $method->getName(), 'return' => $this->_getReturnType($method), - ); + ]; $params = $this->_getParams($method); $serviceInfo['params'] = $params; $serviceMap = $this->getServiceMap(); @@ -398,15 +398,15 @@ protected function _getDefaultParams(array $args, array $params) */ protected function _getParams(Zend_Server_Method_Definition $method) { - $params = array(); + $params = []; foreach ($method->getPrototypes() as $prototype) { foreach ($prototype->getParameterObjects() as $key => $parameter) { if (!isset($params[$key])) { - $params[$key] = array( + $params[$key] = [ 'type' => $parameter->getType(), 'name' => $parameter->getName(), 'optional' => $parameter->isOptional(), - ); + ]; if (null !== ($default = $parameter->getDefaultValue())) { $params[$key]['default'] = $default; } @@ -460,7 +460,7 @@ protected function _getReadyResponse() */ protected function _getReturnType(Zend_Server_Method_Definition $method) { - $return = array(); + $return = []; foreach ($method->getPrototypes() as $prototype) { $return[] = $prototype->getReturnType(); } @@ -478,7 +478,7 @@ protected function _getReturnType(Zend_Server_Method_Definition $method) protected function _getSmdMethods() { if (null === $this->_smdMethods) { - $this->_smdMethods = array(); + $this->_smdMethods = []; require_once 'Zend/Json/Server/Smd.php'; $methods = get_class_methods('Zend_Json_Server_Smd'); foreach ($methods as $key => $method) { @@ -542,7 +542,7 @@ protected function _handle() $refParams = $reflection->getParameters(); } - $orderedParams = array(); + $orderedParams = []; foreach( $reflection->getParameters() as $refParam ) { if( isset( $params[ $refParam->getName() ] ) ) { $orderedParams[ $refParam->getName() ] = $params[ $refParam->getName() ]; diff --git a/library/Zend/Json/Server/Error.php b/library/Zend/Json/Server/Error.php index 838e56a20f..8565e93cb0 100644 --- a/library/Zend/Json/Server/Error.php +++ b/library/Zend/Json/Server/Error.php @@ -38,14 +38,14 @@ class Zend_Json_Server_Error * Allowed error codes * @var array */ - protected $_allowedCodes = array( + protected $_allowedCodes = [ self::ERROR_PARSE, self::ERROR_INVALID_REQUEST, self::ERROR_INVALID_METHOD, self::ERROR_INVALID_PARAMS, self::ERROR_INTERNAL, self::ERROR_OTHER, - ); + ]; /** * Current code @@ -167,11 +167,11 @@ public function getData() */ public function toArray() { - return array( + return [ 'code' => $this->getCode(), 'message' => $this->getMessage(), 'data' => $this->getData(), - ); + ]; } /** diff --git a/library/Zend/Json/Server/Request.php b/library/Zend/Json/Server/Request.php index 72983e4897..ebf6de459c 100644 --- a/library/Zend/Json/Server/Request.php +++ b/library/Zend/Json/Server/Request.php @@ -57,7 +57,7 @@ class Zend_Json_Server_Request * Request parameters * @var array */ - protected $_params = array(); + protected $_params = []; /** * JSON-RPC version of request @@ -126,7 +126,7 @@ public function addParams(array $params) */ public function setParams(array $params) { - $this->_params = array(); + $this->_params = []; return $this->addParams($params); } @@ -259,9 +259,9 @@ public function loadJson($json) */ public function toJson() { - $jsonArray = array( + $jsonArray = [ 'method' => $this->getMethod() - ); + ]; if (null !== ($id = $this->getId())) { $jsonArray['id'] = $id; } diff --git a/library/Zend/Json/Server/Response.php b/library/Zend/Json/Server/Response.php index c5c6c7e36c..f4ce04d2d9 100644 --- a/library/Zend/Json/Server/Response.php +++ b/library/Zend/Json/Server/Response.php @@ -173,15 +173,15 @@ public function getVersion() public function toJson() { if ($this->isError()) { - $response = array( + $response = [ 'error' => $this->getError()->toArray(), 'id' => $this->getId(), - ); + ]; } else { - $response = array( + $response = [ 'result' => $this->getResult(), 'id' => $this->getId(), - ); + ]; } if (null !== ($version = $this->getVersion())) { diff --git a/library/Zend/Json/Server/Smd.php b/library/Zend/Json/Server/Smd.php index ba650af224..4d3ee965be 100644 --- a/library/Zend/Json/Server/Smd.php +++ b/library/Zend/Json/Server/Smd.php @@ -67,10 +67,10 @@ class Zend_Json_Server_Smd * Allowed envelope types * @var array */ - protected $_envelopeTypes = array( + protected $_envelopeTypes = [ self::ENV_JSONRPC_1, self::ENV_JSONRPC_2, - ); + ]; /** * Service id @@ -82,7 +82,7 @@ class Zend_Json_Server_Smd * Services offerred * @var array */ - protected $_services = array(); + protected $_services = []; /** * Service target @@ -100,7 +100,7 @@ class Zend_Json_Server_Smd * Allowed transport types * @var array */ - protected $_transportTypes = array('POST'); + protected $_transportTypes = ['POST']; /** * Set object state via options @@ -337,7 +337,7 @@ public function addServices(array $services) */ public function setServices(array $services) { - $this->_services = array(); + $this->_services = []; return $this->addServices($services); } @@ -406,7 +406,7 @@ public function toArray() $services = $this->getServices(); if (!empty($services)) { - $service['services'] = array(); + $service['services'] = []; foreach ($services as $name => $svc) { $svc->setEnvelope($envelope); $service['services'][$name] = $svc->toArray(); @@ -432,19 +432,19 @@ public function toDojoArray() $services = $this->getServices(); if (!empty($services)) { - $service['methods'] = array(); + $service['methods'] = []; foreach ($services as $name => $svc) { - $method = array( + $method = [ 'name' => $name, 'serviceURL' => $target, - ); - $params = array(); + ]; + $params = []; foreach ($svc->getParams() as $param) { $paramName = array_key_exists('name', $param) ? $param['name'] : $param['type']; - $params[] = array( + $params[] = [ 'name' => $paramName, 'type' => $param['type'], - ); + ]; } if (!empty($params)) { $method['parameters'] = $params; diff --git a/library/Zend/Json/Server/Smd/Service.php b/library/Zend/Json/Server/Smd/Service.php index 64c31463a1..ecedd04bbd 100644 --- a/library/Zend/Json/Server/Smd/Service.php +++ b/library/Zend/Json/Server/Smd/Service.php @@ -49,10 +49,10 @@ class Zend_Json_Server_Smd_Service * Allowed envelope types * @var array */ - protected $_envelopeTypes = array( + protected $_envelopeTypes = [ Zend_Json_Server_Smd::ENV_JSONRPC_1, Zend_Json_Server_Smd::ENV_JSONRPC_2, - ); + ]; /** * Regex for names @@ -64,24 +64,24 @@ class Zend_Json_Server_Smd_Service * Parameter option types * @var array */ - protected $_paramOptionTypes = array( + protected $_paramOptionTypes = [ 'name' => 'is_string', 'optional' => 'is_bool', 'default' => null, 'description' => 'is_string', - ); + ]; /** * Service params * @var array */ - protected $_params = array(); + protected $_params = []; /** * Mapping of parameter types to JSON-RPC types * @var array */ - protected $_paramMap = array( + protected $_paramMap = [ 'any' => 'any', 'arr' => 'array', 'array' => 'array', @@ -104,15 +104,15 @@ class Zend_Json_Server_Smd_Service 'struct' => 'object', 'true' => 'boolean', 'void' => 'null', - ); + ]; /** * Allowed transport types * @var array */ - protected $_transportTypes = array( + protected $_transportTypes = [ 'POST', - ); + ]; /** * Constructor @@ -270,7 +270,7 @@ public function getEnvelope() * @param int|null $order * @return Zend_Json_Server_Smd_Service */ - public function addParam($type, array $options = array(), $order = null) + public function addParam($type, array $options = [], $order = null) { if (is_string($type)) { $type = $this->_validateParamType($type); @@ -283,9 +283,9 @@ public function addParam($type, array $options = array(), $order = null) throw new Zend_Json_Server_Exception('Invalid param type provided'); } - $paramOptions = array( + $paramOptions = [ 'type' => $type, - ); + ]; foreach ($options as $key => $value) { if (in_array($key, array_keys($this->_paramOptionTypes))) { if (null !== ($callback = $this->_paramOptionTypes[$key])) { @@ -297,10 +297,10 @@ public function addParam($type, array $options = array(), $order = null) } } - $this->_params[] = array( + $this->_params[] = [ 'param' => $paramOptions, 'order' => $order, - ); + ]; return $this; } @@ -338,7 +338,7 @@ public function addParams(array $params) */ public function setParams(array $params) { - $this->_params = array(); + $this->_params = []; return $this->addParams($params); } @@ -351,7 +351,7 @@ public function setParams(array $params) */ public function getParams() { - $params = array(); + $params = []; $index = 0; foreach ($this->_params as $param) { if (null === $param['order']) { @@ -428,7 +428,7 @@ public function toArray() */ public function toJson() { - $service = array($this->getName() => $this->toArray()); + $service = [$this->getName() => $this->toArray()]; require_once 'Zend/Json.php'; return Zend_Json::encode($service); diff --git a/library/Zend/Layout.php b/library/Zend/Layout.php index fa8ab81a6e..6972e7231d 100644 --- a/library/Zend/Layout.php +++ b/library/Zend/Layout.php @@ -640,7 +640,7 @@ public function getInflector() require_once 'Zend/Filter/Inflector.php'; $inflector = new Zend_Filter_Inflector(); $inflector->setTargetReference($this->_inflectorTarget) - ->addRules(array(':script' => array('Word_CamelCaseToDash', 'StringToLower'))) + ->addRules([':script' => ['Word_CamelCaseToDash', 'StringToLower']]) ->setStaticRuleReference('suffix', $this->_viewSuffix); $this->setInflector($inflector); } @@ -778,7 +778,7 @@ public function render($name = null) if ($this->inflectorEnabled() && (null !== ($inflector = $this->getInflector()))) { - $name = $this->_inflector->filter(array('script' => $name)); + $name = $this->_inflector->filter(['script' => $name]); } $view = $this->getView(); diff --git a/library/Zend/Layout/Controller/Action/Helper/Layout.php b/library/Zend/Layout/Controller/Action/Helper/Layout.php index b0b70f1913..dc1ce9ab55 100644 --- a/library/Zend/Layout/Controller/Action/Helper/Layout.php +++ b/library/Zend/Layout/Controller/Action/Helper/Layout.php @@ -177,7 +177,7 @@ public function __call($method, $args) { $layout = $this->getLayoutInstance(); if (method_exists($layout, $method)) { - return call_user_func_array(array($layout, $method), $args); + return call_user_func_array([$layout, $method], $args); } require_once 'Zend/Layout/Exception.php'; diff --git a/library/Zend/Ldap.php b/library/Zend/Ldap.php index 3a3b6e3c72..ea8487bf1e 100644 --- a/library/Zend/Ldap.php +++ b/library/Zend/Ldap.php @@ -119,7 +119,7 @@ public static function explodeDn($dn, array &$keys = null, array &$vals = null) * @return void * @throws Zend_Ldap_Exception if ext/ldap is not installed */ - public function __construct($options = array()) + public function __construct($options = []) { if (!extension_loaded('ldap')) { /** @@ -187,7 +187,7 @@ public function getLastErrorCode() public function getLastError(&$errorCode = null, array &$errorMessages = null) { $errorCode = $this->getLastErrorCode(); - $errorMessages = array(); + $errorMessages = []; /* The various error retrieval functions can return * different things so we just try to collect what we @@ -264,7 +264,7 @@ public function setOptions($options) $options = $options->toArray(); } - $permittedOptions = array( + $permittedOptions = [ 'host' => null, 'port' => 0, 'useSsl' => false, @@ -280,7 +280,7 @@ public function setOptions($options) 'useStartTls' => false, 'optReferrals' => false, 'tryUsernameSplit' => true, - ); + ]; foreach ($permittedOptions as $key => $val) { if (array_key_exists($key, $options)) { @@ -535,7 +535,7 @@ protected function _getAccountDn($acctname) require_once 'Zend/Ldap/Dn.php'; if (Zend_Ldap_Dn::checkDn($acctname)) return $acctname; $acctname = $this->getCanonicalAccountName($acctname, Zend_Ldap::ACCTNAME_FORM_USERNAME); - $acct = $this->_getAccount($acctname, array('dn')); + $acct = $this->_getAccount($acctname, ['dn']); return $acct['dn']; } @@ -753,7 +753,7 @@ public function connect($host = null, $port = null, $useSsl = null, $useStartTls * will actually occur during the ldap_bind call. Therefore, we save the * connect string here for reporting it in error handling in bind(). */ - $hosts = array(); + $hosts = []; if (preg_match_all('~ldap(?:i|s)?://~', $host, $hosts, PREG_SET_ORDER) > 0) { $this->_connectString = $host; $useUri = true; @@ -931,7 +931,7 @@ public function bind($username = null, $password = null) * @return Zend_Ldap_Collection * @throws Zend_Ldap_Exception */ - public function search($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, array $attributes = array(), + public function search($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, array $attributes = [], $sort = null, $collectionClass = null, $sizelimit = 0, $timelimit = 0) { if (is_array($filter)) { @@ -1059,7 +1059,7 @@ protected function _createCollection(Zend_Ldap_Collection_Iterator_Default $iter public function count($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB) { try { - $result = $this->search($filter, $basedn, $scope, array('dn'), null); + $result = $this->search($filter, $basedn, $scope, ['dn'], null); } catch (Zend_Ldap_Exception $e) { if ($e->getCode() === Zend_Ldap_Exception::LDAP_NO_SUCH_OBJECT) return 0; else throw $e; @@ -1117,7 +1117,7 @@ public function exists($dn) * @throws Zend_Ldap_Exception */ public function searchEntries($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, - array $attributes = array(), $sort = null, $reverseSort = false, $sizelimit = 0, $timelimit = 0) + array $attributes = [], $sort = null, $reverseSort = false, $sizelimit = 0, $timelimit = 0) { if (is_array($filter)) { $filter = array_change_key_case($filter, CASE_LOWER); @@ -1146,7 +1146,7 @@ public function searchEntries($filter, $basedn = null, $scope = self::SEARCH_SCO * @return array * @throws Zend_Ldap_Exception */ - public function getEntry($dn, array $attributes = array(), $throwOnNotFound = false) + public function getEntry($dn, array $attributes = [], $throwOnNotFound = false) { try { $result = $this->search("(objectClass=*)", $dn, self::SEARCH_SCOPE_BASE, @@ -1185,15 +1185,15 @@ public static function prepareLdapEntryArray(array &$entry) } $entry[$key] = array_values($value); } else { - if ($value === null) $entry[$key] = array(); + if ($value === null) $entry[$key] = []; else if (!is_scalar($value)) { throw new InvalidArgumentException('Only scalar values allowed in LDAP data'); } else { $value = (string)$value; if (strlen($value) == 0) { - $entry[$key] = array(); + $entry[$key] = []; } else { - $entry[$key] = array($value); + $entry[$key] = [$value]; } } } @@ -1225,13 +1225,13 @@ public function add($dn, array $entry) foreach ($rdnParts as $key => $value) { $value = Zend_Ldap_Dn::unescapeValue($value); if (!array_key_exists($key, $entry)) { - $entry[$key] = array($value); + $entry[$key] = [$value]; } else if (!in_array($value, $entry[$key])) { - $entry[$key] = array_merge(array($value), $entry[$key]); + $entry[$key] = array_merge([$value], $entry[$key]); } } - $adAttributes = array('distinguishedname', 'instancetype', 'name', 'objectcategory', - 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated'); + $adAttributes = ['distinguishedname', 'instancetype', 'name', 'objectcategory', + 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated']; foreach ($adAttributes as $attr) { if (array_key_exists($attr, $entry)) { unset($entry[$attr]); @@ -1268,12 +1268,12 @@ public function update($dn, array $entry) foreach ($rdnParts as $key => $value) { $value = Zend_Ldap_Dn::unescapeValue($value); if (array_key_exists($key, $entry) && !in_array($value, $entry[$key])) { - $entry[$key] = array_merge(array($value), $entry[$key]); + $entry[$key] = array_merge([$value], $entry[$key]); } } - $adAttributes = array('distinguishedname', 'instancetype', 'name', 'objectcategory', - 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated'); + $adAttributes = ['distinguishedname', 'instancetype', 'name', 'objectcategory', + 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated']; foreach ($adAttributes as $attr) { if (array_key_exists($attr, $entry)) { unset($entry[$attr]); @@ -1360,8 +1360,8 @@ protected function _getChildrenDns($parentDn) if ($parentDn instanceof Zend_Ldap_Dn) { $parentDn = $parentDn->toString(); } - $children = array(); - $search = @ldap_list($this->getResource(), $parentDn, '(objectClass=*)', array('dn')); + $children = []; + $search = @ldap_list($this->getResource(), $parentDn, '(objectClass=*)', ['dn']); for ($entry = @ldap_first_entry($this->getResource(), $search); $entry !== false; $entry = @ldap_next_entry($this->getResource(), $entry)) { @@ -1403,7 +1403,7 @@ public function moveToSubtree($from, $to, $recursively = false, $alwaysEmulate = $newParentDnParts = Zend_Ldap_Dn::explodeDn($to); } - $newDnParts = array_merge(array(array_shift($orgDnParts)), $newParentDnParts); + $newDnParts = array_merge([array_shift($orgDnParts)], $newParentDnParts); $newDn = Zend_Ldap_Dn::fromArray($newDnParts); return $this->rename($from, $newDn, $recursively, $alwaysEmulate); } @@ -1496,7 +1496,7 @@ public function copyToSubtree($from, $to, $recursively = false) $newParentDnParts = Zend_Ldap_Dn::explodeDn($to); } - $newDnParts = array_merge(array(array_shift($orgDnParts)), $newParentDnParts); + $newDnParts = array_merge([array_shift($orgDnParts)], $newParentDnParts); $newDn = Zend_Ldap_Dn::fromArray($newDnParts); return $this->copy($from, $newDn, $recursively); } @@ -1512,7 +1512,7 @@ public function copyToSubtree($from, $to, $recursively = false) */ public function copy($from, $to, $recursively = false) { - $entry = $this->getEntry($from, array(), true); + $entry = $this->getEntry($from, [], true); if ($to instanceof Zend_Ldap_Dn) { $toDnParts = $to->toArray(); @@ -1525,7 +1525,7 @@ public function copy($from, $to, $recursively = false) $children = $this->_getChildrenDns($from); foreach ($children as $c) { $cDnParts = Zend_Ldap_Dn::explodeDn($c); - $newChildParts = array_merge(array(array_shift($cDnParts)), $toDnParts); + $newChildParts = array_merge([array_shift($cDnParts)], $toDnParts); $newChild = Zend_Ldap_Dn::implodeDn($newChildParts); $this->copy($c, $newChild, true); } diff --git a/library/Zend/Ldap/Attribute.php b/library/Zend/Ldap/Attribute.php index b3177fb3a5..51ce33d85e 100644 --- a/library/Zend/Ldap/Attribute.php +++ b/library/Zend/Ldap/Attribute.php @@ -55,7 +55,7 @@ class Zend_Ldap_Attribute public static function setAttribute(array &$data, $attribName, $value, $append = false) { $attribName = strtolower($attribName); - $valArray = array(); + $valArray = []; if (is_array($value) || ($value instanceof Traversable)) { foreach ($value as $v) @@ -72,7 +72,7 @@ public static function setAttribute(array &$data, $attribName, $value, $append = if ($append === true && isset($data[$attribName])) { - if (is_string($data[$attribName])) $data[$attribName] = array($data[$attribName]); + if (is_string($data[$attribName])) $data[$attribName] = [$data[$attribName]]; $data[$attribName] = array_merge($data[$attribName], $valArray); } else @@ -93,8 +93,8 @@ public static function getAttribute(array $data, $attribName, $index = null) { $attribName = strtolower($attribName); if ($index === null) { - if (!isset($data[$attribName])) return array(); - $retArray = array(); + if (!isset($data[$attribName])) return []; + $retArray = []; foreach ($data[$attribName] as $v) { $retArray[] = self::_valueFromLdap($v); @@ -126,7 +126,7 @@ public static function attributeHasValue(array &$data, $attribName, $value) if (!isset($data[$attribName])) return false; if (is_scalar($value)) { - $value = array($value); + $value = [$value]; } foreach ($value as $v) { @@ -166,10 +166,10 @@ public static function removeFromAttribute(array &$data, $attribName, $value) if (!isset($data[$attribName])) return; if (is_scalar($value)) { - $value = array($value); + $value = [$value]; } - $valArray = array(); + $valArray = []; foreach ($value as $v) { $v = self::_valueToLdap($v); @@ -349,7 +349,7 @@ public static function createPassword($password, $hashType = self::PASSWORD_HASH public static function setDateTimeAttribute(array &$data, $attribName, $value, $utc = false, $append = false) { - $convertedValues = array(); + $convertedValues = []; if (is_array($value) || ($value instanceof Traversable)) { foreach ($value as $v) { diff --git a/library/Zend/Ldap/Collection.php b/library/Zend/Ldap/Collection.php index cfd72ffd25..16e2694364 100644 --- a/library/Zend/Ldap/Collection.php +++ b/library/Zend/Ldap/Collection.php @@ -48,7 +48,7 @@ class Zend_Ldap_Collection implements Iterator, Countable * * @var array */ - protected $_cache = array(); + protected $_cache = []; /** * Constructor. @@ -82,7 +82,7 @@ public function close() */ public function toArray() { - $data = array(); + $data = []; foreach ($this as $item) { $data[] = $item; } diff --git a/library/Zend/Ldap/Collection/Iterator/Default.php b/library/Zend/Ldap/Collection/Iterator/Default.php index d1d44fb66e..0447254f84 100644 --- a/library/Zend/Ldap/Collection/Iterator/Default.php +++ b/library/Zend/Ldap/Collection/Iterator/Default.php @@ -198,7 +198,7 @@ public function current() return null; } - $entry = array('dn' => $this->key()); + $entry = ['dn' => $this->key()]; $ber_identifier = null; $name = @ldap_first_attribute($this->_ldap->getResource(), $this->_current, $ber_identifier); diff --git a/library/Zend/Ldap/Converter.php b/library/Zend/Ldap/Converter.php index e8677e1f16..255fcc398d 100644 --- a/library/Zend/Ldap/Converter.php +++ b/library/Zend/Ldap/Converter.php @@ -70,7 +70,7 @@ public static function ascToHex32($string) public static function hex32ToAsc($string) { // Using a callback, since PHP 5.5 has deprecated the /e modifier in preg_replace. - $string = preg_replace_callback("/\\\([0-9A-Fa-f]{2})/", array('Zend_Ldap_Converter', '_charHex32ToAsc'), $string); + $string = preg_replace_callback("/\\\([0-9A-Fa-f]{2})/", ['Zend_Ldap_Converter', '_charHex32ToAsc'], $string); return $string; } @@ -260,7 +260,7 @@ public static function fromLdap($value, $type = self::STANDARD, $dateTimeAsUtc = */ public static function fromLdapDateTime($date, $asUtc = true) { - $datepart = array (); + $datepart = []; if (!preg_match('/^(\d{4})/', $date, $datepart) ) { throw new InvalidArgumentException('Invalid date format found'); } @@ -269,7 +269,7 @@ public static function fromLdapDateTime($date, $asUtc = true) throw new InvalidArgumentException('Invalid date format found (too short)'); } - $time = array ( + $time = [ // The year is mandatory! 'year' => $datepart[1], 'month' => 1, @@ -280,7 +280,7 @@ public static function fromLdapDateTime($date, $asUtc = true) 'offdir' => '+', 'offsethours' => 0, 'offsetminutes' => 0 - ); + ]; $length = strlen($date); @@ -331,7 +331,7 @@ public static function fromLdapDateTime($date, $asUtc = true) // Set Offset $offsetRegEx = '/([Z\-\+])(\d{2}\'?){0,1}(\d{2}\'?){0,1}$/'; - $off = array (); + $off = []; if (preg_match($offsetRegEx, $date, $off)) { $offset = $off[1]; if ($offset == '+' || $offset == '-') { diff --git a/library/Zend/Ldap/Dn.php b/library/Zend/Ldap/Dn.php index 7f7e8e3d38..41640da2a2 100644 --- a/library/Zend/Ldap/Dn.php +++ b/library/Zend/Ldap/Dn.php @@ -89,7 +89,7 @@ public static function fromString($dn, $caseFold = null) { $dn = trim($dn); if (empty($dn)) { - $dnArray = array(); + $dnArray = []; } else { $dnArray = self::explodeDn((string)$dn); } @@ -267,7 +267,7 @@ public function insert($index, array $value) self::_assertRdn($value); $first = array_slice($this->_dn, 0, $index + 1); $second = array_slice($this->_dn, $index + 1); - $this->_dn = array_merge($first, array($value), $second); + $this->_dn = array_merge($first, [$value], $second); return $this; } @@ -394,7 +394,7 @@ protected static function _caseFoldRdn(array $part, $caseFold) */ protected static function _caseFoldDn(array $dn, $caseFold) { - $return = array(); + $return = []; foreach ($dn as $part) { $return[] = self::_caseFoldRdn($part, $caseFold); } @@ -506,18 +506,18 @@ protected static function _sanitizeCaseFold($caseFold, $default) * @param string|array $values An array containing the DN values that should be escaped * @return array The array $values, but escaped */ - public static function escapeValue($values = array()) + public static function escapeValue($values = []) { /** * @see Zend_Ldap_Converter */ require_once 'Zend/Ldap/Converter.php'; - if (!is_array($values)) $values = array($values); + if (!is_array($values)) $values = [$values]; foreach ($values as $key => $val) { // Escaping of filter meta characters - $val = str_replace(array('\\', ',', '+', '"', '<', '>', ';', '#', '=', ), - array('\\\\', '\,', '\+', '\"', '\<', '\>', '\;', '\#', '\='), $val); + $val = str_replace(['\\', ',', '+', '"', '<', '>', ';', '#', '=', ], + ['\\\\', '\,', '\+', '\"', '\<', '\>', '\;', '\#', '\='], $val); $val = Zend_Ldap_Converter::ascToHex32($val); // Convert all leading and trailing spaces to sequences of \20. @@ -548,18 +548,18 @@ public static function escapeValue($values = array()) * @param string|array $values Array of DN Values * @return array Same as $values, but unescaped */ - public static function unescapeValue($values = array()) + public static function unescapeValue($values = []) { /** * @see Zend_Ldap_Converter */ require_once 'Zend/Ldap/Converter.php'; - if (!is_array($values)) $values = array($values); + if (!is_array($values)) $values = [$values]; foreach ($values as $key => $val) { // strip slashes from special chars - $val = str_replace(array('\\\\', '\,', '\+', '\"', '\<', '\>', '\;', '\#', '\='), - array('\\', ',', '+', '"', '<', '>', ';', '#', '=', ), $val); + $val = str_replace(['\\\\', '\,', '\+', '\"', '\<', '\>', '\;', '\#', '\='], + ['\\', ',', '+', '"', '<', '>', ';', '#', '=', ], $val); $values[$key] = Zend_Ldap_Converter::hex32ToAsc($val); } return (count($values) == 1) ? $values[0] : $values; @@ -587,8 +587,8 @@ public static function unescapeValue($values = array()) public static function explodeDn($dn, array &$keys = null, array &$vals = null, $caseFold = self::ATTR_CASEFOLD_NONE) { - $k = array(); - $v = array(); + $k = []; + $v = []; if (!self::checkDn($dn, $k, $v, $caseFold)) { /** * Zend_Ldap_Exception @@ -596,10 +596,10 @@ public static function explodeDn($dn, array &$keys = null, array &$vals = null, require_once 'Zend/Ldap/Exception.php'; throw new Zend_Ldap_Exception(null, 'DN is malformed'); } - $ret = array(); + $ret = []; for ($i = 0; $i < count($k); $i++) { if (is_array($k[$i]) && is_array($v[$i]) && (count($k[$i]) === count($v[$i]))) { - $multi = array(); + $multi = []; for ($j = 0; $j < count($k[$i]); $j++) { $key=$k[$i][$j]; $val=$v[$i][$j]; @@ -607,7 +607,7 @@ public static function explodeDn($dn, array &$keys = null, array &$vals = null, } $ret[] = $multi; } else if (is_string($k[$i]) && is_string($v[$i])) { - $ret[] = array($k[$i] => $v[$i]); + $ret[] = [$k[$i] => $v[$i]]; } } if ($keys !== null) $keys = $k; @@ -638,8 +638,8 @@ public static function checkDn($dn, array &$keys = null, array &$vals = null, $state = 1; $ko = $vo = 0; $multi = false; - $ka = array(); - $va = array(); + $ka = []; + $va = []; for ($di = 0; $di <= $slen; $di++) { $ch = ($di == $slen) ? 0 : $dn[$di]; switch ($state) { @@ -679,9 +679,9 @@ public static function checkDn($dn, array &$keys = null, array &$vals = null, if ($ch === '+' && $multi === false) { $lastKey = array_pop($ka); $lastVal = array_pop($va); - $ka[] = array($lastKey); - $va[] = array($lastVal); - $multi = array(strtolower($lastKey)); + $ka[] = [$lastKey]; + $va[] = [$lastVal]; + $multi = [strtolower($lastKey)]; } else if ($ch === ','|| $ch === ';' || $ch === 0) { $multi = false; } @@ -720,11 +720,11 @@ public static function implodeRdn(array $part, $caseFold = null) { self::_assertRdn($part); $part = self::_caseFoldRdn($part, $caseFold); - $rdnParts = array(); + $rdnParts = []; foreach ($part as $key => $value) { $value = self::escapeValue($value); $keyId = strtolower($key); - $rdnParts[$keyId] = implode('=', array($key, $value)); + $rdnParts[$keyId] = implode('=', [$key, $value]); } ksort($rdnParts, SORT_STRING); return implode('+', $rdnParts); @@ -750,7 +750,7 @@ public static function implodeRdn(array $part, $caseFold = null) */ public static function implodeDn(array $dnArray, $caseFold = null, $separator = ',') { - $parts = array(); + $parts = []; foreach ($dnArray as $p) { $parts[] = self::implodeRdn($p, $caseFold); } @@ -767,8 +767,8 @@ public static function implodeDn(array $dnArray, $caseFold = null, $separator = public static function isChildOf($childDn, $parentDn) { try { - $keys = array(); - $vals = array(); + $keys = []; + $vals = []; if ($childDn instanceof Zend_Ldap_Dn) { $cdn = $childDn->toArray(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER); } else { diff --git a/library/Zend/Ldap/Exception.php b/library/Zend/Ldap/Exception.php index 4d6aaeec5d..7996509781 100644 --- a/library/Zend/Ldap/Exception.php +++ b/library/Zend/Ldap/Exception.php @@ -122,7 +122,7 @@ class Zend_Ldap_Exception extends Zend_Exception */ public function __construct(Zend_Ldap $ldap = null, $str = null, $code = 0) { - $errorMessages = array(); + $errorMessages = []; $message = ''; if ($ldap !== null) { $oldCode = $code; diff --git a/library/Zend/Ldap/Filter/Abstract.php b/library/Zend/Ldap/Filter/Abstract.php index 674850a0b1..3fe29e1fc4 100644 --- a/library/Zend/Ldap/Filter/Abstract.php +++ b/library/Zend/Ldap/Filter/Abstract.php @@ -76,7 +76,7 @@ public function addAnd($filter) */ require_once 'Zend/Ldap/Filter/And.php'; $fa = func_get_args(); - $args = array_merge(array($this), $fa); + $args = array_merge([$this], $fa); return new Zend_Ldap_Filter_And($args); } @@ -93,7 +93,7 @@ public function addOr($filter) */ require_once 'Zend/Ldap/Filter/Or.php'; $fa = func_get_args(); - $args = array_merge(array($this), $fa); + $args = array_merge([$this], $fa); return new Zend_Ldap_Filter_Or($args); } @@ -110,17 +110,17 @@ public function addOr($filter) * @param string|array $values Array of values to escape * @return array Array $values, but escaped */ - public static function escapeValue($values = array()) + public static function escapeValue($values = []) { /** * @see Zend_Ldap_Converter */ require_once 'Zend/Ldap/Converter.php'; - if (!is_array($values)) $values = array($values); + if (!is_array($values)) $values = [$values]; foreach ($values as $key => $val) { // Escaping of filter meta characters - $val = str_replace(array('\\', '*', '(', ')'), array('\5c', '\2a', '\28', '\29'), $val); + $val = str_replace(['\\', '*', '(', ')'], ['\5c', '\2a', '\28', '\29'], $val); // ASCII < 32 escaping $val = Zend_Ldap_Converter::ascToHex32($val); if (null === $val) $val = '\0'; // apply escaped "null" if string is empty @@ -140,14 +140,14 @@ public static function escapeValue($values = array()) * @param string|array $values Array of values to escape * @return array Array $values, but unescaped */ - public static function unescapeValue($values = array()) + public static function unescapeValue($values = []) { /** * @see Zend_Ldap_Converter */ require_once 'Zend/Ldap/Converter.php'; - if (!is_array($values)) $values = array($values); + if (!is_array($values)) $values = [$values]; foreach ($values as $key => $value) { // Translate hex code into ascii $values[$key] = Zend_Ldap_Converter::hex32ToAsc($value); diff --git a/library/Zend/Ldap/Ldif/Encoder.php b/library/Zend/Ldap/Ldif/Encoder.php index d8e04cb9f2..6a20f63a56 100644 --- a/library/Zend/Ldap/Ldif/Encoder.php +++ b/library/Zend/Ldap/Ldif/Encoder.php @@ -36,11 +36,11 @@ class Zend_Ldap_Ldif_Encoder * * @var array */ - protected $_options = array( + protected $_options = [ 'sort' => true, 'version' => 1, 'wrap' => 78 - ); + ]; /** * @var boolean @@ -53,7 +53,7 @@ class Zend_Ldap_Ldif_Encoder * @param array $options Additional options used during encoding * @return void */ - protected function __construct(array $options = array()) + protected function __construct(array $options = []) { $this->_options = array_merge($this->_options, $options); } @@ -66,7 +66,7 @@ protected function __construct(array $options = array()) */ public static function decode($string) { - $encoder = new self(array()); + $encoder = new self([]); return $encoder->_decode($string); } @@ -78,12 +78,12 @@ public static function decode($string) */ protected function _decode($string) { - $items = array(); - $item = array(); + $items = []; + $item = []; $last = null; foreach (explode("\n", $string) as $line) { $line = rtrim($line, "\x09\x0A\x0D\x00\x0B"); - $matches = array(); + $matches = []; if (substr($line, 0, 1) === ' ' && $last !== null) { $last[2] .= substr($line, 1); } else if (substr($line, 0, 1) === '#') { @@ -99,10 +99,10 @@ protected function _decode($string) continue; } else if (count($item) > 0 && $name === 'dn') { $items[] = $item; - $item = array(); + $item = []; $last = null; } - $last = array($name, $type, $value); + $last = [$name, $type, $value]; } else if (trim($line) === '') { continue; } @@ -133,7 +133,7 @@ protected function _pushAttribute(array $attribute, array &$entry) } else if (isset($entry[$name]) && $value !== '') { $entry[$name][] = $value; } else { - $entry[$name] = ($value !== '') ? array($value) : array(); + $entry[$name] = ($value !== '') ? [$value] : []; } } @@ -144,7 +144,7 @@ protected function _pushAttribute(array $attribute, array &$entry) * @param array $options Additional options used during encoding * @return string The encoded value */ - public static function encode($value, array $options = array()) + public static function encode($value, array $options = []) { $encoder = new self($options); return $encoder->_encode($value); @@ -193,13 +193,13 @@ protected function _encodeString($string, &$base64 = null) * ; and less-than ("<" , ASCII 60 decimal) * */ - $unsafe_init_char = array(0, 10, 13, 32, 58, 60); + $unsafe_init_char = [0, 10, 13, 32, 58, 60]; /* * SAFE-CHAR = %x01-09 / %x0B-0C / %x0E-7F * ; any value <= 127 decimal except NUL, LF, * ; and CR */ - $unsafe_char = array(0, 10, 13); + $unsafe_char = [0, 10, 13]; $base64 = false; for ($i = 0; $i < strlen($string); $i++) { @@ -239,7 +239,7 @@ protected function _encodeString($string, &$base64 = null) protected function _encodeAttribute($name, $value) { if (!is_array($value)) { - $value = array($value); + $value = [$value]; } $output = ''; @@ -288,12 +288,12 @@ protected function _encodeAttributes(array $attributes) if (array_key_exists('objectclass', $attributes)) { $oc = $attributes['objectclass']; unset($attributes['objectclass']); - $attributes = array_merge(array('objectclass' => $oc), $attributes); + $attributes = array_merge(['objectclass' => $oc], $attributes); } if (array_key_exists('dn', $attributes)) { $dn = $attributes['dn']; unset($attributes['dn']); - $attributes = array_merge(array('dn' => $dn), $attributes); + $attributes = array_merge(['dn' => $dn], $attributes); } } foreach ($attributes as $key => $value) { diff --git a/library/Zend/Ldap/Node.php b/library/Zend/Ldap/Node.php index f718cc1676..82b2b97fed 100644 --- a/library/Zend/Ldap/Node.php +++ b/library/Zend/Ldap/Node.php @@ -112,8 +112,8 @@ protected function __construct(Zend_Ldap_Dn $dn, array $data, $fromDataSource, Z */ public function __sleep() { - return array('_dn', '_currentData', '_newDn', '_originalData', - '_new', '_delete', '_children'); + return ['_dn', '_currentData', '_newDn', '_originalData', + '_new', '_delete', '_children']; } /** @@ -221,7 +221,7 @@ protected function _loadData(array $data, $fromDataSource) if ($fromDataSource === true) { $this->_originalData = $data; } else { - $this->_originalData = array(); + $this->_originalData = []; } $this->_children = null; $this->_markAsNew(($fromDataSource === true) ? false : true); @@ -236,7 +236,7 @@ protected function _loadData(array $data, $fromDataSource) * @return Zend_Ldap_Node * @throws Zend_Ldap_Exception */ - public static function create($dn, array $objectClass = array()) + public static function create($dn, array $objectClass = []) { if (is_string($dn) || is_array($dn)) { $dn = Zend_Ldap_Dn::factory($dn); @@ -249,7 +249,7 @@ public static function create($dn, array $objectClass = array()) require_once 'Zend/Ldap/Exception.php'; throw new Zend_Ldap_Exception(null, '$dn is of a wrong data type.'); } - $new = new self($dn, array(), false, null); + $new = new self($dn, [], false, null); $new->_ensureRdnAttributeValues(); $new->setAttribute('objectClass', $objectClass); return $new; @@ -276,7 +276,7 @@ public static function fromLdap($dn, Zend_Ldap $ldap) require_once 'Zend/Ldap/Exception.php'; throw new Zend_Ldap_Exception(null, '$dn is of a wrong data type.'); } - $data = $ldap->getEntry($dn, array('*', '+'), true); + $data = $ldap->getEntry($dn, ['*', '+'], true); if ($data === null) { return null; } @@ -584,9 +584,9 @@ public function appendObjectClass($value) * @param array $options Additional options used during encoding * @return string */ - public function toLdif(array $options = array()) + public function toLdif(array $options = []) { - $attributes = array_merge(array('dn' => $this->getDnString()), $this->getData(false)); + $attributes = array_merge(['dn' => $this->getDnString()], $this->getData(false)); /** * Zend_Ldap_Ldif_Encoder */ @@ -606,7 +606,7 @@ public function toLdif(array $options = array()) */ public function getChangedData() { - $changed = array(); + $changed = []; foreach ($this->_currentData as $key => $value) { if (!array_key_exists($key, $this->_originalData) && !empty($value)) { $changed[$key] = $value; @@ -626,10 +626,10 @@ public function getChangedData() */ public function getChanges() { - $changes = array( - 'add' => array(), - 'delete' => array(), - 'replace' => array()); + $changes = [ + 'add' => [], + 'delete' => [], + 'replace' => []]; foreach ($this->_currentData as $key => $value) { if (!array_key_exists($key, $this->_originalData) && !empty($value)) { $changes['add'][$key] = $value; @@ -950,7 +950,7 @@ public function searchSubtree($filter, $scope = Zend_Ldap::SEARCH_SCOPE_SUB, $so * @see Zend_Ldap_Node_Collection */ require_once 'Zend/Ldap/Node/Collection.php'; - return $this->getLdap()->search($filter, $this->_getDn(), $scope, array('*', '+'), $sort, + return $this->getLdap()->search($filter, $this->_getDn(), $scope, ['*', '+'], $sort, 'Zend_Ldap_Node_Collection'); } @@ -1030,7 +1030,7 @@ public function hasChildren() public function getChildren() { if (!is_array($this->_children)) { - $this->_children = array(); + $this->_children = []; if ($this->isAttached()) { $children = $this->searchChildren('(objectClass=*)', null); foreach ($children as $child) { diff --git a/library/Zend/Ldap/Node/Abstract.php b/library/Zend/Ldap/Node/Abstract.php index febc549bf2..fc173f4af9 100644 --- a/library/Zend/Ldap/Node/Abstract.php +++ b/library/Zend/Ldap/Node/Abstract.php @@ -40,11 +40,11 @@ */ abstract class Zend_Ldap_Node_Abstract implements ArrayAccess, Countable { - protected static $_systemAttributes=array('createtimestamp', 'creatorsname', + protected static $_systemAttributes=['createtimestamp', 'creatorsname', 'entrycsn', 'entrydn', 'entryuuid', 'hassubordinates', 'modifiersname', 'modifytimestamp', 'structuralobjectclass', 'subschemasubentry', 'distinguishedname', 'instancetype', 'name', 'objectcategory', 'objectguid', - 'usnchanged', 'usncreated', 'whenchanged', 'whencreated'); + 'usnchanged', 'usncreated', 'whenchanged', 'whencreated']; /** * Holds the node's DN. @@ -101,7 +101,7 @@ protected function _loadData(array $data, $fromDataSource) public function reload(Zend_Ldap $ldap = null) { if ($ldap !== null) { - $data = $ldap->getEntry($this->_getDn(), array('*', '+'), true); + $data = $ldap->getEntry($this->_getDn(), ['*', '+'], true); $this->_loadData($data, true); } return $this; @@ -207,7 +207,7 @@ public function getObjectClass() */ public function getAttributes($includeSystemAttributes = true) { - $data = array(); + $data = []; foreach ($this->getData($includeSystemAttributes) as $name => $value) { $data[$name] = $this->getAttribute($name, null); } @@ -243,7 +243,7 @@ public function __toString() public function toArray($includeSystemAttributes = true) { $attributes = $this->getAttributes($includeSystemAttributes); - return array_merge(array('dn' => $this->getDnString()), $attributes); + return array_merge(['dn' => $this->getDnString()], $attributes); } /** @@ -270,7 +270,7 @@ public function toJson($includeSystemAttributes = true) public function getData($includeSystemAttributes = true) { if ($includeSystemAttributes === false) { - $data = array(); + $data = []; foreach ($this->_currentData as $key => $value) { if (!in_array($key, self::$_systemAttributes)) { $data[$key] = $value; diff --git a/library/Zend/Ldap/Node/ChildrenIterator.php b/library/Zend/Ldap/Node/ChildrenIterator.php index 6b044ef4b6..12ec97688d 100644 --- a/library/Zend/Ldap/Node/ChildrenIterator.php +++ b/library/Zend/Ldap/Node/ChildrenIterator.php @@ -200,7 +200,7 @@ public function offsetSet($name, $value) { } */ public function toArray() { - $data = array(); + $data = []; foreach ($this as $rdn => $node) { $data[$rdn] = $node; } diff --git a/library/Zend/Ldap/Node/RootDse.php b/library/Zend/Ldap/Node/RootDse.php index f70682e94a..2c11d647ad 100644 --- a/library/Zend/Ldap/Node/RootDse.php +++ b/library/Zend/Ldap/Node/RootDse.php @@ -51,7 +51,7 @@ class Zend_Ldap_Node_RootDse extends Zend_Ldap_Node_Abstract public static function create(Zend_Ldap $ldap) { $dn = Zend_Ldap_Dn::fromString(''); - $data = $ldap->getEntry($dn, array('*', '+'), true); + $data = $ldap->getEntry($dn, ['*', '+'], true); if (isset($data['domainfunctionality'])) { /** * @see Zend_Ldap_Node_RootDse_ActiveDirectory diff --git a/library/Zend/Ldap/Node/Schema.php b/library/Zend/Ldap/Node/Schema.php index 6ac8d4fe61..93d4dba8d4 100644 --- a/library/Zend/Ldap/Node/Schema.php +++ b/library/Zend/Ldap/Node/Schema.php @@ -51,7 +51,7 @@ class Zend_Ldap_Node_Schema extends Zend_Ldap_Node_Abstract public static function create(Zend_Ldap $ldap) { $dn = $ldap->getRootDse()->getSchemaDn(); - $data = $ldap->getEntry($dn, array('*', '+'), true); + $data = $ldap->getEntry($dn, ['*', '+'], true); switch ($ldap->getRootDse()->getServerType()) { case Zend_Ldap_Node_RootDse::SERVER_TYPE_ACTIVEDIRECTORY: /** @@ -105,7 +105,7 @@ protected function _parseSchema(Zend_Ldap_Dn $dn, Zend_Ldap $ldap) */ public function getAttributeTypes() { - return array(); + return []; } /** @@ -115,6 +115,6 @@ public function getAttributeTypes() */ public function getObjectClasses() { - return array(); + return []; } } diff --git a/library/Zend/Ldap/Node/Schema/ActiveDirectory.php b/library/Zend/Ldap/Node/Schema/ActiveDirectory.php index 7fd71c50af..947c9c1208 100644 --- a/library/Zend/Ldap/Node/Schema/ActiveDirectory.php +++ b/library/Zend/Ldap/Node/Schema/ActiveDirectory.php @@ -50,13 +50,13 @@ class Zend_Ldap_Node_Schema_ActiveDirectory extends Zend_Ldap_Node_Schema * * @var array */ - protected $_attributeTypes = array(); + protected $_attributeTypes = []; /** * The object classes * * @var array */ - protected $_objectClasses = array(); + protected $_objectClasses = []; /** * Parses the schema diff --git a/library/Zend/Ldap/Node/Schema/OpenLdap.php b/library/Zend/Ldap/Node/Schema/OpenLdap.php index 6e20812fe6..29ec4de874 100644 --- a/library/Zend/Ldap/Node/Schema/OpenLdap.php +++ b/library/Zend/Ldap/Node/Schema/OpenLdap.php @@ -151,7 +151,7 @@ public function getMatchingRuleUse() */ protected function _loadAttributeTypes() { - $this->_attributeTypes = array(); + $this->_attributeTypes = []; foreach ($this->getAttribute('attributeTypes') as $value) { $val = $this->_parseAttributeType($value); $val = new Zend_Ldap_Node_Schema_AttributeType_OpenLdap($val); @@ -177,7 +177,7 @@ protected function _loadAttributeTypes() */ protected function _parseAttributeType($value) { - $attributeType = array( + $attributeType = [ 'oid' => null, 'name' => null, 'desc' => null, @@ -193,7 +193,7 @@ protected function _parseAttributeType($value) 'no-user-modification' => false, 'usage' => 'userApplications', '_string' => $value, - '_parents' => array()); + '_parents' => []]; $tokens = $this->_tokenizeString($value); $attributeType['oid'] = array_shift($tokens); // first token is the oid @@ -219,7 +219,7 @@ protected function _parseAttributeType($value) */ protected function _loadObjectClasses() { - $this->_objectClasses = array(); + $this->_objectClasses = []; foreach ($this->getAttribute('objectClasses') as $value) { $val = $this->_parseObjectClass($value); $val = new Zend_Ldap_Node_Schema_ObjectClass_OpenLdap($val); @@ -244,19 +244,19 @@ protected function _loadObjectClasses() */ protected function _parseObjectClass($value) { - $objectClass = array( + $objectClass = [ 'oid' => null, 'name' => null, 'desc' => null, 'obsolete' => false, - 'sup' => array(), + 'sup' => [], 'abstract' => false, 'structural' => false, 'auxiliary' => false, - 'must' => array(), - 'may' => array(), + 'must' => [], + 'may' => [], '_string' => $value, - '_parents' => array()); + '_parents' => []]; $tokens = $this->_tokenizeString($value); $objectClass['oid'] = array_shift($tokens); // first token is the oid @@ -281,7 +281,7 @@ protected function _resolveInheritance(Zend_Ldap_Node_Schema_Item $node, array $ foreach ($parents as $parent) { if (!array_key_exists($parent, $repository)) continue; if (!array_key_exists('_parents', $data) || !is_array($data['_parents'])) { - $data['_parents'] = array(); + $data['_parents'] = []; } $data['_parents'][] = $repository[$parent]; } @@ -295,7 +295,7 @@ protected function _resolveInheritance(Zend_Ldap_Node_Schema_Item $node, array $ */ protected function _loadLdapSyntaxes() { - $this->_ldapSyntaxes = array(); + $this->_ldapSyntaxes = []; foreach ($this->getAttribute('ldapSyntaxes') as $value) { $val = $this->_parseLdapSyntax($value); $this->_ldapSyntaxes[$val['oid']] = $val; @@ -311,10 +311,10 @@ protected function _loadLdapSyntaxes() */ protected function _parseLdapSyntax($value) { - $ldapSyntax = array( + $ldapSyntax = [ 'oid' => null, 'desc' => null, - '_string' => $value); + '_string' => $value]; $tokens = $this->_tokenizeString($value); $ldapSyntax['oid'] = array_shift($tokens); // first token is the oid @@ -330,7 +330,7 @@ protected function _parseLdapSyntax($value) */ protected function _loadMatchingRules() { - $this->_matchingRules = array(); + $this->_matchingRules = []; foreach ($this->getAttribute('matchingRules') as $value) { $val = $this->_parseMatchingRule($value); $this->_matchingRules[$val['name']] = $val; @@ -346,13 +346,13 @@ protected function _loadMatchingRules() */ protected function _parseMatchingRule($value) { - $matchingRule = array( + $matchingRule = [ 'oid' => null, 'name' => null, 'desc' => null, 'obsolete' => false, 'syntax' => null, - '_string' => $value); + '_string' => $value]; $tokens = $this->_tokenizeString($value); $matchingRule['oid'] = array_shift($tokens); // first token is the oid @@ -370,7 +370,7 @@ protected function _parseMatchingRule($value) */ protected function _loadMatchingRuleUse() { - $this->_matchingRuleUse = array(); + $this->_matchingRuleUse = []; foreach ($this->getAttribute('matchingRuleUse') as $value) { $val = $this->_parseMatchingRuleUse($value); $this->_matchingRuleUse[$val['name']] = $val; @@ -386,13 +386,13 @@ protected function _loadMatchingRuleUse() */ protected function _parseMatchingRuleUse($value) { - $matchingRuleUse = array( + $matchingRuleUse = [ 'oid' => null, 'name' => null, 'desc' => null, 'obsolete' => false, - 'applies' => array(), - '_string' => $value); + 'applies' => [], + '_string' => $value]; $tokens = $this->_tokenizeString($value); $matchingRuleUse['oid'] = array_shift($tokens); // first token is the oid @@ -420,7 +420,7 @@ protected function _ensureNameAttribute(array &$data) $data['name'] = array_shift($aliases); $data['aliases'] = $aliases; } else { - $data['aliases'] = array(); + $data['aliases'] = []; } } @@ -434,15 +434,15 @@ protected function _ensureNameAttribute(array &$data) protected function _parseLdapSchemaSyntax(array &$data, array $tokens) { // tokens that have no value associated - $noValue = array('single-value', + $noValue = ['single-value', 'obsolete', 'collective', 'no-user-modification', 'abstract', 'structural', - 'auxiliary'); + 'auxiliary']; // tokens that can have multiple values - $multiValue = array('must', 'may', 'sup'); + $multiValue = ['must', 'may', 'sup']; while (count($tokens) > 0) { $token = strtolower(array_shift($tokens)); @@ -454,7 +454,7 @@ protected function _parseLdapSchemaSyntax(array &$data, array $tokens) if ($data[$token] == '(') { // this creates the list of values and cycles through the tokens // until the end of the list is reached ')' - $data[$token] = array(); + $data[$token] = []; while ($tmp = array_shift($tokens)) { if ($tmp == ')') break; if ($tmp != '$') { @@ -466,7 +466,7 @@ protected function _parseLdapSchemaSyntax(array &$data, array $tokens) } // create a array if the value should be multivalued but was not if (in_array($token, $multiValue) && !is_array($data[$token])) { - $data[$token] = array($data[$token]); + $data[$token] = [$data[$token]]; } } } @@ -480,8 +480,8 @@ protected function _parseLdapSchemaSyntax(array &$data, array $tokens) */ protected function _tokenizeString($value) { - $tokens = array(); - $matches = array(); + $tokens = []; + $matches = []; // this one is taken from PEAR::Net_LDAP2 $pattern = "/\s* (?:([()]) | ([^'\s()]+) | '((?:[^']+|'[^\s)])*)') \s*/x"; preg_match_all($pattern, $value, $matches); diff --git a/library/Zend/Loader.php b/library/Zend/Loader.php index d5a28753b4..f2fb29b4f7 100644 --- a/library/Zend/Loader.php +++ b/library/Zend/Loader.php @@ -268,7 +268,7 @@ public static function registerAutoload($class = 'Zend_Loader', $enabled = true) throw new Zend_Exception("The class \"$class\" does not have an autoload() method"); } - $callback = array($class, 'autoload'); + $callback = [$class, 'autoload']; if ($enabled) { $autoloader->pushAutoloader($callback); diff --git a/library/Zend/Loader/Autoloader.php b/library/Zend/Loader/Autoloader.php index 06e70232fd..57a07aafa8 100644 --- a/library/Zend/Loader/Autoloader.php +++ b/library/Zend/Loader/Autoloader.php @@ -42,12 +42,12 @@ class Zend_Loader_Autoloader /** * @var array Concrete autoloader callback implementations */ - protected $_autoloaders = array(); + protected $_autoloaders = []; /** * @var array Default autoloader callback */ - protected $_defaultAutoloader = array('Zend_Loader', 'loadClass'); + protected $_defaultAutoloader = ['Zend_Loader', 'loadClass']; /** * @var bool Whether or not to act as a fallback autoloader @@ -62,15 +62,15 @@ class Zend_Loader_Autoloader /** * @var array Supported namespaces 'Zend' and 'ZendX' by default. */ - protected $_namespaces = array( + protected $_namespaces = [ 'Zend_' => true, 'ZendX_' => true, - ); + ]; /** * @var array Namespace-specific autoloaders */ - protected $_namespaceAutoloaders = array(); + protected $_namespaceAutoloaders = []; /** * @var bool Whether or not to suppress file not found warnings @@ -192,7 +192,7 @@ public function getNamespaceAutoloaders($namespace) { $namespace = (string) $namespace; if (!array_key_exists($namespace, $this->_namespaceAutoloaders)) { - return array(); + return []; } return $this->_namespaceAutoloaders[$namespace]; } @@ -265,10 +265,10 @@ public function setZfPath($spec, $version = 'latest') } $this->_zfPath = $this->_getVersionPath($path, $version); - set_include_path(implode(PATH_SEPARATOR, array( + set_include_path(implode(PATH_SEPARATOR, [ $this->_zfPath, get_include_path(), - ))); + ])); return $this; } @@ -327,7 +327,7 @@ public function isFallbackAutoloader() public function getClassAutoloaders($class) { $namespace = false; - $autoloaders = array(); + $autoloaders = []; // Add concrete namespaced autoloaders foreach (array_keys($this->_namespaceAutoloaders) as $ns) { @@ -459,8 +459,8 @@ public function removeAutoloader($callback, $namespace = null) */ protected function __construct() { - spl_autoload_register(array(__CLASS__, 'autoload')); - $this->_internalAutoloader = array($this, '_autoload'); + spl_autoload_register([__CLASS__, 'autoload']); + $this->_internalAutoloader = [$this, '_autoload']; } /** @@ -565,7 +565,7 @@ protected function _getAvailableVersions($path, $version) $path = rtrim($path, '/'); $path = rtrim($path, '\\'); $versionLen = strlen($version); - $versions = array(); + $versions = []; $dirs = glob("$path/*", GLOB_ONLYDIR); foreach ((array) $dirs as $dir) { $dirName = substr($dir, strlen($path) + 1); diff --git a/library/Zend/Loader/Autoloader/Resource.php b/library/Zend/Loader/Autoloader/Resource.php index b9279c257c..b8a3c62959 100644 --- a/library/Zend/Loader/Autoloader/Resource.php +++ b/library/Zend/Loader/Autoloader/Resource.php @@ -42,7 +42,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac /** * @var array Components handled within this resource */ - protected $_components = array(); + protected $_components = []; /** * @var string Default resource/component to use when using object registry @@ -57,7 +57,7 @@ class Zend_Loader_Autoloader_Resource implements Zend_Loader_Autoloader_Interfac /** * @var array Available resource types handled by this resource autoloader */ - protected $_resourceTypes = array(); + protected $_resourceTypes = []; /** * Constructor @@ -145,7 +145,7 @@ public function getClassPath($class) $namespace = ''; if (!empty($namespaceTopLevel)) { - $namespace = array(); + $namespace = []; $topLevelSegments = count(explode('_', $namespaceTopLevel)); for ($i = 0; $i < $topLevelSegments; $i++) { $namespace[] = array_shift($segments); @@ -289,9 +289,9 @@ public function addResourceType($type, $path, $namespace = null) } $namespaceTopLevel = $this->getNamespace(); $namespace = ucfirst(trim($namespace, '_')); - $this->_resourceTypes[$type] = array( + $this->_resourceTypes[$type] = [ 'namespace' => empty($namespaceTopLevel) ? $namespace : $namespaceTopLevel . '_' . $namespace, - ); + ]; } if (!is_string($path)) { require_once 'Zend/Loader/Exception.php'; @@ -408,8 +408,8 @@ public function removeResourceType($type) */ public function clearResourceTypes() { - $this->_resourceTypes = array(); - $this->_components = array(); + $this->_resourceTypes = []; + $this->_components = []; return $this; } diff --git a/library/Zend/Loader/AutoloaderFactory.php b/library/Zend/Loader/AutoloaderFactory.php index 9fc2836525..89a3aa6d4c 100644 --- a/library/Zend/Loader/AutoloaderFactory.php +++ b/library/Zend/Loader/AutoloaderFactory.php @@ -35,7 +35,7 @@ abstract class Zend_Loader_AutoloaderFactory /** * @var array All autoloaders registered using the factory */ - protected static $loaders = array(); + protected static $loaders = []; /** * @var Zend_Loader_StandardAutoloader StandardAutoloader instance for resolving @@ -174,7 +174,7 @@ public static function getRegisteredAutoloader($class) public static function unregisterAutoloaders() { foreach (self::getRegisteredAutoloaders() as $class => $autoloader) { - spl_autoload_unregister(array($autoloader, 'autoload')); + spl_autoload_unregister([$autoloader, 'autoload']); unset(self::$loaders[$class]); } } @@ -192,7 +192,7 @@ public static function unregisterAutoloader($autoloaderClass) } $autoloader = self::$loaders[$autoloaderClass]; - spl_autoload_unregister(array($autoloader, 'autoload')); + spl_autoload_unregister([$autoloader, 'autoload']); unset(self::$loaders[$autoloaderClass]); return true; } diff --git a/library/Zend/Loader/ClassMapAutoloader.php b/library/Zend/Loader/ClassMapAutoloader.php index 177c2f5ad7..f9e884d7a1 100644 --- a/library/Zend/Loader/ClassMapAutoloader.php +++ b/library/Zend/Loader/ClassMapAutoloader.php @@ -36,13 +36,13 @@ class Zend_Loader_ClassMapAutoloader implements Zend_Loader_SplAutoloader * Registry of map files that have already been loaded * @var array */ - protected $mapsLoaded = array(); + protected $mapsLoaded = []; /** * Class name/filename map * @var array */ - protected $map = array(); + protected $map = []; /** * Constructor @@ -157,9 +157,9 @@ public function autoload($class) public function register() { if (version_compare(PHP_VERSION, '5.3.0', '>=')) { - spl_autoload_register(array($this, 'autoload'), true, true); + spl_autoload_register([$this, 'autoload'], true, true); } else { - spl_autoload_register(array($this, 'autoload'), true); + spl_autoload_register([$this, 'autoload'], true); } } @@ -208,10 +208,10 @@ public static function realPharPath($path) return; } - $parts = explode('/', str_replace(array('/','\\'), '/', substr($path, 8))); - $parts = array_values(array_filter($parts, array(__CLASS__, 'concatPharParts'))); + $parts = explode('/', str_replace(['/','\\'], '/', substr($path, 8))); + $parts = array_values(array_filter($parts, [__CLASS__, 'concatPharParts'])); - array_walk($parts, array(__CLASS__, 'resolvePharParentPath'), $parts); + array_walk($parts, [__CLASS__, 'resolvePharParentPath'], $parts); if (file_exists($realPath = 'phar:///' . implode('/', $parts))) { return $realPath; diff --git a/library/Zend/Loader/PluginLoader.php b/library/Zend/Loader/PluginLoader.php index 118684302d..7e0647618d 100644 --- a/library/Zend/Loader/PluginLoader.php +++ b/library/Zend/Loader/PluginLoader.php @@ -54,42 +54,42 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface * * @var array */ - protected $_loadedPluginPaths = array(); + protected $_loadedPluginPaths = []; /** * Instance loaded plugins * * @var array */ - protected $_loadedPlugins = array(); + protected $_loadedPlugins = []; /** * Instance registry property * * @var array */ - protected $_prefixToPaths = array(); + protected $_prefixToPaths = []; /** * Statically loaded plugin path mappings * * @var array */ - protected static $_staticLoadedPluginPaths = array(); + protected static $_staticLoadedPluginPaths = []; /** * Statically loaded plugins * * @var array */ - protected static $_staticLoadedPlugins = array(); + protected static $_staticLoadedPlugins = []; /** * Static registry property * * @var array */ - protected static $_staticPrefixToPaths = array(); + protected static $_staticPrefixToPaths = []; /** * Whether to use a statically named registry for loading plugins @@ -104,15 +104,15 @@ class Zend_Loader_PluginLoader implements Zend_Loader_PluginLoader_Interface * @param array $prefixToPaths * @param string $staticRegistryName OPTIONAL */ - public function __construct(Array $prefixToPaths = array(), $staticRegistryName = null) + public function __construct(Array $prefixToPaths = [], $staticRegistryName = null) { if (is_string($staticRegistryName) && !empty($staticRegistryName)) { $this->_useStaticRegistry = $staticRegistryName; if(!isset(self::$_staticPrefixToPaths[$staticRegistryName])) { - self::$_staticPrefixToPaths[$staticRegistryName] = array(); + self::$_staticPrefixToPaths[$staticRegistryName] = []; } if(!isset(self::$_staticLoadedPlugins[$staticRegistryName])) { - self::$_staticLoadedPlugins[$staticRegistryName] = array(); + self::$_staticLoadedPlugins[$staticRegistryName] = []; } } @@ -164,7 +164,7 @@ public function addPrefixPath($prefix, $path) self::$_staticPrefixToPaths[$this->_useStaticRegistry][$prefix][] = $path; } else { if (!isset($this->_prefixToPaths[$prefix])) { - $this->_prefixToPaths[$prefix] = array(); + $this->_prefixToPaths[$prefix] = []; } if (!in_array($path, $this->_prefixToPaths[$prefix])) { $this->_prefixToPaths[$prefix][] = $path; @@ -233,9 +233,9 @@ public function clearPaths($prefix = null) } if ($this->_useStaticRegistry) { - self::$_staticPrefixToPaths[$this->_useStaticRegistry] = array(); + self::$_staticPrefixToPaths[$this->_useStaticRegistry] = []; } else { - $this->_prefixToPaths = array(); + $this->_prefixToPaths = []; } return true; diff --git a/library/Zend/Loader/StandardAutoloader.php b/library/Zend/Loader/StandardAutoloader.php index 867fbd9223..296acac989 100644 --- a/library/Zend/Loader/StandardAutoloader.php +++ b/library/Zend/Loader/StandardAutoloader.php @@ -44,12 +44,12 @@ class Zend_Loader_StandardAutoloader implements Zend_Loader_SplAutoloader /** * @var array Namespace/directory pairs to search; ZF library added by default */ - protected $namespaces = array(); + protected $namespaces = []; /** * @var array Prefix/directory pairs to search */ - protected $prefixes = array(); + protected $prefixes = []; /** * @var bool Whether or not the autoloader should also act as a fallback autoloader @@ -255,7 +255,7 @@ public function autoload($class) */ public function register() { - spl_autoload_register(array($this, 'autoload')); + spl_autoload_register([$this, 'autoload']); } /** @@ -284,7 +284,7 @@ protected function transformClassNameToFilename($class, $directory) { // $class may contain a namespace portion, in which case we need // to preserve any underscores in that portion. - $matches = array(); + $matches = []; preg_match('/(?P.+\\\)?(?P[^\\\]+$)/', $class, $matches); $class = (isset($matches['class'])) ? $matches['class'] : ''; @@ -305,7 +305,7 @@ protected function transformClassNameToFilename($class, $directory) */ protected function loadClass($class, $type) { - if (!in_array($type, array(self::LOAD_NS, self::LOAD_PREFIX, self::ACT_AS_FALLBACK))) { + if (!in_array($type, [self::LOAD_NS, self::LOAD_PREFIX, self::ACT_AS_FALLBACK])) { require_once dirname(__FILE__) . '/Exception/InvalidArgumentException.php'; throw new Zend_Loader_Exception_InvalidArgumentException(); } @@ -322,7 +322,7 @@ protected function loadClass($class, $type) return false; } $this->error = false; - set_error_handler(array($this, 'handleError'), E_WARNING); + set_error_handler([$this, 'handleError'], E_WARNING); include $filename; restore_error_handler(); if ($this->error) { @@ -357,7 +357,7 @@ protected function loadClass($class, $type) protected function normalizeDirectory($directory) { $last = $directory[strlen($directory) - 1]; - if (in_array($last, array('/', '\\'))) { + if (in_array($last, ['/', '\\'])) { $directory[strlen($directory) - 1] = DIRECTORY_SEPARATOR; return $directory; } diff --git a/library/Zend/Locale.php b/library/Zend/Locale.php index fc30826b52..9cf26646f3 100644 --- a/library/Zend/Locale.php +++ b/library/Zend/Locale.php @@ -35,7 +35,7 @@ class Zend_Locale * * @var array */ - private static $_localeAliases = array( + private static $_localeAliases = [ 'az_AZ' => 'az_Latn_AZ', 'bs_BA' => 'bs_Latn_BA', 'ha_GH' => 'ha_Latn_GH', @@ -64,14 +64,14 @@ class Zend_Locale 'zh_MO' => 'zh_Hans_MO', 'zh_SG' => 'zh_Hans_SG', 'zh_TW' => 'zh_Hant_TW', - ); + ]; /** * Class wide Locale Constants * * @var array $_localeData */ - private static $_localeData = array( + private static $_localeData = [ 'root' => true, 'aa' => true, 'aa_DJ' => true, @@ -785,14 +785,14 @@ class Zend_Locale 'zh_Hant_TW' => true, 'zu' => true, 'zu_ZA' => true, - ); + ]; /** * Class wide Locale Constants * * @var array $_territoryData */ - private static $_territoryData = array( + private static $_territoryData = [ 'AD' => 'ca_AD', 'AE' => 'ar_AE', 'AF' => 'fa_AF', @@ -1039,7 +1039,7 @@ class Zend_Locale 'ZA' => 'en_ZA', 'ZM' => 'en_ZM', 'ZW' => 'sn_ZW' - ); + ]; /** * Autosearch constants @@ -1096,7 +1096,7 @@ class Zend_Locale * * @var string Locales */ - protected static $_default = array('en' => true); + protected static $_default = ['en' => true]; /** * Generates a locale object @@ -1203,11 +1203,11 @@ public static function setDefault($locale, $quality = 1) $locale = self::_prepareLocale($locale); if (isset(self::$_localeData[(string) $locale]) === true) { - self::$_default = array((string) $locale => $quality); + self::$_default = [(string) $locale => $quality]; } else { $elocale = explode('_', (string) $locale); if (isset(self::$_localeData[$elocale[0]]) === true) { - self::$_default = array($elocale[0] => $quality); + self::$_default = [$elocale[0] => $quality]; } else { require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unknown locale '" . (string) $locale . "' can not be set as default!"); @@ -1236,7 +1236,7 @@ public static function getEnvironment() $language = setlocale(LC_ALL, 0); $languages = explode(';', $language); - $languagearray = array(); + $languagearray = []; foreach ($languages as $locale) { if (strpos($locale, '=') !== false) { @@ -1296,7 +1296,7 @@ public static function getBrowser() $httplanguages = $_SERVER['HTTP_ACCEPT_LANGUAGE']; } - $languages = array(); + $languages = []; if (empty($httplanguages)) { return $languages; } @@ -1410,7 +1410,7 @@ public static function getHttpCharset() { $httpcharsets = getenv('HTTP_ACCEPT_CHARSET'); - $charsets = array(); + $charsets = []; if ($httpcharsets === false) { return $charsets; } diff --git a/library/Zend/Locale/Data.php b/library/Zend/Locale/Data.php index 63024ea706..629f0e2680 100644 --- a/library/Zend/Locale/Data.php +++ b/library/Zend/Locale/Data.php @@ -44,14 +44,14 @@ class Zend_Locale_Data * * @var array */ - private static $_ldml = array(); + private static $_ldml = []; /** * List of values which are collected * * @var array */ - private static $_list = array(); + private static $_list = []; /** * Internal cache for ldml values @@ -227,7 +227,7 @@ private static function _findRoute($locale, $path, $attribute, $value, &$temp) * @return array * @throws Zend_Locale_Exception */ - private static function _getFile($locale, $path, $attribute = false, $value = false, $temp = array()) + private static function _getFile($locale, $path, $attribute = false, $value = false, $temp = []) { $result = self::_findRoute($locale, $path, $attribute, $value, $temp); if ($result) { @@ -324,8 +324,8 @@ public static function getList($locale, $path, $value = false) self::$_cache = Zend_Cache::factory( 'Core', 'File', - array('automatic_serialization' => true), - array()); + ['automatic_serialization' => true], + []); } $val = $value; @@ -339,7 +339,7 @@ public static function getList($locale, $path, $value = false) return unserialize($result); } - $temp = array(); + $temp = []; switch(strtolower($path)) { case 'language': $temp = self::_getFile($locale, '/ldml/localeDisplayNames/languages/language', 'type'); @@ -465,7 +465,7 @@ public static function getList($locale, $path, $value = false) case 'month': if (empty($value)) { - $value = array("gregorian", "format", "wide"); + $value = ["gregorian", "format", "wide"]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/months/monthContext[@type=\'' . $value[1] . '\']/monthWidth[@type=\'' . $value[2] . '\']/month', 'type'); break; @@ -486,7 +486,7 @@ public static function getList($locale, $path, $value = false) case 'day': if (empty($value)) { - $value = array("gregorian", "format", "wide"); + $value = ["gregorian", "format", "wide"]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/days/dayContext[@type=\'' . $value[1] . '\']/dayWidth[@type=\'' . $value[2] . '\']/day', 'type'); break; @@ -517,7 +517,7 @@ public static function getList($locale, $path, $value = false) case 'quarter': if (empty($value)) { - $value = array("gregorian", "format", "wide"); + $value = ["gregorian", "format", "wide"]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/quarters/quarterContext[@type=\'' . $value[1] . '\']/quarterWidth[@type=\'' . $value[2] . '\']/quarter', 'type'); break; @@ -533,7 +533,7 @@ public static function getList($locale, $path, $value = false) case 'era': if (empty($value)) { - $value = array("gregorian", "Abbr"); + $value = ["gregorian", "Abbr"]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/eras/era' . $value[1] . '/era', 'type'); break; @@ -578,10 +578,10 @@ public static function getList($locale, $path, $value = false) $medi = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'medium\']/dateTimeFormat/pattern', '', 'medi'); $shor = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'short\']/dateTimeFormat/pattern', '', 'shor'); - $temp['full'] = str_replace(array('{0}', '{1}'), array($timefull['full'], $datefull['full']), $full['full']); - $temp['long'] = str_replace(array('{0}', '{1}'), array($timelong['long'], $datelong['long']), $long['long']); - $temp['medium'] = str_replace(array('{0}', '{1}'), array($timemedi['medi'], $datemedi['medi']), $medi['medi']); - $temp['short'] = str_replace(array('{0}', '{1}'), array($timeshor['shor'], $dateshor['shor']), $shor['shor']); + $temp['full'] = str_replace(['{0}', '{1}'], [$timefull['full'], $datefull['full']], $full['full']); + $temp['long'] = str_replace(['{0}', '{1}'], [$timelong['long'], $datelong['long']], $long['long']); + $temp['medium'] = str_replace(['{0}', '{1}'], [$timemedi['medi'], $datemedi['medi']], $medi['medi']); + $temp['short'] = str_replace(['{0}', '{1}'], [$timeshor['shor'], $dateshor['shor']], $shor['shor']); break; case 'dateitem': @@ -717,7 +717,7 @@ public static function getList($locale, $path, $value = false) case 'territorytoregion': $_temp2 = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group', 'type'); - $_temp = array(); + $_temp = []; foreach ($_temp2 as $key => $found) { $_temp += self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $key . '\']', 'contains', $key); } @@ -745,7 +745,7 @@ public static function getList($locale, $path, $value = false) case 'languagetoscript': $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type'); - $_temp = array(); + $_temp = []; foreach ($_temp2 as $key => $found) { $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'scripts', $key); } @@ -776,7 +776,7 @@ public static function getList($locale, $path, $value = false) case 'languagetoterritory': $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type'); - $_temp = array(); + $_temp = []; foreach ($_temp2 as $key => $found) { $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'territories', $key); } @@ -832,7 +832,7 @@ public static function getList($locale, $path, $value = false) case 'timezonetocity': $_temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone', 'type'); - $temp = array(); + $temp = []; foreach($_temp as $key => $found) { $temp += self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $key . '\']/exemplarCity', '', $key); if (!empty($temp[$key])) { @@ -947,7 +947,7 @@ public static function getList($locale, $path, $value = false) if (isset(self::$_cache)) { if (self::$_cacheTags) { - self::$_cache->save( serialize($temp), $id, array('Zend_Locale')); + self::$_cache->save( serialize($temp), $id, ['Zend_Locale']); } else { self::$_cache->save( serialize($temp), $id); } @@ -974,8 +974,8 @@ public static function getContent($locale, $path, $value = false) self::$_cache = Zend_Cache::factory( 'Core', 'File', - array('automatic_serialization' => true), - array()); + ['automatic_serialization' => true], + []); } $val = $value; @@ -1045,7 +1045,7 @@ public static function getContent($locale, $path, $value = false) case 'month': if (!is_array($value)) { $temp = $value; - $value = array("gregorian", "format", "wide", $temp); + $value = ["gregorian", "format", "wide", $temp]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/months/monthContext[@type=\'' . $value[1] . '\']/monthWidth[@type=\'' . $value[2] . '\']/month[@type=\'' . $value[3] . '\']', 'type'); break; @@ -1073,7 +1073,7 @@ public static function getContent($locale, $path, $value = false) case 'day': if (!is_array($value)) { $temp = $value; - $value = array("gregorian", "format", "wide", $temp); + $value = ["gregorian", "format", "wide", $temp]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/days/dayContext[@type=\'' . $value[1] . '\']/dayWidth[@type=\'' . $value[2] . '\']/day[@type=\'' . $value[3] . '\']', 'type'); break; @@ -1081,29 +1081,29 @@ public static function getContent($locale, $path, $value = false) case 'quarter': if (!is_array($value)) { $temp = $value; - $value = array("gregorian", "format", "wide", $temp); + $value = ["gregorian", "format", "wide", $temp]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/quarters/quarterContext[@type=\'' . $value[1] . '\']/quarterWidth[@type=\'' . $value[2] . '\']/quarter[@type=\'' . $value[3] . '\']', 'type'); break; case 'am': if (empty($value)) { - $value = array("gregorian", "format", "wide"); + $value = ["gregorian", "format", "wide"]; } if (!is_array($value)) { $temp = $value; - $value = array($temp, "format", "wide"); + $value = [$temp, "format", "wide"]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dayPeriods/dayPeriodContext[@type=\'' . $value[1] . '\']/dayPeriodWidth[@type=\'' . $value[2] . '\']/dayPeriod[@type=\'am\']', '', 'dayPeriod'); break; case 'pm': if (empty($value)) { - $value = array("gregorian", "format", "wide"); + $value = ["gregorian", "format", "wide"]; } if (!is_array($value)) { $temp = $value; - $value = array($temp, "format", "wide"); + $value = [$temp, "format", "wide"]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dayPeriods/dayPeriodContext[@type=\'' . $value[1] . '\']/dayPeriodWidth[@type=\'' . $value[2] . '\']/dayPeriod[@type=\'pm\']', '', 'dayPeriod'); break; @@ -1111,7 +1111,7 @@ public static function getContent($locale, $path, $value = false) case 'era': if (!is_array($value)) { $temp = $value; - $value = array("gregorian", "Abbr", $temp); + $value = ["gregorian", "Abbr", $temp]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/eras/era' . $value[1] . '/era[@type=\'' . $value[2] . '\']', 'type'); break; @@ -1128,11 +1128,11 @@ public static function getContent($locale, $path, $value = false) case 'date': if (empty($value)) { - $value = array("gregorian", "medium"); + $value = ["gregorian", "medium"]; } if (!is_array($value)) { $temp = $value; - $value = array("gregorian", $temp); + $value = ["gregorian", $temp]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateFormats/dateFormatLength[@type=\'' . $value[1] . '\']/dateFormat/pattern', '', 'pattern'); break; @@ -1149,48 +1149,48 @@ public static function getContent($locale, $path, $value = false) case 'time': if (empty($value)) { - $value = array("gregorian", "medium"); + $value = ["gregorian", "medium"]; } if (!is_array($value)) { $temp = $value; - $value = array("gregorian", $temp); + $value = ["gregorian", $temp]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/timeFormats/timeFormatLength[@type=\'' . $value[1] . '\']/timeFormat/pattern', '', 'pattern'); break; case 'datetime': if (empty($value)) { - $value = array("gregorian", "medium"); + $value = ["gregorian", "medium"]; } if (!is_array($value)) { $temp = $value; - $value = array("gregorian", $temp); + $value = ["gregorian", $temp]; } $date = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateFormats/dateFormatLength[@type=\'' . $value[1] . '\']/dateFormat/pattern', '', 'pattern'); $time = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/timeFormats/timeFormatLength[@type=\'' . $value[1] . '\']/timeFormat/pattern', '', 'pattern'); $datetime = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateTimeFormats/dateTimeFormatLength[@type=\'' . $value[1] . '\']/dateTimeFormat/pattern', '', 'pattern'); - $temp = str_replace(array('{0}', '{1}'), array(current($time), current($date)), current($datetime)); + $temp = str_replace(['{0}', '{1}'], [current($time), current($date)], current($datetime)); break; case 'dateitem': if (empty($value)) { - $value = array("gregorian", "yyMMdd"); + $value = ["gregorian", "yyMMdd"]; } if (!is_array($value)) { $temp = $value; - $value = array("gregorian", $temp); + $value = ["gregorian", $temp]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateTimeFormats/availableFormats/dateFormatItem[@id=\'' . $value[1] . '\']', ''); break; case 'dateinterval': if (empty($value)) { - $value = array("gregorian", "yMd", "y"); + $value = ["gregorian", "yMd", "y"]; } if (!is_array($value)) { $temp = $value; - $value = array("gregorian", $temp, $temp[0]); + $value = ["gregorian", $temp, $temp[0]]; } $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/dateTimeFormats/intervalFormats/intervalFormatItem[@id=\'' . $value[1] . '\']/greatestDifference[@id=\'' . $value[2] . '\']', ''); break; @@ -1198,7 +1198,7 @@ public static function getContent($locale, $path, $value = false) case 'field': if (!is_array($value)) { $temp = $value; - $value = array("gregorian", $temp); + $value = ["gregorian", $temp]; } $temp = self::_getFile($locale, '/ldml/dates/fields/field[@type=\'' . $value[1] . '\']/displayName', '', $value[1]); break; @@ -1206,7 +1206,7 @@ public static function getContent($locale, $path, $value = false) case 'relative': if (!is_array($value)) { $temp = $value; - $value = array("gregorian", $temp); + $value = ["gregorian", $temp]; } $temp = self::_getFile($locale, '/ldml/dates/fields/field[@type=\'day\']/relative[@type=\'' . $value[1] . '\']', '', $value[1]); // $temp = self::_getFile($locale, '/ldml/dates/calendars/calendar[@type=\'' . $value[0] . '\']/fields/field/relative[@type=\'' . $value[1] . '\']', '', $value[1]); @@ -1239,7 +1239,7 @@ public static function getContent($locale, $path, $value = false) case 'currencytoname': $temp = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $value . '\']/displayName', '', $value); $_temp = self::_getFile($locale, '/ldml/numbers/currencies/currency', 'type'); - $temp = array(); + $temp = []; foreach ($_temp as $key => $keyvalue) { $val = self::_getFile($locale, '/ldml/numbers/currencies/currency[@type=\'' . $key . '\']/displayName', '', $key); if (!isset($val[$key]) || ($val[$key] != $value)) { @@ -1281,7 +1281,7 @@ public static function getContent($locale, $path, $value = false) case 'regiontocurrency': $_temp = self::_getFile('supplementalData', '/supplementalData/currencyData/region', 'iso3166'); - $temp = array(); + $temp = []; foreach ($_temp as $key => $keyvalue) { $val = self::_getFile('supplementalData', '/supplementalData/currencyData/region[@iso3166=\'' . $key . '\']/currency', 'iso4217', $key); if (!isset($val[$key]) || ($val[$key] != $value)) { @@ -1301,11 +1301,11 @@ public static function getContent($locale, $path, $value = false) case 'territorytoregion': $_temp2 = self::_getFile('supplementalData', '/supplementalData/territoryContainment/group', 'type'); - $_temp = array(); + $_temp = []; foreach ($_temp2 as $key => $found) { $_temp += self::_getFile('supplementalData', '/supplementalData/territoryContainment/group[@type=\'' . $key . '\']', 'contains', $key); } - $temp = array(); + $temp = []; foreach($_temp as $key => $found) { $_temp3 = explode(" ", $found); foreach($_temp3 as $found3) { @@ -1327,11 +1327,11 @@ public static function getContent($locale, $path, $value = false) case 'languagetoscript': $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type'); - $_temp = array(); + $_temp = []; foreach ($_temp2 as $key => $found) { $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'scripts', $key); } - $temp = array(); + $temp = []; foreach($_temp as $key => $found) { $_temp3 = explode(" ", $found); foreach($_temp3 as $found3) { @@ -1353,11 +1353,11 @@ public static function getContent($locale, $path, $value = false) case 'languagetoterritory': $_temp2 = self::_getFile('supplementalData', '/supplementalData/languageData/language', 'type'); - $_temp = array(); + $_temp = []; foreach ($_temp2 as $key => $found) { $_temp += self::_getFile('supplementalData', '/supplementalData/languageData/language[@type=\'' . $key . '\']', 'territories', $key); } - $temp = array(); + $temp = []; foreach($_temp as $key => $found) { $_temp3 = explode(" ", $found); foreach($_temp3 as $found3) { @@ -1395,7 +1395,7 @@ public static function getContent($locale, $path, $value = false) case 'timezonetocity': $_temp = self::_getFile($locale, '/ldml/dates/timeZoneNames/zone', 'type'); - $temp = array(); + $temp = []; foreach($_temp as $key => $found) { $temp += self::_getFile($locale, '/ldml/dates/timeZoneNames/zone[@type=\'' . $key . '\']/exemplarCity', '', $key); if (!empty($temp[$key])) { @@ -1413,11 +1413,11 @@ public static function getContent($locale, $path, $value = false) case 'territorytophone': $_temp2 = self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory', 'territory'); - $_temp = array(); + $_temp = []; foreach ($_temp2 as $key => $found) { $_temp += self::_getFile('telephoneCodeData', '/supplementalData/telephoneCodeData/codesByTerritory[@territory=\'' . $key . '\']/telephoneCountryCode', 'code', $key); } - $temp = array(); + $temp = []; foreach($_temp as $key => $found) { $_temp3 = explode(" ", $found); foreach($_temp3 as $found3) { @@ -1500,7 +1500,7 @@ public static function getContent($locale, $path, $value = false) } if (isset(self::$_cache)) { if (self::$_cacheTags) { - self::$_cache->save( serialize($temp), $id, array('Zend_Locale')); + self::$_cache->save( serialize($temp), $id, ['Zend_Locale']); } else { self::$_cache->save( serialize($temp), $id); } @@ -1562,7 +1562,7 @@ public static function removeCache() public static function clearCache() { if (self::$_cacheTags) { - self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('Zend_Locale')); + self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, ['Zend_Locale']); } else { self::$_cache->clean(Zend_Cache::CLEANING_MODE_ALL); } @@ -1606,12 +1606,12 @@ protected static function _filterCacheId($value) { return strtr( $value, - array( + [ '-' => '_', '%' => '_', '+' => '_', '.' => '_', - ) + ] ); } } diff --git a/library/Zend/Locale/Data/Translation.php b/library/Zend/Locale/Data/Translation.php index ceb16a9bf6..c674561253 100644 --- a/library/Zend/Locale/Data/Translation.php +++ b/library/Zend/Locale/Data/Translation.php @@ -40,7 +40,7 @@ class Zend_Locale_Data_Translation * * @var array $localeTranslation */ - public static $languageTranslation = array( + public static $languageTranslation = [ 'Afrikaans' => 'af', 'Albanian' => 'sq', 'Amharic' => 'am', @@ -173,9 +173,9 @@ class Zend_Locale_Data_Translation 'Yiddish' => 'yi', 'Yoruba' => 'yo', 'Zulu' => 'zu', - ); + ]; - public static $regionTranslation = array( + public static $regionTranslation = [ 'Albania' => 'AL', 'Algeria' => 'DZ', 'Argentina' => 'AR', @@ -281,5 +281,5 @@ class Zend_Locale_Data_Translation 'Venezuela' => 'VE', 'Yemen' => 'YE', 'Zimbabwe' => 'ZW', - ); + ]; } diff --git a/library/Zend/Locale/Format.php b/library/Zend/Locale/Format.php index 9a3e0e13f1..7fb7fb9bb7 100644 --- a/library/Zend/Locale/Format.php +++ b/library/Zend/Locale/Format.php @@ -36,14 +36,14 @@ class Zend_Locale_Format { const STANDARD = 'auto'; - private static $_options = array('date_format' => null, + private static $_options = ['date_format' => null, 'number_format' => null, 'format_type' => 'iso', 'fix_date' => false, 'locale' => null, 'cache' => null, 'disableCache' => null, - 'precision' => null); + 'precision' => null]; /** * Sets class wide options, if no option was given, the actual set options will be returned @@ -61,7 +61,7 @@ class Zend_Locale_Format * @throws Zend_Locale_Exception * @return array if no option was given */ - public static function setOptions(array $options = array()) + public static function setOptions(array $options = []) { self::$_options = self::_checkOptions($options) + self::$_options; return self::$_options; @@ -76,7 +76,7 @@ public static function setOptions(array $options = array()) * @throws Zend_Locale_Exception * @return array if no option was given */ - private static function _checkOptions(array $options = array()) + private static function _checkOptions(array $options = []) { if (count($options) == 0) { return self::$_options; @@ -243,7 +243,7 @@ public static function convertNumerals($input, $from, $to = null) * @return string Returns the extracted number * @throws Zend_Locale_Exception */ - public static function getNumber($input, array $options = array()) + public static function getNumber($input, array $options = []) { $options = self::_checkOptions($options) + self::$_options; if (!is_string($input)) { @@ -297,7 +297,7 @@ public static function getNumber($input, array $options = array()) * @return string locale formatted number * @throws Zend_Locale_Exception */ - public static function toNumber($value, array $options = array()) + public static function toNumber($value, array $options = []) { // load class within method for speed require_once 'Zend/Locale/Math.php'; @@ -507,7 +507,7 @@ private static function _seperateFormat($format, $value, $precision) * @param array $options Options: locale. See {@link setOptions()} for details. * @return boolean Returns true if a number was found */ - public static function isNumber($input, array $options = array()) + public static function isNumber($input, array $options = []) { if (!self::_getUniCodeSupport()) { trigger_error("Sorry, your PCRE extension does not support UTF8 which is needed for the I18N core", E_USER_NOTICE); @@ -643,7 +643,7 @@ private static function _getRegexForType($type, $options) * @param array $options Options: locale, precision. See {@link setOptions()} for details. * @return float */ - public static function getFloat($input, array $options = array()) + public static function getFloat($input, array $options = []) { return (float)self::getNumber($input, $options); } @@ -656,7 +656,7 @@ public static function getFloat($input, array $options = array()) * @param array $options Options: locale, precision. See {@link setOptions()} for details. * @return string Locale formatted number */ - public static function toFloat($value, array $options = array()) + public static function toFloat($value, array $options = []) { $options['number_format'] = Zend_Locale_Format::STANDARD; return self::toNumber($value, $options); @@ -670,7 +670,7 @@ public static function toFloat($value, array $options = array()) * @param array $options Options: locale. See {@link setOptions()} for details. * @return boolean Returns true if a number was found */ - public static function isFloat($value, array $options = array()) + public static function isFloat($value, array $options = []) { return self::isNumber($value, $options); } @@ -691,7 +691,7 @@ public static function isFloat($value, array $options = array()) * @param array $options Options: locale. See {@link setOptions()} for details. * @return integer Returns the extracted number */ - public static function getInteger($input, array $options = array()) + public static function getInteger($input, array $options = []) { $options['precision'] = 0; return (int)self::getFloat($input, $options); @@ -704,7 +704,7 @@ public static function getInteger($input, array $options = array()) * @param array $options Options: locale. See {@link setOptions()} for details. * @return string Locale formatted number */ - public static function toInteger($value, array $options = array()) + public static function toInteger($value, array $options = []) { $options['precision'] = 0; $options['number_format'] = Zend_Locale_Format::STANDARD; @@ -718,7 +718,7 @@ public static function toInteger($value, array $options = array()) * @param array $options Options: locale. See {@link setOptions()} for details. * @return boolean Returns true if a integer was found */ - public static function isInteger($value, array $options = array()) + public static function isInteger($value, array $options = []) { if (!self::isNumber($value, $options)) { return false; @@ -749,7 +749,7 @@ public static function convertPhpToIsoFormat($format) return null; } - $convert = array( + $convert = [ 'd' => 'dd' , 'D' => 'EE' , 'j' => 'd' , 'l' => 'EEEE', 'N' => 'eee' , 'S' => 'SS' , 'w' => 'e' , 'z' => 'D' , 'W' => 'ww' , 'F' => 'MMMM', 'm' => 'MM' , 'M' => 'MMM' , @@ -760,10 +760,10 @@ public static function convertPhpToIsoFormat($format) 'I' => 'I' , 'O' => 'Z' , 'P' => 'ZZZZ', 'T' => 'z' , 'Z' => 'X' , 'c' => 'yyyy-MM-ddTHH:mm:ssZZZZ', 'r' => 'r', 'U' => 'U', - ); + ]; $escaped = false; $inEscapedString = false; - $converted = array(); + $converted = []; foreach (str_split($format) as $char) { if (!$escaped && $char == '\\') { // Next char will be escaped: let's remember it @@ -814,8 +814,8 @@ private static function _parseDate($date, $options) } $options = self::_checkOptions($options) + self::$_options; - $test = array('h', 'H', 'm', 's', 'y', 'Y', 'M', 'd', 'D', 'E', 'S', 'l', 'B', 'I', - 'X', 'r', 'U', 'G', 'w', 'e', 'a', 'A', 'Z', 'z', 'v'); + $test = ['h', 'H', 'm', 's', 'y', 'Y', 'M', 'd', 'D', 'E', 'S', 'l', 'B', 'I', + 'X', 'r', 'U', 'G', 'w', 'e', 'a', 'A', 'Z', 'z', 'v']; $format = $options['date_format']; $number = $date; // working copy @@ -870,7 +870,7 @@ private static function _parseDate($date, $options) 'month')); if ($position === false) { $position = self::_replaceMonth($number, Zend_Locale_Data::getList($options['locale'], - 'month', array('gregorian', 'format', 'abbreviated'))); + 'month', ['gregorian', 'format', 'abbreviated'])); } } } @@ -1151,7 +1151,7 @@ public static function getDateFormat($locale = null) * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details. * @return array Possible array members: day, month, year, hour, minute, second, fixed, format */ - public static function getDate($date, array $options = array()) + public static function getDate($date, array $options = []) { $options = self::_checkOptions($options) + self::$_options; if (empty($options['date_format'])) { @@ -1171,7 +1171,7 @@ public static function getDate($date, array $options = array()) * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details. * @return boolean */ - public static function checkDateFormat($date, array $options = array()) + public static function checkDateFormat($date, array $options = []) { try { $date = self::getDate($date, $options); @@ -1249,7 +1249,7 @@ public static function getTimeFormat($locale = null) * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details. * @return array Possible array members: day, month, year, hour, minute, second, fixed, format */ - public static function getTime($time, array $options = array()) + public static function getTime($time, array $options = []) { $options = self::_checkOptions($options) + self::$_options; if (empty($options['date_format'])) { @@ -1288,7 +1288,7 @@ public static function getDateTimeFormat($locale = null) * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details. * @return array Possible array members: day, month, year, hour, minute, second, fixed, format */ - public static function getDateTime($datetime, array $options = array()) + public static function getDateTime($datetime, array $options = []) { $options = self::_checkOptions($options) + self::$_options; if (empty($options['date_format'])) { diff --git a/library/Zend/Locale/Math.php b/library/Zend/Locale/Math.php index c3d3a1bf8a..27b6f048bb 100644 --- a/library/Zend/Locale/Math.php +++ b/library/Zend/Locale/Math.php @@ -37,14 +37,14 @@ class Zend_Locale_Math // support unit testing without using bcmath functions public static $_bcmathDisabled = false; - public static $add = array('Zend_Locale_Math', 'Add'); - public static $sub = array('Zend_Locale_Math', 'Sub'); - public static $pow = array('Zend_Locale_Math', 'Pow'); - public static $mul = array('Zend_Locale_Math', 'Mul'); - public static $div = array('Zend_Locale_Math', 'Div'); - public static $comp = array('Zend_Locale_Math', 'Comp'); - public static $sqrt = array('Zend_Locale_Math', 'Sqrt'); - public static $mod = array('Zend_Locale_Math', 'Mod'); + public static $add = ['Zend_Locale_Math', 'Add']; + public static $sub = ['Zend_Locale_Math', 'Sub']; + public static $pow = ['Zend_Locale_Math', 'Pow']; + public static $mul = ['Zend_Locale_Math', 'Mul']; + public static $div = ['Zend_Locale_Math', 'Div']; + public static $comp = ['Zend_Locale_Math', 'Comp']; + public static $sqrt = ['Zend_Locale_Math', 'Sqrt']; + public static $mod = ['Zend_Locale_Math', 'Mod']; public static $scale = 'bcscale'; public static function isBcmathDisabled() diff --git a/library/Zend/Locale/Math/Exception.php b/library/Zend/Locale/Math/Exception.php index e065b18962..ffb6dc9574 100644 --- a/library/Zend/Locale/Math/Exception.php +++ b/library/Zend/Locale/Math/Exception.php @@ -48,6 +48,6 @@ public function __construct($message, $op1 = null, $op2 = null, $result = null) public function getResults() { - return array($this->op1, $this->op2, $this->result); + return [$this->op1, $this->op2, $this->result]; } } diff --git a/library/Zend/Locale/Math/PhpMath.php b/library/Zend/Locale/Math/PhpMath.php index f5a0cc6d71..d52244c041 100644 --- a/library/Zend/Locale/Math/PhpMath.php +++ b/library/Zend/Locale/Math/PhpMath.php @@ -36,15 +36,15 @@ class Zend_Locale_Math_PhpMath extends Zend_Locale_Math public static function disable() { self::$_bcmathDisabled = true; - self::$add = array('Zend_Locale_Math_PhpMath', 'Add'); - self::$sub = array('Zend_Locale_Math_PhpMath', 'Sub'); - self::$pow = array('Zend_Locale_Math_PhpMath', 'Pow'); - self::$mul = array('Zend_Locale_Math_PhpMath', 'Mul'); - self::$div = array('Zend_Locale_Math_PhpMath', 'Div'); - self::$comp = array('Zend_Locale_Math_PhpMath', 'Comp'); - self::$sqrt = array('Zend_Locale_Math_PhpMath', 'Sqrt'); - self::$mod = array('Zend_Locale_Math_PhpMath', 'Mod'); - self::$scale = array('Zend_Locale_Math_PhpMath', 'Scale'); + self::$add = ['Zend_Locale_Math_PhpMath', 'Add']; + self::$sub = ['Zend_Locale_Math_PhpMath', 'Sub']; + self::$pow = ['Zend_Locale_Math_PhpMath', 'Pow']; + self::$mul = ['Zend_Locale_Math_PhpMath', 'Mul']; + self::$div = ['Zend_Locale_Math_PhpMath', 'Div']; + self::$comp = ['Zend_Locale_Math_PhpMath', 'Comp']; + self::$sqrt = ['Zend_Locale_Math_PhpMath', 'Sqrt']; + self::$mod = ['Zend_Locale_Math_PhpMath', 'Mod']; + self::$scale = ['Zend_Locale_Math_PhpMath', 'Scale']; self::$defaultScale = 0; self::$defaultPrecision = 1; diff --git a/library/Zend/Log.php b/library/Zend/Log.php index 133feca981..ab153e7c67 100644 --- a/library/Zend/Log.php +++ b/library/Zend/Log.php @@ -52,22 +52,22 @@ class Zend_Log * @var array of priorities where the keys are the * priority numbers and the values are the priority names */ - protected $_priorities = array(); + protected $_priorities = []; /** * @var array of Zend_Log_Writer_Abstract */ - protected $_writers = array(); + protected $_writers = []; /** * @var array of Zend_Log_Filter_Interface */ - protected $_filters = array(); + protected $_filters = []; /** * @var array of extra log event */ - protected $_extras = array(); + protected $_extras = []; /** * @@ -134,7 +134,7 @@ public function __construct(Zend_Log_Writer_Abstract $writer = null) * @return Zend_Log * @throws Zend_Log_Exception */ - static public function factory($config = array()) + static public function factory($config = []) { if ($config instanceof Zend_Config) { $config = $config->toArray(); @@ -281,7 +281,7 @@ protected function _constructFromConfig($type, $config, $namespace) ); } - $params = isset($config[ $type .'Params' ]) ? $config[ $type .'Params' ] : array(); + $params = isset($config[ $type .'Params' ]) ? $config[ $type .'Params' ] : []; $className = $this->getClassName($config, $type, $namespace); if (!class_exists($className)) { require_once 'Zend/Loader.php'; @@ -296,7 +296,7 @@ protected function _constructFromConfig($type, $config, $namespace) ); } - return call_user_func(array($className, 'factory'), $params); + return call_user_func([$className, 'factory'], $params); } /** @@ -344,12 +344,12 @@ protected function getClassName($config, $type, $defaultNamespace) */ protected function _packEvent($message, $priority) { - return array_merge(array( + return array_merge([ 'timestamp' => date($this->_timestampFormat), 'message' => $message, 'priority' => $priority, 'priorityName' => $this->_priorities[$priority] - ), + ], $this->_extras ); } @@ -433,7 +433,7 @@ public function log($message, $priority, $extras = null) // Check to see if any extra information was passed if (!empty($extras)) { - $info = array(); + $info = []; if (is_array($extras)) { foreach ($extras as $key => $value) { if (is_string($key)) { @@ -554,7 +554,7 @@ public function addWriter($writer) */ public function setEventItem($name, $value) { - $this->_extras = array_merge($this->_extras, array($name => $value)); + $this->_extras = array_merge($this->_extras, [$name => $value]); return $this; } @@ -580,11 +580,11 @@ public function registerErrorHandler() return $this; } - $this->_origErrorHandler = set_error_handler(array($this, 'errorHandler')); + $this->_origErrorHandler = set_error_handler([$this, 'errorHandler']); // Contruct a default map of phpErrors to Zend_Log priorities. // Some of the errors are uncatchable, but are included for completeness - $this->_errorHandlerMap = array( + $this->_errorHandlerMap = [ E_NOTICE => Zend_Log::NOTICE, E_USER_NOTICE => Zend_Log::NOTICE, E_WARNING => Zend_Log::WARN, @@ -595,7 +595,7 @@ public function registerErrorHandler() E_CORE_ERROR => Zend_Log::ERR, E_RECOVERABLE_ERROR => Zend_Log::ERR, E_STRICT => Zend_Log::DEBUG, - ); + ]; // PHP 5.3.0+ if (defined('E_DEPRECATED')) { $this->_errorHandlerMap['E_DEPRECATED'] = Zend_Log::DEBUG; @@ -629,7 +629,7 @@ public function errorHandler($errno, $errstr, $errfile, $errline, $errcontext) } else { $priority = Zend_Log::INFO; } - $this->log($errstr, $priority, array('errno'=>$errno, 'file'=>$errfile, 'line'=>$errline, 'context'=>$errcontext)); + $this->log($errstr, $priority, ['errno'=>$errno, 'file'=>$errfile, 'line'=>$errline, 'context'=>$errcontext]); } if ($this->_origErrorHandler !== null) { diff --git a/library/Zend/Log/Filter/Message.php b/library/Zend/Log/Filter/Message.php index eff0c99da8..d5d0ef59bc 100644 --- a/library/Zend/Log/Filter/Message.php +++ b/library/Zend/Log/Filter/Message.php @@ -63,9 +63,9 @@ public function __construct($regexp) static public function factory($config) { $config = self::_parseConfig($config); - $config = array_merge(array( + $config = array_merge([ 'regexp' => null - ), $config); + ], $config); return new self( $config['regexp'] diff --git a/library/Zend/Log/Filter/Priority.php b/library/Zend/Log/Filter/Priority.php index d86f5d60fe..77937cb352 100644 --- a/library/Zend/Log/Filter/Priority.php +++ b/library/Zend/Log/Filter/Priority.php @@ -72,10 +72,10 @@ public function __construct($priority, $operator = null) static public function factory($config) { $config = self::_parseConfig($config); - $config = array_merge(array( + $config = array_merge([ 'priority' => null, 'operator' => null, - ), $config); + ], $config); // Add support for constants if (!is_numeric($config['priority']) && isset($config['priority']) && defined($config['priority'])) { diff --git a/library/Zend/Log/Formatter/Xml.php b/library/Zend/Log/Formatter/Xml.php index 71c47d336f..c8edb2b2a0 100644 --- a/library/Zend/Log/Formatter/Xml.php +++ b/library/Zend/Log/Formatter/Xml.php @@ -55,16 +55,16 @@ class Zend_Log_Formatter_Xml extends Zend_Log_Formatter_Abstract * @param array|Zend_Config $options * @return void */ - public function __construct($options = array()) + public function __construct($options = []) { if ($options instanceof Zend_Config) { $options = $options->toArray(); } elseif (!is_array($options)) { $args = func_get_args(); - $options = array( + $options = [ 'rootElement' => array_shift($args) - ); + ]; if (count($args)) { $options['elementMap'] = array_shift($args); @@ -135,7 +135,7 @@ public function format($event) if ($this->_elementMap === null) { $dataToInsert = $event; } else { - $dataToInsert = array(); + $dataToInsert = []; foreach ($this->_elementMap as $elementName => $fieldKey) { $dataToInsert[$elementName] = $event[$fieldKey]; } diff --git a/library/Zend/Log/Writer/Abstract.php b/library/Zend/Log/Writer/Abstract.php index 47c45ba8b8..7937557692 100644 --- a/library/Zend/Log/Writer/Abstract.php +++ b/library/Zend/Log/Writer/Abstract.php @@ -36,7 +36,7 @@ abstract class Zend_Log_Writer_Abstract implements Zend_Log_FactoryInterface /** * @var array of Zend_Log_Filter_Interface */ - protected $_filters = array(); + protected $_filters = []; /** * Formats the log message before writing. diff --git a/library/Zend/Log/Writer/Db.php b/library/Zend/Log/Writer/Db.php index 8dcaf9c61f..9507575f5b 100644 --- a/library/Zend/Log/Writer/Db.php +++ b/library/Zend/Log/Writer/Db.php @@ -78,11 +78,11 @@ public function __construct($db, $table, $columnMap = null) static public function factory($config) { $config = self::_parseConfig($config); - $config = array_merge(array( + $config = array_merge([ 'db' => null, 'table' => null, 'columnMap' => null, - ), $config); + ], $config); if (isset($config['columnmap'])) { $config['columnMap'] = $config['columnmap']; @@ -134,7 +134,7 @@ protected function _write($event) if ($this->_columnMap === null) { $dataToInsert = $event; } else { - $dataToInsert = array(); + $dataToInsert = []; foreach ($this->_columnMap as $columnName => $fieldKey) { if (isset($event[$fieldKey])) { $dataToInsert[$columnName] = $event[$fieldKey]; diff --git a/library/Zend/Log/Writer/Firebug.php b/library/Zend/Log/Writer/Firebug.php index b25310dd0a..a8f74eee85 100644 --- a/library/Zend/Log/Writer/Firebug.php +++ b/library/Zend/Log/Writer/Firebug.php @@ -48,14 +48,14 @@ class Zend_Log_Writer_Firebug extends Zend_Log_Writer_Abstract * * @var array */ - protected $_priorityStyles = array(Zend_Log::EMERG => Zend_Wildfire_Plugin_FirePhp::ERROR, + protected $_priorityStyles = [Zend_Log::EMERG => Zend_Wildfire_Plugin_FirePhp::ERROR, Zend_Log::ALERT => Zend_Wildfire_Plugin_FirePhp::ERROR, Zend_Log::CRIT => Zend_Wildfire_Plugin_FirePhp::ERROR, Zend_Log::ERR => Zend_Wildfire_Plugin_FirePhp::ERROR, Zend_Log::WARN => Zend_Wildfire_Plugin_FirePhp::WARN, Zend_Log::NOTICE => Zend_Wildfire_Plugin_FirePhp::INFO, Zend_Log::INFO => Zend_Wildfire_Plugin_FirePhp::INFO, - Zend_Log::DEBUG => Zend_Wildfire_Plugin_FirePhp::LOG); + Zend_Log::DEBUG => Zend_Wildfire_Plugin_FirePhp::LOG]; /** * The default logging style for un-mapped priorities @@ -198,7 +198,7 @@ protected function _write($event) Zend_Wildfire_Plugin_FirePhp::getInstance()->send($message, $label, $type, - array('traceOffset'=>4, - 'fixZendLogOffsetIfApplicable'=>true)); + ['traceOffset'=>4, + 'fixZendLogOffsetIfApplicable'=>true]); } } diff --git a/library/Zend/Log/Writer/Mail.php b/library/Zend/Log/Writer/Mail.php index 931dfe97bc..39d527593c 100644 --- a/library/Zend/Log/Writer/Mail.php +++ b/library/Zend/Log/Writer/Mail.php @@ -50,7 +50,7 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract * * @var array */ - protected $_eventsToMail = array(); + protected $_eventsToMail = []; /** * Array of formatted lines for use in an HTML email body; these events @@ -59,7 +59,7 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract * * @var array */ - protected $_layoutEventsToMail = array(); + protected $_layoutEventsToMail = []; /** * Zend_Mail instance to use @@ -87,7 +87,7 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract * * @var array */ - protected $_numEntriesPerPriority = array(); + protected $_numEntriesPerPriority = []; /** * Subject prepend text. @@ -105,12 +105,12 @@ class Zend_Log_Writer_Mail extends Zend_Log_Writer_Abstract * * @var array */ - protected static $_methodMapHeaders = array( + protected static $_methodMapHeaders = [ 'from' => 'setFrom', 'to' => 'addTo', 'cc' => 'addCc', 'bcc' => 'addBcc', - ); + ]; /** * Class constructor. @@ -213,16 +213,16 @@ protected static function _constructMailFromConfig(array $config) if (is_array($address) && isset($address['name']) && !is_numeric($address['name']) ) { - $params = array( + $params = [ $address['email'], $address['name'] - ); + ]; } else if (is_array($address) && isset($address['email'])) { - $params = array($address['email']); + $params = [$address['email']]; } else { - $params = array($address); + $params = [$address]; } - call_user_func_array(array($mail, $method), $params); + call_user_func_array([$mail, $method], $params); } } @@ -238,10 +238,10 @@ protected static function _constructMailFromConfig(array $config) */ protected function _constructLayoutFromConfig(array $config) { - $config = array_merge(array( + $config = array_merge([ 'layout' => 'Zend_Layout', 'layoutOptions' => null - ), $config); + ], $config); $layoutClass = $config['layout']; $layout = new $layoutClass($config['layoutOptions']); @@ -419,7 +419,7 @@ public function shutdown() */ protected function _getFormattedNumEntriesPerPriority() { - $strings = array(); + $strings = []; foreach ($this->_numEntriesPerPriority as $priority => $numEntries) { $strings[] = "{$priority}={$numEntries}"; diff --git a/library/Zend/Log/Writer/Mock.php b/library/Zend/Log/Writer/Mock.php index d8674bd85f..9520b4dc88 100644 --- a/library/Zend/Log/Writer/Mock.php +++ b/library/Zend/Log/Writer/Mock.php @@ -38,7 +38,7 @@ class Zend_Log_Writer_Mock extends Zend_Log_Writer_Abstract * * @var array */ - public $events = array(); + public $events = []; /** * shutdown called? diff --git a/library/Zend/Log/Writer/Stream.php b/library/Zend/Log/Writer/Stream.php index e3664d99c6..ca54e09516 100644 --- a/library/Zend/Log/Writer/Stream.php +++ b/library/Zend/Log/Writer/Stream.php @@ -94,10 +94,10 @@ public function __construct($streamOrUrl, $mode = null) static public function factory($config) { $config = self::_parseConfig($config); - $config = array_merge(array( + $config = array_merge([ 'stream' => null, 'mode' => null, - ), $config); + ], $config); $streamOrUrl = isset($config['url']) ? $config['url'] : $config['stream']; diff --git a/library/Zend/Log/Writer/Syslog.php b/library/Zend/Log/Writer/Syslog.php index 66dfeaabf9..9af841ed32 100644 --- a/library/Zend/Log/Writer/Syslog.php +++ b/library/Zend/Log/Writer/Syslog.php @@ -42,7 +42,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract * * @var array */ - protected $_priorities = array( + protected $_priorities = [ Zend_Log::EMERG => LOG_EMERG, Zend_Log::ALERT => LOG_ALERT, Zend_Log::CRIT => LOG_CRIT, @@ -51,7 +51,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract Zend_Log::NOTICE => LOG_NOTICE, Zend_Log::INFO => LOG_INFO, Zend_Log::DEBUG => LOG_DEBUG, - ); + ]; /** * The default log priority - for unmapped custom priorities @@ -93,7 +93,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract * * @var array */ - protected $_validFacilities = array(); + protected $_validFacilities = []; /** * Class constructor @@ -101,7 +101,7 @@ class Zend_Log_Writer_Syslog extends Zend_Log_Writer_Abstract * @param array $params Array of options; may include "application" and "facility" keys * @return void */ - public function __construct(array $params = array()) + public function __construct(array $params = []) { if (isset($params['application'])) { $this->_application = $params['application']; @@ -136,7 +136,7 @@ static public function factory($config) */ protected function _initializeValidFacilities() { - $constants = array( + $constants = [ 'LOG_AUTH', 'LOG_AUTHPRIV', 'LOG_CRON', @@ -156,7 +156,7 @@ protected function _initializeValidFacilities() 'LOG_SYSLOG', 'LOG_USER', 'LOG_UUCP' - ); + ]; foreach ($constants as $constant) { if (defined($constant)) { diff --git a/library/Zend/Mail.php b/library/Zend/Mail.php index 264d9790b6..e73953fa09 100644 --- a/library/Zend/Mail.php +++ b/library/Zend/Mail.php @@ -83,7 +83,7 @@ class Zend_Mail extends Zend_Mime_Message * Mail headers * @var array */ - protected $_headers = array(); + protected $_headers = []; /** * Encoding of Mail headers @@ -101,13 +101,13 @@ class Zend_Mail extends Zend_Mime_Message * To: addresses * @var array */ - protected $_to = array(); + protected $_to = []; /** * Array of all recipients * @var array */ - protected $_recipients = array(); + protected $_recipients = []; /** * Reply-To header @@ -238,11 +238,11 @@ public function getCharset() */ public function setType($type) { - $allowed = array( + $allowed = [ Zend_Mime::MULTIPART_ALTERNATIVE, Zend_Mime::MULTIPART_MIXED, Zend_Mime::MULTIPART_RELATED, - ); + ]; if (!in_array($type, $allowed)) { /** * @see Zend_Mail_Exception @@ -335,10 +335,10 @@ public function setEncodingOfHeaders($encoding) */ public function setHeaderEncoding($encoding) { - $allowed = array( + $allowed = [ Zend_Mime::ENCODING_BASE64, Zend_Mime::ENCODING_QUOTEDPRINTABLE - ); + ]; if (!in_array($encoding, $allowed)) { /** * @see Zend_Mail_Exception @@ -527,7 +527,7 @@ protected function _storeHeader($headerName, $value, $append = false) if (isset($this->_headers[$headerName])) { $this->_headers[$headerName][] = $value; } else { - $this->_headers[$headerName] = array($value); + $this->_headers[$headerName] = [$value]; } if ($append) { @@ -574,7 +574,7 @@ protected function _addRecipientAndHeader($headerName, $email, $name) public function addTo($email, $name='') { if (!is_array($email)) { - $email = array($name => $email); + $email = [$name => $email]; } foreach ($email as $n => $recipient) { @@ -596,7 +596,7 @@ public function addTo($email, $name='') public function addCc($email, $name='') { if (!is_array($email)) { - $email = array($name => $email); + $email = [$name => $email]; } foreach ($email as $n => $recipient) { @@ -615,7 +615,7 @@ public function addCc($email, $name='') public function addBcc($email) { if (!is_array($email)) { - $email = array($email); + $email = [$email]; } foreach ($email as $recipient) { @@ -656,8 +656,8 @@ public function clearHeader($headerName) */ public function clearRecipients() { - $this->_recipients = array(); - $this->_to = array(); + $this->_recipients = []; + $this->_to = []; $this->clearHeader('To'); $this->clearHeader('Cc'); @@ -773,7 +773,7 @@ public function clearReplyTo() */ public static function setDefaultFrom($email, $name = null) { - self::$_defaultFrom = array('email' => $email, 'name' => $name); + self::$_defaultFrom = ['email' => $email, 'name' => $name]; } /** @@ -824,7 +824,7 @@ public function setFromToDefaultFrom() { */ public static function setDefaultReplyTo($email, $name = null) { - self::$_defaultReplyTo = array('email' => $email, 'name' => $name); + self::$_defaultReplyTo = ['email' => $email, 'name' => $name]; } /** @@ -1112,7 +1112,7 @@ public function createMessageId() { $rand = mt_rand(); - if ($this->_recipients !== array()) { + if ($this->_recipients !== []) { $recipient = array_rand($this->_recipients); } else { $recipient = 'unknown'; @@ -1138,10 +1138,10 @@ public function createMessageId() { */ public function addHeader($name, $value, $append = false) { - $prohibit = array('to', 'cc', 'bcc', 'from', 'subject', + $prohibit = ['to', 'cc', 'bcc', 'from', 'subject', 'reply-to', 'return-path', 'date', 'message-id', - ); + ]; if (in_array(strtolower($name), $prohibit)) { /** * @see Zend_Mail_Exception @@ -1211,14 +1211,14 @@ public function send($transport = null) */ protected function _filterEmail($email) { - $rule = array("\r" => '', + $rule = ["\r" => '', "\n" => '', "\t" => '', '"' => '', ',' => '', '<' => '', '>' => '', - ); + ]; return strtr($email, $rule); } @@ -1231,13 +1231,13 @@ protected function _filterEmail($email) */ protected function _filterName($name) { - $rule = array("\r" => '', + $rule = ["\r" => '', "\n" => '', "\t" => '', '"' => "'", '<' => '[', '>' => ']', - ); + ]; return trim(strtr($name, $rule)); } @@ -1250,10 +1250,10 @@ protected function _filterName($name) */ protected function _filterOther($data) { - $rule = array("\r" => '', + $rule = ["\r" => '', "\n" => '', "\t" => '', - ); + ]; return strtr($data, $rule); } diff --git a/library/Zend/Mail/Message.php b/library/Zend/Mail/Message.php index 9d3c8bc522..af811927af 100644 --- a/library/Zend/Mail/Message.php +++ b/library/Zend/Mail/Message.php @@ -42,7 +42,7 @@ class Zend_Mail_Message extends Zend_Mail_Part implements Zend_Mail_Message_Inte * flags for this message * @var array */ - protected $_flags = array(); + protected $_flags = []; /** * Public constructor diff --git a/library/Zend/Mail/Message/File.php b/library/Zend/Mail/Message/File.php index 6f57be6bab..20e7f6b9a7 100644 --- a/library/Zend/Mail/Message/File.php +++ b/library/Zend/Mail/Message/File.php @@ -42,7 +42,7 @@ class Zend_Mail_Message_File extends Zend_Mail_Part_File implements Zend_Mail_Me * flags for this message * @var array */ - protected $_flags = array(); + protected $_flags = []; /** * Public constructor diff --git a/library/Zend/Mail/Part.php b/library/Zend/Mail/Part.php index ca881a791e..9d43776945 100644 --- a/library/Zend/Mail/Part.php +++ b/library/Zend/Mail/Part.php @@ -71,7 +71,7 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface * parts of multipart message * @var array */ - protected $_parts = array(); + protected $_parts = []; /** * count of parts of a multipart message @@ -286,7 +286,7 @@ protected function _cacheContent() $partClass = $this->getPartClass(); $counter = 1; foreach ($parts as $part) { - $this->_parts[$counter++] = new $partClass(array('headers' => $part['header'], 'content' => $part['body'])); + $this->_parts[$counter++] = new $partClass(['headers' => $part['header'], 'content' => $part['body']]); } } @@ -369,7 +369,7 @@ public function getHeaders() { if ($this->_headers === null) { if (!$this->_mail) { - $this->_headers = array(); + $this->_headers = []; } else { $part = $this->_mail->getRawHeader($this->_messageNum); Zend_Mime_Decode::splitMessage($part, $this->_headers, $null); diff --git a/library/Zend/Mail/Part/File.php b/library/Zend/Mail/Part/File.php index 8c1c99b41c..dab900da8b 100644 --- a/library/Zend/Mail/Part/File.php +++ b/library/Zend/Mail/Part/File.php @@ -39,8 +39,8 @@ */ class Zend_Mail_Part_File extends Zend_Mail_Part { - protected $_contentPos = array(); - protected $_partPos = array(); + protected $_contentPos = []; + protected $_partPos = []; protected $_fh; /** @@ -107,7 +107,7 @@ public function __construct(array $params) throw new Zend_Mail_Exception('no boundary found in content type to split message'); } - $part = array(); + $part = []; $pos = $this->_contentPos[0]; fseek($this->_fh, $pos); while (!feof($this->_fh) && ($endPos === null || $pos < $endPos)) { @@ -133,7 +133,7 @@ public function __construct(array $params) $part[1] = $lastPos; $this->_partPos[] = $part; } - $part = array($pos); + $part = [$pos]; } else if ($line == '--' . $boundary . '--') { $part[1] = $lastPos; $this->_partPos[] = $part; @@ -192,7 +192,7 @@ public function getPart($num) throw new Zend_Mail_Exception('part not found'); } - return new self(array('file' => $this->_fh, 'startPos' => $this->_partPos[$num][0], - 'endPos' => $this->_partPos[$num][1])); + return new self(['file' => $this->_fh, 'startPos' => $this->_partPos[$num][0], + 'endPos' => $this->_partPos[$num][1]]); } } diff --git a/library/Zend/Mail/Protocol/Abstract.php b/library/Zend/Mail/Protocol/Abstract.php index ef90b09688..21fc3c0de4 100644 --- a/library/Zend/Mail/Protocol/Abstract.php +++ b/library/Zend/Mail/Protocol/Abstract.php @@ -121,7 +121,7 @@ abstract class Zend_Mail_Protocol_Abstract * Log of mail requests and server responses for a session * @var array */ - private $_log = array(); + private $_log = []; /** @@ -231,7 +231,7 @@ public function getLog() */ public function resetLog() { - $this->_log = array(); + $this->_log = []; } /** @@ -401,14 +401,14 @@ protected function _receive($timeout = null) */ protected function _expect($code, $timeout = null) { - $this->_response = array(); + $this->_response = []; $cmd = ''; $more = ''; $msg = ''; $errMsg = ''; if (!is_array($code)) { - $code = array($code); + $code = [$code]; } do { diff --git a/library/Zend/Mail/Protocol/Imap.php b/library/Zend/Mail/Protocol/Imap.php index d4af4fe32b..cc3acce54e 100644 --- a/library/Zend/Mail/Protocol/Imap.php +++ b/library/Zend/Mail/Protocol/Imap.php @@ -182,8 +182,8 @@ protected function _nextTaggedLine(&$tag) */ protected function _decodeLine($line) { - $tokens = array(); - $stack = array(); + $tokens = []; + $stack = []; /* We start to decode the response here. The unterstood tokens are: @@ -205,7 +205,7 @@ protected function _decodeLine($line) $token = substr($line, 0, $pos); while ($token[0] == '(') { array_push($stack, $tokens); - $tokens = array(); + $tokens = []; $token = substr($token, 1); } if ($token[0] == '"') { @@ -280,7 +280,7 @@ protected function _decodeLine($line) * @return bool if returned tag matches wanted tag * @throws Zend_Mail_Protocol_Exception */ - public function readLine(&$tokens = array(), $wantedTag = '*', $dontParse = false) + public function readLine(&$tokens = [], $wantedTag = '*', $dontParse = false) { $line = $this->_nextTaggedLine($tag); if (!$dontParse) { @@ -306,14 +306,14 @@ public function readLine(&$tokens = array(), $wantedTag = '*', $dontParse = fals */ public function readResponse($tag, $dontParse = false) { - $lines = array(); + $lines = []; while (!$this->readLine($tokens, $tag, $dontParse)) { $lines[] = $tokens; } if ($dontParse) { // last to chars are still needed for response code - $tokens = array(substr($tokens, 0, 2)); + $tokens = [substr($tokens, 0, 2)]; } // last line has response code if ($tokens[0] == 'OK') { @@ -333,7 +333,7 @@ public function readResponse($tag, $dontParse = false) * @return null * @throws Zend_Mail_Protocol_Exception */ - public function sendRequest($command, $tokens = array(), &$tag = null) + public function sendRequest($command, $tokens = [], &$tag = null) { if (!$tag) { ++$this->_tagCount; @@ -382,7 +382,7 @@ public function sendRequest($command, $tokens = array(), &$tag = null) * @return mixed response as in readResponse() * @throws Zend_Mail_Protocol_Exception */ - public function requestAndResponse($command, $tokens = array(), $dontParse = false) + public function requestAndResponse($command, $tokens = [], $dontParse = false) { $this->sendRequest($command, $tokens, $tag); $response = $this->readResponse($tag, $dontParse); @@ -401,12 +401,12 @@ public function escapeString($string) { if (func_num_args() < 2) { if (strpos($string, "\n") !== false) { - return array('{' . strlen($string) . '}', $string); + return ['{' . strlen($string) . '}', $string]; } else { - return '"' . str_replace(array('\\', '"'), array('\\\\', '\\"'), $string) . '"'; + return '"' . str_replace(['\\', '"'], ['\\\\', '\\"'], $string) . '"'; } } - $result = array(); + $result = []; foreach (func_get_args() as $string) { $result[] = $this->escapeString($string); } @@ -421,7 +421,7 @@ public function escapeString($string) */ public function escapeList($list) { - $result = array(); + $result = []; foreach ($list as $k => $v) { if (!is_array($v)) { // $result[] = $this->escapeString($v); @@ -456,7 +456,7 @@ public function logout() $result = false; if ($this->_socket) { try { - $result = $this->requestAndResponse('LOGOUT', array(), true); + $result = $this->requestAndResponse('LOGOUT', [], true); } catch (Zend_Mail_Protocol_Exception $e) { // ignoring exception } @@ -481,7 +481,7 @@ public function capability() return $response; } - $capabilities = array(); + $capabilities = []; foreach ($response as $line) { $capabilities = array_merge($capabilities, $line); } @@ -500,9 +500,9 @@ public function capability() */ public function examineOrSelect($command = 'EXAMINE', $box = 'INBOX') { - $this->sendRequest($command, array($this->escapeString($box)), $tag); + $this->sendRequest($command, [$this->escapeString($box)], $tag); - $result = array(); + $result = []; while (!$this->readLine($tokens, $tag)) { if ($tokens[0] == 'FLAGS') { array_shift($tokens); @@ -581,9 +581,9 @@ public function fetch($items, $from, $to = null) $items = (array)$items; $itemList = $this->escapeList($items); - $this->sendRequest('FETCH', array($set, $itemList), $tag); + $this->sendRequest('FETCH', [$set, $itemList], $tag); - $result = array(); + $result = []; while (!$this->readLine($tokens, $tag)) { // ignore other responses if ($tokens[1] != 'FETCH') { @@ -610,7 +610,7 @@ public function fetch($items, $from, $to = null) } } } else { - $data = array(); + $data = []; while (key($tokens[2]) !== null) { $data[current($tokens[2])] = next($tokens[2]); next($tokens[2]); @@ -648,7 +648,7 @@ public function fetch($items, $from, $to = null) */ public function listMailbox($reference = '', $mailbox = '*') { - $result = array(); + $result = []; $list = $this->requestAndResponse('LIST', $this->escapeString($reference, $mailbox)); if (!$list || $list === true) { return $result; @@ -658,7 +658,7 @@ public function listMailbox($reference = '', $mailbox = '*') if (count($item) != 4 || $item[0] != 'LIST') { continue; } - $result[$item[3]] = array('delim' => $item[2], 'flags' => $item[1]); + $result[$item[3]] = ['delim' => $item[2], 'flags' => $item[1]]; } return $result; @@ -692,14 +692,14 @@ public function store(array $flags, $from, $to = null, $mode = null, $silent = t $set .= ':' . ($to == INF ? '*' : (int)$to); } - $result = $this->requestAndResponse('STORE', array($set, $item, $flags), $silent); + $result = $this->requestAndResponse('STORE', [$set, $item, $flags], $silent); if ($silent) { return $result ? true : false; } $tokens = $result; - $result = array(); + $result = []; foreach ($tokens as $token) { if ($token[1] != 'FETCH' || $token[2][0] != 'FLAGS') { continue; @@ -722,7 +722,7 @@ public function store(array $flags, $from, $to = null, $mode = null, $silent = t */ public function append($folder, $message, $flags = null, $date = null) { - $tokens = array(); + $tokens = []; $tokens[] = $this->escapeString($folder); if ($flags !== null) { $tokens[] = $this->escapeList($flags); @@ -751,7 +751,7 @@ public function copy($folder, $from, $to = null) $set .= ':' . ($to == INF ? '*' : (int)$to); } - return $this->requestAndResponse('COPY', array($set, $this->escapeString($folder)), true); + return $this->requestAndResponse('COPY', [$set, $this->escapeString($folder)], true); } /** @@ -762,7 +762,7 @@ public function copy($folder, $from, $to = null) */ public function create($folder) { - return $this->requestAndResponse('CREATE', array($this->escapeString($folder)), true); + return $this->requestAndResponse('CREATE', [$this->escapeString($folder)], true); } /** @@ -785,7 +785,7 @@ public function rename($old, $new) */ public function delete($folder) { - return $this->requestAndResponse('DELETE', array($this->escapeString($folder)), true); + return $this->requestAndResponse('DELETE', [$this->escapeString($folder)], true); } /** @@ -832,7 +832,7 @@ public function search(array $params) return $ids; } } - return array(); + return []; } } diff --git a/library/Zend/Mail/Protocol/Pop3.php b/library/Zend/Mail/Protocol/Pop3.php index 9a76228792..9d51a2fe94 100644 --- a/library/Zend/Mail/Protocol/Pop3.php +++ b/library/Zend/Mail/Protocol/Pop3.php @@ -318,7 +318,7 @@ public function getList($msgno = null) } $result = $this->request('LIST', true); - $messages = array(); + $messages = []; $line = strtok($result, "\n"); while ($line) { list($no, $size) = explode(' ', trim($line)); @@ -349,7 +349,7 @@ public function uniqueid($msgno = null) $result = $this->request('UIDL', true); $result = explode("\n", $result); - $messages = array(); + $messages = []; foreach ($result as $line) { if (!$line) { continue; diff --git a/library/Zend/Mail/Protocol/Smtp.php b/library/Zend/Mail/Protocol/Smtp.php index 9dd3568b25..db108a36af 100644 --- a/library/Zend/Mail/Protocol/Smtp.php +++ b/library/Zend/Mail/Protocol/Smtp.php @@ -120,7 +120,7 @@ class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract * @return void * @throws Zend_Mail_Protocol_Exception */ - public function __construct($host = '127.0.0.1', $port = null, array $config = array()) + public function __construct($host = '127.0.0.1', $port = null, array $config = []) { if (isset($config['ssl'])) { switch (strtolower($config['ssl'])) { @@ -286,7 +286,7 @@ public function rcpt($to) // Set rcpt to true, as per 4.1.1.3 of RFC 2821 $this->_send('RCPT TO:<' . $to . '>'); - $this->_expect(array(250, 251), 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + $this->_expect([250, 251], 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 $this->_rcpt = true; } @@ -337,7 +337,7 @@ public function rset() { $this->_send('RSET'); // MS ESMTP doesn't follow RFC, see [ZF-1377] - $this->_expect(array(250, 220)); + $this->_expect([250, 220]); $this->_mail = false; $this->_rcpt = false; @@ -370,7 +370,7 @@ public function noop() public function vrfy($user) { $this->_send('VRFY ' . $user); - $this->_expect(array(250, 251, 252), 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 + $this->_expect([250, 251, 252], 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2 } diff --git a/library/Zend/Mail/Storage/Abstract.php b/library/Zend/Mail/Storage/Abstract.php index beb8fb6fb7..ecf18d16ea 100644 --- a/library/Zend/Mail/Storage/Abstract.php +++ b/library/Zend/Mail/Storage/Abstract.php @@ -34,12 +34,12 @@ abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, See * class capabilities with default values * @var array */ - protected $_has = array('uniqueid' => true, + protected $_has = ['uniqueid' => true, 'delete' => false, 'create' => false, 'top' => false, 'fetchPart' => true, - 'flags' => false); + 'flags' => false]; /** * current iteration position diff --git a/library/Zend/Mail/Storage/Folder.php b/library/Zend/Mail/Storage/Folder.php index 191dbca203..f3cf4cea30 100644 --- a/library/Zend/Mail/Storage/Folder.php +++ b/library/Zend/Mail/Storage/Folder.php @@ -62,7 +62,7 @@ class Zend_Mail_Storage_Folder implements RecursiveIterator * @param bool $selectable if true folder holds messages, if false it's just a parent for subfolders * @param array $folders init with given instances of Zend_Mail_Storage_Folder as subfolders */ - public function __construct($localName, $globalName = '', $selectable = true, array $folders = array()) + public function __construct($localName, $globalName = '', $selectable = true, array $folders = []) { $this->_localName = $localName; $this->_globalName = $globalName ? $globalName : $localName; diff --git a/library/Zend/Mail/Storage/Folder/Maildir.php b/library/Zend/Mail/Storage/Folder/Maildir.php index e3b7c34698..1a5206df5e 100644 --- a/library/Zend/Mail/Storage/Folder/Maildir.php +++ b/library/Zend/Mail/Storage/Folder/Maildir.php @@ -126,7 +126,7 @@ protected function _buildFolderTree() require_once 'Zend/Mail/Storage/Exception.php'; throw new Zend_Mail_Storage_Exception("can't read folders in maildir"); } - $dirs = array(); + $dirs = []; while (($entry = readdir($dh)) !== false) { // maildir++ defines folders must start with . if ($entry[0] != '.' || $entry == '.' || $entry == '..') { @@ -139,8 +139,8 @@ protected function _buildFolderTree() closedir($dh); sort($dirs); - $stack = array(null); - $folderStack = array(null); + $stack = [null]; + $folderStack = [null]; $parentFolder = $this->_rootFolder; $parent = '.'; diff --git a/library/Zend/Mail/Storage/Folder/Mbox.php b/library/Zend/Mail/Storage/Folder/Mbox.php index ad9429dc33..9baff8ccc0 100644 --- a/library/Zend/Mail/Storage/Folder/Mbox.php +++ b/library/Zend/Mail/Storage/Folder/Mbox.php @@ -246,7 +246,7 @@ public function getCurrentFolder() */ public function __sleep() { - return array_merge(parent::__sleep(), array('_currentFolder', '_rootFolder', '_rootdir')); + return array_merge(parent::__sleep(), ['_currentFolder', '_rootFolder', '_rootdir']); } /** diff --git a/library/Zend/Mail/Storage/Imap.php b/library/Zend/Mail/Storage/Imap.php index 422ce53e73..8eb953c776 100644 --- a/library/Zend/Mail/Storage/Imap.php +++ b/library/Zend/Mail/Storage/Imap.php @@ -85,25 +85,25 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract * imap flags to constants translation * @var array */ - protected static $_knownFlags = array('\Passed' => Zend_Mail_Storage::FLAG_PASSED, + protected static $_knownFlags = ['\Passed' => Zend_Mail_Storage::FLAG_PASSED, '\Answered' => Zend_Mail_Storage::FLAG_ANSWERED, '\Seen' => Zend_Mail_Storage::FLAG_SEEN, '\Unseen' => Zend_Mail_Storage::FLAG_UNSEEN, '\Deleted' => Zend_Mail_Storage::FLAG_DELETED, '\Draft' => Zend_Mail_Storage::FLAG_DRAFT, - '\Flagged' => Zend_Mail_Storage::FLAG_FLAGGED); + '\Flagged' => Zend_Mail_Storage::FLAG_FLAGGED]; /** * map flags to search criterias * @var array */ - protected static $_searchFlags = array('\Recent' => 'RECENT', + protected static $_searchFlags = ['\Recent' => 'RECENT', '\Answered' => 'ANSWERED', '\Seen' => 'SEEN', '\Unseen' => 'UNSEEN', '\Deleted' => 'DELETED', '\Draft' => 'DRAFT', - '\Flagged' => 'FLAGGED'); + '\Flagged' => 'FLAGGED']; /** * Count messages all messages in current box @@ -123,10 +123,10 @@ public function countMessages($flags = null) } if ($flags === null) { - return count($this->_protocol->search(array('ALL'))); + return count($this->_protocol->search(['ALL'])); } - $params = array(); + $params = []; foreach ((array)$flags as $flag) { if (isset(self::$_searchFlags[$flag])) { $params[] = self::$_searchFlags[$flag]; @@ -162,15 +162,15 @@ public function getSize($id = 0) */ public function getMessage($id) { - $data = $this->_protocol->fetch(array('FLAGS', 'RFC822.HEADER'), $id); + $data = $this->_protocol->fetch(['FLAGS', 'RFC822.HEADER'], $id); $header = $data['RFC822.HEADER']; - $flags = array(); + $flags = []; foreach ($data['FLAGS'] as $flag) { $flags[] = isset(self::$_knownFlags[$flag]) ? self::$_knownFlags[$flag] : $flag; } - return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $header, 'flags' => $flags)); + return new $this->_messageClass(['handler' => $this, 'id' => $id, 'headers' => $header, 'flags' => $flags]); } /* @@ -323,7 +323,7 @@ public function noop() */ public function removeMessage($id) { - if (!$this->_protocol->store(array(Zend_Mail_Storage::FLAG_DELETED), $id, null, '+')) { + if (!$this->_protocol->store([Zend_Mail_Storage::FLAG_DELETED], $id, null, '+')) { /** * @see Zend_Mail_Storage_Exception */ @@ -407,8 +407,8 @@ public function getFolders($rootFolder = null) ksort($folders, SORT_STRING); $root = new Zend_Mail_Storage_Folder('/', '/', false); - $stack = array(null); - $folderStack = array(null); + $stack = [null]; + $folderStack = [null]; $parentFolder = $root; $parent = ''; @@ -576,7 +576,7 @@ public function appendMessage($message, $folder = null, $flags = null) } if ($flags === null) { - $flags = array(Zend_Mail_Storage::FLAG_SEEN); + $flags = [Zend_Mail_Storage::FLAG_SEEN]; } // TODO: handle class instances for $message diff --git a/library/Zend/Mail/Storage/Maildir.php b/library/Zend/Mail/Storage/Maildir.php index 76708e8564..32027fa80b 100644 --- a/library/Zend/Mail/Storage/Maildir.php +++ b/library/Zend/Mail/Storage/Maildir.php @@ -56,7 +56,7 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract * data of found message files in maildir dir * @var array */ - protected $_files = array(); + protected $_files = []; /** * known flag chars in filenames @@ -65,12 +65,12 @@ class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract * * @var array */ - protected static $_knownFlags = array('D' => Zend_Mail_Storage::FLAG_DRAFT, + protected static $_knownFlags = ['D' => Zend_Mail_Storage::FLAG_DRAFT, 'F' => Zend_Mail_Storage::FLAG_FLAGGED, 'P' => Zend_Mail_Storage::FLAG_PASSED, 'R' => Zend_Mail_Storage::FLAG_ANSWERED, 'S' => Zend_Mail_Storage::FLAG_SEEN, - 'T' => Zend_Mail_Storage::FLAG_DELETED); + 'T' => Zend_Mail_Storage::FLAG_DELETED]; // TODO: getFlags($id) for fast access if headers are not needed (i.e. just setting flags)? @@ -155,7 +155,7 @@ public function getSize($id = null) return isset($filedata['size']) ? $filedata['size'] : filesize($filedata['filename']); } - $result = array(); + $result = []; foreach ($this->_files as $num => $data) { $result[$num + 1] = isset($data['size']) ? $data['size'] : filesize($data['filename']); } @@ -176,12 +176,12 @@ public function getMessage($id) { // TODO that's ugly, would be better to let the message class decide if (strtolower($this->_messageClass) == 'zend_mail_message_file' || is_subclass_of($this->_messageClass, 'zend_mail_message_file')) { - return new $this->_messageClass(array('file' => $this->_getFileData($id, 'filename'), - 'flags' => $this->_getFileData($id, 'flags'))); + return new $this->_messageClass(['file' => $this->_getFileData($id, 'filename'), + 'flags' => $this->_getFileData($id, 'flags')]); } - return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $this->getRawHeader($id), - 'flags' => $this->_getFileData($id, 'flags'))); + return new $this->_messageClass(['handler' => $this, 'id' => $id, 'headers' => $this->getRawHeader($id), + 'flags' => $this->_getFileData($id, 'flags')]); } /* @@ -330,7 +330,7 @@ protected function _openMaildir($dirname) $dh = @opendir($dirname . '/new/'); if ($dh) { - $this->_getMaildirFiles($dh, $dirname . '/new/', array(Zend_Mail_Storage::FLAG_RECENT)); + $this->_getMaildirFiles($dh, $dirname . '/new/', [Zend_Mail_Storage::FLAG_RECENT]); closedir($dh); } else if (file_exists($dirname . '/new/')) { /** @@ -349,7 +349,7 @@ protected function _openMaildir($dirname) * @param array $default_flags default flags for given dir * @return null */ - protected function _getMaildirFiles($dh, $dirname, $default_flags = array()) + protected function _getMaildirFiles($dh, $dirname, $default_flags = []) { while (($entry = readdir($dh)) !== false) { if ($entry[0] == '.' || !is_file($dirname . $entry)) { @@ -376,10 +376,10 @@ protected function _getMaildirFiles($dh, $dirname, $default_flags = array()) $named_flags[$flag] = isset(self::$_knownFlags[$flag]) ? self::$_knownFlags[$flag] : $flag; } - $data = array('uniq' => $uniq, + $data = ['uniq' => $uniq, 'flags' => $named_flags, 'flaglookup' => array_flip($named_flags), - 'filename' => $dirname . $entry); + 'filename' => $dirname . $entry]; if ($size !== null) { $data['size'] = (int)$size; } @@ -396,7 +396,7 @@ protected function _getMaildirFiles($dh, $dirname, $default_flags = array()) */ public function close() { - $this->_files = array(); + $this->_files = []; } @@ -441,7 +441,7 @@ public function getUniqueId($id = null) return $this->_getFileData($id, 'uniq'); } - $ids = array(); + $ids = []; foreach ($this->_files as $num => $file) { $ids[$num + 1] = $file['uniq']; } diff --git a/library/Zend/Mail/Storage/Mbox.php b/library/Zend/Mail/Storage/Mbox.php index ddcc0fca68..d28a917ec0 100644 --- a/library/Zend/Mail/Storage/Mbox.php +++ b/library/Zend/Mail/Storage/Mbox.php @@ -102,7 +102,7 @@ public function getSize($id = 0) return $pos['end'] - $pos['start']; } - $result = array(); + $result = []; foreach ($this->_positions as $num => $pos) { $result[$num + 1] = $pos['end'] - $pos['start']; } @@ -145,8 +145,8 @@ public function getMessage($id) if (strtolower($this->_messageClass) == 'zend_mail_message_file' || is_subclass_of($this->_messageClass, 'zend_mail_message_file')) { // TODO top/body lines $messagePos = $this->_getPos($id); - return new $this->_messageClass(array('file' => $this->_fh, 'startPos' => $messagePos['start'], - 'endPos' => $messagePos['end'])); + return new $this->_messageClass(['file' => $this->_fh, 'startPos' => $messagePos['start'], + 'endPos' => $messagePos['end']]); } $bodyLines = 0; // TODO: need a way to change that @@ -160,7 +160,7 @@ public function getMessage($id) } } - return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $message)); + return new $this->_messageClass(['handler' => $this, 'id' => $id, 'headers' => $message]); } /* @@ -305,7 +305,7 @@ protected function _openMboxFile($filename) throw new Zend_Mail_Storage_Exception('file is not a valid mbox format'); } - $messagePos = array('start' => ftell($this->_fh), 'separator' => 0, 'end' => 0); + $messagePos = ['start' => ftell($this->_fh), 'separator' => 0, 'end' => 0]; while (($line = fgets($this->_fh)) !== false) { if (strpos($line, 'From ') === 0) { $messagePos['end'] = ftell($this->_fh) - strlen($line) - 2; // + newline @@ -313,7 +313,7 @@ protected function _openMboxFile($filename) $messagePos['separator'] = $messagePos['end']; } $this->_positions[] = $messagePos; - $messagePos = array('start' => ftell($this->_fh), 'separator' => 0, 'end' => 0); + $messagePos = ['start' => ftell($this->_fh), 'separator' => 0, 'end' => 0]; } if (!$messagePos['separator'] && !trim($line)) { $messagePos['separator'] = ftell($this->_fh); @@ -336,7 +336,7 @@ protected function _openMboxFile($filename) public function close() { @fclose($this->_fh); - $this->_positions = array(); + $this->_positions = []; } @@ -415,7 +415,7 @@ public function getNumberByUniqueId($id) */ public function __sleep() { - return array('_filename', '_positions', '_filemtime'); + return ['_filename', '_positions', '_filemtime']; } /** diff --git a/library/Zend/Mail/Storage/Pop3.php b/library/Zend/Mail/Storage/Pop3.php index 234b546c4b..5cad96056d 100644 --- a/library/Zend/Mail/Storage/Pop3.php +++ b/library/Zend/Mail/Storage/Pop3.php @@ -91,8 +91,8 @@ public function getMessage($id) $bodyLines = 0; $message = $this->_protocol->top($id, $bodyLines, true); - return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $message, - 'noToplines' => $bodyLines < 1)); + return new $this->_messageClass(['handler' => $this, 'id' => $id, 'headers' => $message, + 'noToplines' => $bodyLines < 1]); } /* @@ -244,7 +244,7 @@ public function getUniqueId($id = null) } $count = $this->countMessages(); if ($count < 1) { - return array(); + return []; } $range = range(1, $count); return array_combine($range, $range); diff --git a/library/Zend/Mail/Storage/Writable/Maildir.php b/library/Zend/Mail/Storage/Writable/Maildir.php index 2c3ec53ddf..cdc5a0ca4a 100644 --- a/library/Zend/Mail/Storage/Writable/Maildir.php +++ b/library/Zend/Mail/Storage/Writable/Maildir.php @@ -86,7 +86,7 @@ public static function initMaildir($dir) } } - foreach (array('cur', 'tmp', 'new') as $subdir) { + foreach (['cur', 'tmp', 'new'] as $subdir) { if (!@mkdir($dir . DIRECTORY_SEPARATOR . $subdir)) { // ignore if dir exists (i.e. was already valid maildir or two processes try to create one) if (!file_exists($dir . DIRECTORY_SEPARATOR . $subdir)) { @@ -261,7 +261,7 @@ public function removeFolder($name) throw new Zend_Mail_Storage_Exception('wont delete selected folder'); } - foreach (array('tmp', 'new', 'cur', '.') as $subdir) { + foreach (['tmp', 'new', 'cur', '.'] as $subdir) { $dir = $this->_rootdir . '.' . $name . DIRECTORY_SEPARATOR . $subdir; if (!file_exists($dir)) { continue; @@ -377,7 +377,7 @@ public function renameFolder($oldName, $newName) } $olddir = $this->_rootdir . '.' . $folder; - foreach (array('tmp', 'new', 'cur') as $subdir) { + foreach (['tmp', 'new', 'cur'] as $subdir) { $subdir = DIRECTORY_SEPARATOR . $subdir; if (!file_exists($olddir . $subdir)) { continue; @@ -481,8 +481,8 @@ protected function _createTmpFile($folder = 'INBOX') . ' - giving up'); } - return array('dirname' => $this->_rootdir . '.' . $folder, 'uniq' => $uniq, 'filename' => $tmpdir . $uniq, - 'handle' => $fh); + return ['dirname' => $this->_rootdir . '.' . $folder, 'uniq' => $uniq, 'filename' => $tmpdir . $uniq, + 'handle' => $fh]; } /** @@ -505,7 +505,7 @@ protected function _getInfoString(&$flags) } $info = ':2,'; - $flags = array(); + $flags = []; foreach (Zend_Mail_Storage_Maildir::$_knownFlags as $char => $flag) { if (!isset($wanted_flags[$flag])) { continue; @@ -558,7 +558,7 @@ public function appendMessage($message, $folder = null, $flags = null, $recent = } if ($flags === null) { - $flags = array(Zend_Mail_Storage::FLAG_SEEN); + $flags = [Zend_Mail_Storage::FLAG_SEEN]; } $info = $this->_getInfoString($flags); $temp_file = $this->_createTmpFile($folder->getGlobalName()); @@ -596,9 +596,9 @@ public function appendMessage($message, $folder = null, $flags = null, $recent = throw $exception; } - $this->_files[] = array('uniq' => $temp_file['uniq'], + $this->_files[] = ['uniq' => $temp_file['uniq'], 'flags' => $flags, - 'filename' => $new_filename); + 'filename' => $new_filename]; if ($this->_quota) { $this->_addQuotaEntry((int)$size, 1); } @@ -673,9 +673,9 @@ public function copyMessage($id, $folder) if ($folder->getGlobalName() == $this->_currentFolder || ($this->_currentFolder == 'INBOX' && $folder->getGlobalName() == '/')) { - $this->_files[] = array('uniq' => $temp_file['uniq'], + $this->_files[] = ['uniq' => $temp_file['uniq'], 'flags' => $flags, - 'filename' => $new_file); + 'filename' => $new_file]; } if ($this->_quota) { @@ -845,7 +845,7 @@ public function getQuota($fromStorage = false) { $definition = fgets($fh); fclose($fh); $definition = explode(',', trim($definition)); - $quota = array(); + $quota = []; foreach ($definition as $member) { $key = $member[strlen($member) - 1]; if ($key == 'S' || $key == 'C') { @@ -863,7 +863,7 @@ public function getQuota($fromStorage = false) { * @see http://www.inter7.com/courierimap/README.maildirquota.html "Calculating maildirsize" */ protected function _calculateMaildirsize() { - $timestamps = array(); + $timestamps = []; $messages = 0; $total_size = 0; @@ -889,7 +889,7 @@ protected function _calculateMaildirsize() { continue; } - foreach (array('cur', 'new') as $subsubdir) { + foreach (['cur', 'new'] as $subsubdir) { $dirname = $this->_rootdir . $subdir . DIRECTORY_SEPARATOR . $subsubdir . DIRECTORY_SEPARATOR; if (!file_exists($dirname)) { continue; @@ -933,7 +933,7 @@ protected function _calculateMaildirsize() { $tmp = $this->_createTmpFile(); $fh = $tmp['handle']; - $definition = array(); + $definition = []; foreach ($quota as $type => $value) { if ($type == 'size' || $type == 'count') { $type = $type == 'count' ? 'C' : 'S'; @@ -952,7 +952,7 @@ protected function _calculateMaildirsize() { } } - return array('size' => $total_size, 'count' => $messages, 'quota' => $quota); + return ['size' => $total_size, 'count' => $messages, 'quota' => $quota]; } /** @@ -985,7 +985,7 @@ protected function _calculateQuota($forceRecalc = false) { $quota = $this->_quota; } else { $definition = explode(',', $maildirsize[0]); - $quota = array(); + $quota = []; foreach ($definition as $member) { $key = $member[strlen($member) - 1]; if ($key == 'S' || $key == 'C') { @@ -1024,7 +1024,7 @@ protected function _calculateQuota($forceRecalc = false) { fclose($fh); } - return array('size' => $total_size, 'count' => $messages, 'quota' => $quota, 'over_quota' => $over_quota); + return ['size' => $total_size, 'count' => $messages, 'quota' => $quota, 'over_quota' => $over_quota]; } protected function _addQuotaEntry($size, $count = 1) { diff --git a/library/Zend/Mail/Transport/Abstract.php b/library/Zend/Mail/Transport/Abstract.php index f5eb181ff4..8894c9ceb8 100644 --- a/library/Zend/Mail/Transport/Abstract.php +++ b/library/Zend/Mail/Transport/Abstract.php @@ -65,7 +65,7 @@ abstract class Zend_Mail_Transport_Abstract * @var array * @access protected */ - protected $_headers = array(); + protected $_headers = []; /** * Message is a multipart message @@ -86,7 +86,7 @@ abstract class Zend_Mail_Transport_Abstract * @var array * @access protected */ - protected $_parts = array(); + protected $_parts = []; /** * Recipients string @@ -139,15 +139,15 @@ protected function _getHeaders($boundary) } } - $this->_headers['Content-Type'] = array( + $this->_headers['Content-Type'] = [ $type . ';' . $this->EOL . " " . 'boundary="' . $boundary . '"' - ); + ]; $this->boundary = $boundary; } - $this->_headers['MIME-Version'] = array('1.0'); + $this->_headers['MIME-Version'] = ['1.0']; return $this->_headers; } @@ -196,7 +196,7 @@ protected function _prepareHeaders($headers) $value = implode(',' . $this->EOL . ' ', $content); $this->header .= $header . ': ' . $value . $this->EOL; } else { - array_walk($content, array(get_class($this), '_formatHeader'), $header); + array_walk($content, [get_class($this), '_formatHeader'], $header); $this->header .= implode($this->EOL, $content) . $this->EOL; } } @@ -290,7 +290,7 @@ protected function _buildBody() foreach ($headers as $header) { // Headers in Zend_Mime_Part are kept as arrays with two elements, a // key and a value - $this->_headers[$header[0]] = array($header[1]); + $this->_headers[$header[0]] = [$header[1]]; } } diff --git a/library/Zend/Mail/Transport/File.php b/library/Zend/Mail/Transport/File.php index 2ca97627ad..74cd6132a6 100644 --- a/library/Zend/Mail/Transport/File.php +++ b/library/Zend/Mail/Transport/File.php @@ -64,7 +64,7 @@ public function __construct($options = null) if ($options instanceof Zend_Config) { $options = $options->toArray(); } elseif (!is_array($options)) { - $options = array(); + $options = []; } // Making sure we have some defaults to work with @@ -72,7 +72,7 @@ public function __construct($options = null) $options['path'] = sys_get_temp_dir(); } if (!isset($options['callback'])) { - $options['callback'] = array($this, 'defaultCallback'); + $options['callback'] = [$this, 'defaultCallback']; } $this->setOptions($options); diff --git a/library/Zend/Mail/Transport/Sendmail.php b/library/Zend/Mail/Transport/Sendmail.php index 28bf3b9813..da519a88a9 100644 --- a/library/Zend/Mail/Transport/Sendmail.php +++ b/library/Zend/Mail/Transport/Sendmail.php @@ -98,7 +98,7 @@ public function __construct($parameters = null) public function _sendMail() { if ($this->parameters === null) { - set_error_handler(array($this, '_handleMailErrors')); + set_error_handler([$this, '_handleMailErrors']); $result = mail( $this->recipients, $this->_mail->getSubject(), @@ -119,7 +119,7 @@ public function _sendMail() ); } - set_error_handler(array($this, '_handleMailErrors')); + set_error_handler([$this, '_handleMailErrors']); $result = mail( $this->recipients, $this->_mail->getSubject(), diff --git a/library/Zend/Mail/Transport/Smtp.php b/library/Zend/Mail/Transport/Smtp.php index 2afe681eba..5d078f4f92 100644 --- a/library/Zend/Mail/Transport/Smtp.php +++ b/library/Zend/Mail/Transport/Smtp.php @@ -115,7 +115,7 @@ class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract * @todo Someone please make this compatible * with the SendMail transport class. */ - public function __construct($host = '127.0.0.1', Array $config = array()) + public function __construct($host = '127.0.0.1', Array $config = []) { if (isset($config['name'])) { $this->_name = $config['name']; diff --git a/library/Zend/Markup.php b/library/Zend/Markup.php index 3662f52a05..e4d1e23cbb 100644 --- a/library/Zend/Markup.php +++ b/library/Zend/Markup.php @@ -64,9 +64,9 @@ private function __construct() { } public static function getParserLoader() { if (!(self::$_parserLoader instanceof Zend_Loader_PluginLoader)) { - self::$_parserLoader = new Zend_Loader_PluginLoader(array( + self::$_parserLoader = new Zend_Loader_PluginLoader([ 'Zend_Markup_Parser' => 'Zend/Markup/Parser/', - )); + ]); } return self::$_parserLoader; @@ -80,9 +80,9 @@ public static function getParserLoader() public static function getRendererLoader() { if (!(self::$_rendererLoader instanceof Zend_Loader_PluginLoader)) { - self::$_rendererLoader = new Zend_Loader_PluginLoader(array( + self::$_rendererLoader = new Zend_Loader_PluginLoader([ 'Zend_Markup_Renderer' => 'Zend/Markup/Renderer/', - )); + ]); } return self::$_rendererLoader; @@ -120,7 +120,7 @@ public static function addRendererPath($prefix, $path) * @param array $options * @return Zend_Markup_Renderer_RendererAbstract */ - public static function factory($parser, $renderer = 'Html', array $options = array()) + public static function factory($parser, $renderer = 'Html', array $options = []) { $parserClass = self::getParserLoader()->load($parser); $rendererClass = self::getRendererLoader()->load($renderer); diff --git a/library/Zend/Markup/Parser/Bbcode.php b/library/Zend/Markup/Parser/Bbcode.php index f0d04cece5..f9ed1fb62e 100644 --- a/library/Zend/Markup/Parser/Bbcode.php +++ b/library/Zend/Markup/Parser/Bbcode.php @@ -105,39 +105,39 @@ class Zend_Markup_Parser_Bbcode implements Zend_Markup_Parser_ParserInterface * * @var array */ - protected $_searchedStoppers = array(); + protected $_searchedStoppers = []; /** * Tag information * * @var array */ - protected $_tags = array( - 'Zend_Markup_Root' => array( + protected $_tags = [ + 'Zend_Markup_Root' => [ 'type' => self::TYPE_DEFAULT, - 'stoppers' => array(), - ), - '*' => array( + 'stoppers' => [], + ], + '*' => [ 'type' => self::TYPE_DEFAULT, - 'stoppers' => array(self::NEWLINE, '[/*]', '[/]'), - ), - 'hr' => array( + 'stoppers' => [self::NEWLINE, '[/*]', '[/]'], + ], + 'hr' => [ 'type' => self::TYPE_SINGLE, - 'stoppers' => array(), - ), - 'code' => array( + 'stoppers' => [], + ], + 'code' => [ 'type' => self::TYPE_DEFAULT, - 'stoppers' => array('[/code]', '[/]'), + 'stoppers' => ['[/code]', '[/]'], 'parse_inside' => false - ) - ); + ] + ]; /** * Token array * * @var array */ - protected $_tokens = array(); + protected $_tokens = []; /** * State @@ -171,20 +171,20 @@ public function parse($value) throw new Zend_Markup_Parser_Exception('Value to parse cannot be left empty.'); } - $this->_value = str_replace(array("\r\n", "\r", "\n"), self::NEWLINE, $value); + $this->_value = str_replace(["\r\n", "\r", "\n"], self::NEWLINE, $value); // variable initialization for tokenizer $this->_valueLen = strlen($this->_value); $this->_pointer = 0; $this->_buffer = ''; - $this->_temp = array(); + $this->_temp = []; $this->_state = self::STATE_SCAN; - $this->_tokens = array(); + $this->_tokens = []; $this->_tokenize(); // variable initialization for treebuilder - $this->_searchedStoppers = array(); + $this->_searchedStoppers = []; $this->_tree = new Zend_Markup_TokenList(); $this->_current = new Zend_Markup_Token( '', @@ -213,7 +213,7 @@ protected function _tokenize() while ($this->_pointer < $this->_valueLen) { switch ($this->_state) { case self::STATE_SCAN: - $matches = array(); + $matches = []; $regex = '#\G(?[^\[]*)(?\[(?[' . self::NAME_CHARSET . ']+)?)?#'; preg_match($regex, $this->_value, $matches, null, $this->_pointer); @@ -232,11 +232,11 @@ protected function _tokenize() break; } - $this->_temp = array( + $this->_temp = [ 'tag' => '[' . $matches['name'], 'name' => $matches['name'], - 'attributes' => array() - ); + 'attributes' => [] + ]; if ($this->_pointer >= $this->_valueLen) { // damn, no tag @@ -255,7 +255,7 @@ protected function _tokenize() } break; case self::STATE_SCANATTRS: - $matches = array(); + $matches = []; $regex = '#\G((?\s*\])|\s+(?[' . self::NAME_CHARSET . ']+)(?=?))#'; if (!preg_match($regex, $this->_value, $matches, null, $this->_pointer)) { break 2; @@ -265,17 +265,17 @@ protected function _tokenize() if (!empty($matches['end'])) { if (!empty($this->_buffer)) { - $this->_tokens[] = array( + $this->_tokens[] = [ 'tag' => $this->_buffer, 'type' => Zend_Markup_Token::TYPE_NONE - ); + ]; $this->_buffer = ''; } $this->_temp['tag'] .= $matches['end']; $this->_temp['type'] = Zend_Markup_Token::TYPE_TAG; $this->_tokens[] = $this->_temp; - $this->_temp = array(); + $this->_temp = []; $this->_state = self::STATE_SCAN; } else { @@ -294,7 +294,7 @@ protected function _tokenize() } break; case self::STATE_PARSEVALUE: - $matches = array(); + $matches = []; $regex = '#\G((?"|\')(?.*?)\\2|(?[^\]\s]+))#'; if (!preg_match($regex, $this->_value, $matches, null, $this->_pointer)) { $this->_state = self::STATE_SCANATTRS; @@ -316,10 +316,10 @@ protected function _tokenize() } if (!empty($this->_buffer)) { - $this->_tokens[] = array( + $this->_tokens[] = [ 'tag' => $this->_buffer, 'type' => Zend_Markup_Token::TYPE_NONE - ); + ]; } } @@ -336,7 +336,7 @@ public function _createTree() // first we want to know if this tag is a stopper, or at least a searched one if ($this->_isStopper($token['tag'])) { // find the stopper - $oldItems = array(); + $oldItems = []; while (!in_array($token['tag'], $this->_tags[$this->_current->getName()]['stoppers'])) { $oldItems[] = clone $this->_current; @@ -365,7 +365,7 @@ public function _createTree() "\n", Zend_Markup_Token::TYPE_NONE, '', - array(), + [], $this->_current )); } elseif (isset($token['name']) && ($token['name'][0] == '/')) { @@ -374,7 +374,7 @@ public function _createTree() $token['tag'], Zend_Markup_Token::TYPE_NONE, '', - array(), + [], $this->_current )); } elseif (isset($this->_tags[$this->_current->getName()]['parse_inside']) @@ -384,7 +384,7 @@ public function _createTree() $token['tag'], Zend_Markup_Token::TYPE_NONE, '', - array(), + [], $this->_current )); } else { @@ -411,7 +411,7 @@ public function _createTree() $token['tag'], Zend_Markup_Token::TYPE_NONE, '', - array(), + [], $this->_current )); } @@ -429,13 +429,13 @@ public function _createTree() protected function _checkTagDeclaration($name) { if (!isset($this->_tags[$name])) { - $this->_tags[$name] = array( + $this->_tags[$name] = [ 'type' => self::TYPE_DEFAULT, - 'stoppers' => array( + 'stoppers' => [ '[/' . $name . ']', '[/]' - ) - ); + ] + ]; } } /** diff --git a/library/Zend/Markup/Renderer/Html.php b/library/Zend/Markup/Renderer/Html.php index 09eb456ea5..2433f8b0cb 100644 --- a/library/Zend/Markup/Renderer/Html.php +++ b/library/Zend/Markup/Renderer/Html.php @@ -54,14 +54,14 @@ class Zend_Markup_Renderer_Html extends Zend_Markup_Renderer_RendererAbstract * * @var array */ - protected $_groups = array( - 'block' => array('block', 'inline', 'block-empty', 'inline-empty', 'list'), - 'inline' => array('inline', 'inline-empty'), - 'list' => array('list-item'), - 'list-item' => array('inline', 'inline-empty', 'list'), - 'block-empty' => array(), - 'inline-empty' => array(), - ); + protected $_groups = [ + 'block' => ['block', 'inline', 'block-empty', 'inline-empty', 'list'], + 'inline' => ['inline', 'inline-empty'], + 'list' => ['list-item'], + 'list-item' => ['inline', 'inline-empty', 'list'], + 'block-empty' => [], + 'inline-empty' => [], + ]; /** * The current group @@ -75,13 +75,13 @@ class Zend_Markup_Renderer_Html extends Zend_Markup_Renderer_RendererAbstract * * @var array */ - protected static $_defaultAttributes = array( + protected static $_defaultAttributes = [ 'id' => '', 'class' => '', 'style' => '', 'lang' => '', 'title' => '' - ); + ]; /** @@ -91,15 +91,15 @@ class Zend_Markup_Renderer_Html extends Zend_Markup_Renderer_RendererAbstract * * @return void */ - public function __construct($options = array()) + public function __construct($options = []) { if ($options instanceof Zend_Config) { $options = $options->toArray(); } - $this->_pluginLoader = new Zend_Loader_PluginLoader(array( + $this->_pluginLoader = new Zend_Loader_PluginLoader([ 'Zend_Markup_Renderer_Html' => 'Zend/Markup/Renderer/Html/' - )); + ]); if (!isset($options['useDefaultMarkups']) && isset($options['useDefaultTags'])) { $options['useDefaultMarkups'] = $options['useDefaultTags']; @@ -120,233 +120,233 @@ public function __construct($options = array()) */ protected function _defineDefaultMarkups() { - $this->_markups = array( - 'b' => array( + $this->_markups = [ + 'b' => [ 'type' => 10, // self::TYPE_REPLACE | self::TAG_NORMAL 'tag' => 'strong', 'group' => 'inline', 'filter' => true, - ), - 'u' => array( + ], + 'u' => [ 'type' => 10, 'tag' => 'span', - 'attributes' => array( + 'attributes' => [ 'style' => 'text-decoration: underline;', - ), + ], 'group' => 'inline', 'filter' => true, - ), - 'i' => array( + ], + 'i' => [ 'type' => 10, 'tag' => 'em', 'group' => 'inline', 'filter' => true, - ), - 'cite' => array( + ], + 'cite' => [ 'type' => 10, 'tag' => 'cite', 'group' => 'inline', 'filter' => true, - ), - 'del' => array( + ], + 'del' => [ 'type' => 10, 'tag' => 'del', 'group' => 'inline', 'filter' => true, - ), - 'ins' => array( + ], + 'ins' => [ 'type' => 10, 'tag' => 'ins', 'group' => 'inline', 'filter' => true, - ), - 'sub' => array( + ], + 'sub' => [ 'type' => 10, 'tag' => 'sub', 'group' => 'inline', 'filter' => true, - ), - 'sup' => array( + ], + 'sup' => [ 'type' => 10, 'tag' => 'sup', 'group' => 'inline', 'filter' => true, - ), - 'span' => array( + ], + 'span' => [ 'type' => 10, 'tag' => 'span', 'group' => 'inline', 'filter' => true, - ), - 'acronym' => array( + ], + 'acronym' => [ 'type' => 10, 'tag' => 'acronym', 'group' => 'inline', 'filter' => true, - ), + ], // headings - 'h1' => array( + 'h1' => [ 'type' => 10, 'tag' => 'h1', 'group' => 'inline', 'filter' => true, - ), - 'h2' => array( + ], + 'h2' => [ 'type' => 10, 'tag' => 'h2', 'group' => 'inline', 'filter' => true, - ), - 'h3' => array( + ], + 'h3' => [ 'type' => 10, 'tag' => 'h3', 'group' => 'inline', 'filter' => true, - ), - 'h4' => array( + ], + 'h4' => [ 'type' => 10, 'tag' => 'h4', 'group' => 'inline', 'filter' => true, - ), - 'h5' => array( + ], + 'h5' => [ 'type' => 10, 'tag' => 'h5', 'group' => 'inline', 'filter' => true, - ), - 'h6' => array( + ], + 'h6' => [ 'type' => 10, 'tag' => 'h6', 'group' => 'inline', 'filter' => true, - ), + ], // callback tags - 'url' => array( + 'url' => [ 'type' => 6, // self::TYPE_CALLBACK | self::TAG_NORMAL 'callback' => null, 'group' => 'inline', 'filter' => true, - ), - 'img' => array( + ], + 'img' => [ 'type' => 6, 'callback' => null, 'group' => 'inline-empty', 'filter' => true, - ), - 'code' => array( + ], + 'code' => [ 'type' => 6, 'callback' => null, 'group' => 'block-empty', 'filter' => false, - ), - 'p' => array( + ], + 'p' => [ 'type' => 10, 'tag' => 'p', 'group' => 'block', 'filter' => true, - ), - 'ignore' => array( + ], + 'ignore' => [ 'type' => 10, 'start' => '', 'end' => '', 'group' => 'block-empty', 'filter' => true, - ), - 'quote' => array( + ], + 'quote' => [ 'type' => 10, 'tag' => 'blockquote', 'group' => 'block', 'filter' => true, - ), - 'list' => array( + ], + 'list' => [ 'type' => 6, 'callback' => null, 'group' => 'list', 'filter' => new Zend_Filter_PregReplace('/.*/is', ''), - ), - '*' => array( + ], + '*' => [ 'type' => 10, 'tag' => 'li', 'group' => 'list-item', 'filter' => true, - ), - 'hr' => array( + ], + 'hr' => [ 'type' => 9, // self::TYPE_REPLACE | self::TAG_SINGLE 'tag' => 'hr', 'group' => 'block', 'empty' => true, - ), + ], // aliases - 'bold' => array( + 'bold' => [ 'type' => 16, 'name' => 'b', - ), - 'strong' => array( + ], + 'strong' => [ 'type' => 16, 'name' => 'b', - ), - 'italic' => array( + ], + 'italic' => [ 'type' => 16, 'name' => 'i', - ), - 'em' => array( + ], + 'em' => [ 'type' => 16, 'name' => 'i', - ), - 'emphasized' => array( + ], + 'emphasized' => [ 'type' => 16, 'name' => 'i', - ), - 'underline' => array( + ], + 'underline' => [ 'type' => 16, 'name' => 'u', - ), - 'citation' => array( + ], + 'citation' => [ 'type' => 16, 'name' => 'cite', - ), - 'deleted' => array( + ], + 'deleted' => [ 'type' => 16, 'name' => 'del', - ), - 'insert' => array( + ], + 'insert' => [ 'type' => 16, 'name' => 'ins', - ), - 'strike' => array( + ], + 'strike' => [ 'type' => 16, 'name' => 's', - ), - 's' => array( + ], + 's' => [ 'type' => 16, 'name' => 'del', - ), - 'subscript' => array( + ], + 'subscript' => [ 'type' => 16, 'name' => 'sub', - ), - 'superscript' => array( + ], + 'superscript' => [ 'type' => 16, 'name' => 'sup', - ), - 'a' => array( + ], + 'a' => [ 'type' => 16, 'name' => 'url', - ), - 'image' => array( + ], + 'image' => [ 'type' => 16, 'name' => 'img', - ), - 'li' => array( + ], + 'li' => [ 'type' => 16, 'name' => '*', - ), - 'color' => array( + ], + 'color' => [ 'type' => 16, 'name' => 'span', - ), - ); + ], + ]; } /** @@ -358,7 +358,7 @@ public function addDefaultFilters() { $this->_defaultFilter = new Zend_Filter(); - $this->_defaultFilter->addFilter(new Zend_Filter_HtmlEntities(array('encoding' => self::getEncoding()))); + $this->_defaultFilter->addFilter(new Zend_Filter_HtmlEntities(['encoding' => self::getEncoding()])); $this->_defaultFilter->addFilter(new Zend_Filter_Callback('nl2br')); } @@ -373,7 +373,7 @@ protected function _executeReplace(Zend_Markup_Token $token, $markup) { if (isset($markup['tag'])) { if (!isset($markup['attributes'])) { - $markup['attributes'] = array(); + $markup['attributes'] = []; } $attrs = self::renderAttributes($token, $markup['attributes']); return "<{$markup['tag']}{$attrs}>{$this->_render($token)}"; @@ -393,7 +393,7 @@ protected function _executeSingleReplace(Zend_Markup_Token $token, $markup) { if (isset($markup['tag'])) { if (!isset($markup['attributes'])) { - $markup['attributes'] = array(); + $markup['attributes'] = []; } $attrs = self::renderAttributes($token, $markup['attributes']); return "<{$markup['tag']}{$attrs} />"; @@ -408,7 +408,7 @@ protected function _executeSingleReplace(Zend_Markup_Token $token, $markup) * @param array $attributes * @return string */ - public static function renderAttributes(Zend_Markup_Token $token, array $attributes = array()) + public static function renderAttributes(Zend_Markup_Token $token, array $attributes = []) { $attributes = array_merge(self::$_defaultAttributes, $attributes); @@ -469,11 +469,11 @@ public static function checkColor($color) * aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, * purple, red, silver, teal, white, and yellow. */ - $colors = array( + $colors = [ 'aqua', 'black', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red', 'silver', 'teal', 'white', 'yellow' - ); + ]; if (in_array($color, $colors)) { return true; diff --git a/library/Zend/Markup/Renderer/RendererAbstract.php b/library/Zend/Markup/Renderer/RendererAbstract.php index 5226f797f1..29fc7a91d2 100644 --- a/library/Zend/Markup/Renderer/RendererAbstract.php +++ b/library/Zend/Markup/Renderer/RendererAbstract.php @@ -53,7 +53,7 @@ abstract class Zend_Markup_Renderer_RendererAbstract * * @var array */ - protected $_markups = array(); + protected $_markups = []; /** * Parser @@ -88,7 +88,7 @@ abstract class Zend_Markup_Renderer_RendererAbstract * * @var array */ - protected $_groups = array(); + protected $_groups = []; /** * Plugin loader for tags @@ -119,7 +119,7 @@ abstract class Zend_Markup_Renderer_RendererAbstract * * @return void */ - public function __construct($options = array()) + public function __construct($options = []) { if ($options instanceof Zend_Config) { $options = $options->toArray(); @@ -249,10 +249,10 @@ public function addMarkup($name, $type, array $options) 'No alias was provided but tag was defined as such'); } - $this->_markups[$name] = array( + $this->_markups[$name] = [ 'type' => self::TYPE_ALIAS, 'name' => $options['name'] - ); + ]; } else { if ($type && array_key_exists('empty', $options) && $options['empty']) { // add a single replace markup @@ -290,7 +290,7 @@ public function removeMarkup($name) */ public function clearMarkups() { - $this->_markups = array(); + $this->_markups = []; } /** @@ -673,7 +673,7 @@ public function setFilter(Zend_Filter_Interface $filter, $markup) * * @return void */ - public function addGroup($name, array $allowedInside = array(), array $allowsInside = array()) + public function addGroup($name, array $allowedInside = [], array $allowsInside = []) { $this->_groups[$name] = $allowsInside; diff --git a/library/Zend/Markup/Token.php b/library/Zend/Markup/Token.php index d5418abb91..038e4dc38a 100644 --- a/library/Zend/Markup/Token.php +++ b/library/Zend/Markup/Token.php @@ -69,7 +69,7 @@ class Zend_Markup_Token * * @var array */ - protected $_attributes = array(); + protected $_attributes = []; /** * The used tag stopper (empty when none is found) @@ -100,7 +100,7 @@ public function __construct( $tag, $type, $name = '', - array $attributes = array(), + array $attributes = [], Zend_Markup_Token $parent = null ) { $this->_tag = $tag; diff --git a/library/Zend/Markup/TokenList.php b/library/Zend/Markup/TokenList.php index cbfc78a76c..26fd742a94 100644 --- a/library/Zend/Markup/TokenList.php +++ b/library/Zend/Markup/TokenList.php @@ -38,7 +38,7 @@ class Zend_Markup_TokenList implements RecursiveIterator * * @var array */ - protected $_tokens = array(); + protected $_tokens = []; /** * Get the current token diff --git a/library/Zend/Measure/Abstract.php b/library/Zend/Measure/Abstract.php index 73c5c95242..396c96ec7a 100644 --- a/library/Zend/Measure/Abstract.php +++ b/library/Zend/Measure/Abstract.php @@ -69,7 +69,7 @@ abstract class Zend_Measure_Abstract /** * Unit types for this measurement */ - protected $_units = array(); + protected $_units = []; /** * Zend_Measure_Abstract is an abstract class for the different measurement types @@ -162,7 +162,7 @@ public function getValue($round = -1, $locale = null) if ($locale !== null) { $this->setLocale($locale, true); - return Zend_Locale_Format::toNumber($return, array('locale' => $locale)); + return Zend_Locale_Format::toNumber($return, ['locale' => $locale]); } return $return; @@ -199,7 +199,7 @@ public function setValue($value, $type = null, $locale = null) } try { - $value = Zend_Locale_Format::getNumber($value, array('locale' => $locale)); + $value = Zend_Locale_Format::getNumber($value, ['locale' => $locale]); } catch(Exception $e) { require_once 'Zend/Measure/Exception.php'; throw new Zend_Measure_Exception($e->getMessage(), $e->getCode(), $e); diff --git a/library/Zend/Measure/Acceleration.php b/library/Zend/Measure/Acceleration.php index 09cdf15c21..fa52415f39 100644 --- a/library/Zend/Measure/Acceleration.php +++ b/library/Zend/Measure/Acceleration.php @@ -65,27 +65,27 @@ class Zend_Measure_Acceleration extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'CENTIGAL' => array('0.0001', 'cgal'), - 'CENTIMETER_PER_SQUARE_SECOND' => array('0.01', 'cm/s²'), - 'DECIGAL' => array('0.001', 'dgal'), - 'DECIMETER_PER_SQUARE_SECOND' => array('0.1', 'dm/s²'), - 'DEKAMETER_PER_SQUARE_SECOND' => array('10', 'dam/s²'), - 'FOOT_PER_SQUARE_SECOND' => array('0.3048', 'ft/s²'), - 'G' => array('9.80665', 'g'), - 'GAL' => array('0.01', 'gal'), - 'GALILEO' => array('0.01', 'gal'), - 'GRAV' => array('9.80665', 'g'), - 'HECTOMETER_PER_SQUARE_SECOND' => array('100', 'h/s²'), - 'INCH_PER_SQUARE_SECOND' => array('0.0254', 'in/s²'), - 'KILOMETER_PER_HOUR_SECOND' => array(array('' => '5','/' => '18'), 'km/h²'), - 'KILOMETER_PER_SQUARE_SECOND' => array('1000', 'km/s²'), - 'METER_PER_SQUARE_SECOND' => array('1', 'm/s²'), - 'MILE_PER_HOUR_MINUTE' => array(array('' => '22', '/' => '15', '*' => '0.3048', '/' => '60'), 'mph/m'), - 'MILE_PER_HOUR_SECOND' => array(array('' => '22', '/' => '15', '*' => '0.3048'), 'mph/s'), - 'MILE_PER_SQUARE_SECOND' => array('1609.344', 'mi/s²'), - 'MILLIGAL' => array('0.00001', 'mgal'), - 'MILLIMETER_PER_SQUARE_SECOND' => array('0.001', 'mm/s²'), + protected $_units = [ + 'CENTIGAL' => ['0.0001', 'cgal'], + 'CENTIMETER_PER_SQUARE_SECOND' => ['0.01', 'cm/s²'], + 'DECIGAL' => ['0.001', 'dgal'], + 'DECIMETER_PER_SQUARE_SECOND' => ['0.1', 'dm/s²'], + 'DEKAMETER_PER_SQUARE_SECOND' => ['10', 'dam/s²'], + 'FOOT_PER_SQUARE_SECOND' => ['0.3048', 'ft/s²'], + 'G' => ['9.80665', 'g'], + 'GAL' => ['0.01', 'gal'], + 'GALILEO' => ['0.01', 'gal'], + 'GRAV' => ['9.80665', 'g'], + 'HECTOMETER_PER_SQUARE_SECOND' => ['100', 'h/s²'], + 'INCH_PER_SQUARE_SECOND' => ['0.0254', 'in/s²'], + 'KILOMETER_PER_HOUR_SECOND' => [['' => '5','/' => '18'], 'km/h²'], + 'KILOMETER_PER_SQUARE_SECOND' => ['1000', 'km/s²'], + 'METER_PER_SQUARE_SECOND' => ['1', 'm/s²'], + 'MILE_PER_HOUR_MINUTE' => [['' => '22', '/' => '15', '*' => '0.3048', '/' => '60'], 'mph/m'], + 'MILE_PER_HOUR_SECOND' => [['' => '22', '/' => '15', '*' => '0.3048'], 'mph/s'], + 'MILE_PER_SQUARE_SECOND' => ['1609.344', 'mi/s²'], + 'MILLIGAL' => ['0.00001', 'mgal'], + 'MILLIMETER_PER_SQUARE_SECOND' => ['0.001', 'mm/s²'], 'STANDARD' => 'METER_PER_SQUARE_SECOND' - ); + ]; } diff --git a/library/Zend/Measure/Angle.php b/library/Zend/Measure/Angle.php index 9d514a8617..2e0e89482f 100644 --- a/library/Zend/Measure/Angle.php +++ b/library/Zend/Measure/Angle.php @@ -58,21 +58,21 @@ class Zend_Measure_Angle extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'RADIAN' => array('1','rad'), - 'MIL' => array(array('' => M_PI,'/' => '3200'), 'mil'), - 'GRAD' => array(array('' => M_PI,'/' => '200'), 'gr'), - 'DEGREE' => array(array('' => M_PI,'/' => '180'), '°'), - 'MINUTE' => array(array('' => M_PI,'/' => '10800'), "'"), - 'SECOND' => array(array('' => M_PI,'/' => '648000'), '"'), - 'POINT' => array(array('' => M_PI,'/' => '16'), 'pt'), - 'CIRCLE_16' => array(array('' => M_PI,'/' => '8'), 'per 16 circle'), - 'CIRCLE_10' => array(array('' => M_PI,'/' => '5'), 'per 10 circle'), - 'CIRCLE_8' => array(array('' => M_PI,'/' => '4'), 'per 8 circle'), - 'CIRCLE_6' => array(array('' => M_PI,'/' => '3'), 'per 6 circle'), - 'CIRCLE_4' => array(array('' => M_PI,'/' => '2'), 'per 4 circle'), - 'CIRCLE_2' => array(M_PI, 'per 2 circle'), - 'FULL_CIRCLE' => array(array('' => M_PI,'*' => '2'), 'cir'), + protected $_units = [ + 'RADIAN' => ['1','rad'], + 'MIL' => [['' => M_PI,'/' => '3200'], 'mil'], + 'GRAD' => [['' => M_PI,'/' => '200'], 'gr'], + 'DEGREE' => [['' => M_PI,'/' => '180'], '°'], + 'MINUTE' => [['' => M_PI,'/' => '10800'], "'"], + 'SECOND' => [['' => M_PI,'/' => '648000'], '"'], + 'POINT' => [['' => M_PI,'/' => '16'], 'pt'], + 'CIRCLE_16' => [['' => M_PI,'/' => '8'], 'per 16 circle'], + 'CIRCLE_10' => [['' => M_PI,'/' => '5'], 'per 10 circle'], + 'CIRCLE_8' => [['' => M_PI,'/' => '4'], 'per 8 circle'], + 'CIRCLE_6' => [['' => M_PI,'/' => '3'], 'per 6 circle'], + 'CIRCLE_4' => [['' => M_PI,'/' => '2'], 'per 4 circle'], + 'CIRCLE_2' => [M_PI, 'per 2 circle'], + 'FULL_CIRCLE' => [['' => M_PI,'*' => '2'], 'cir'], 'STANDARD' => 'RADIAN' - ); + ]; } diff --git a/library/Zend/Measure/Area.php b/library/Zend/Measure/Area.php index c0057b67f5..1e1c6771bc 100644 --- a/library/Zend/Measure/Area.php +++ b/library/Zend/Measure/Area.php @@ -174,137 +174,137 @@ class Zend_Measure_Area extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ACRE' => array('4046.856422', 'A'), - 'ACRE_COMMERCIAL' => array('3344.50944', 'A'), - 'ACRE_SURVEY' => array('4046.872627', 'A'), - 'ACRE_IRELAND' => array('6555', 'A'), - 'ARE' => array('100', 'a'), - 'ARPENT' => array('3418.89', 'arpent'), - 'BARN' => array('1e-28', 'b'), - 'BOVATE' => array('60000', 'bovate'), - 'BUNDER' => array('10000', 'bunder'), - 'CABALLERIA' => array('400000', 'caballeria'), - 'CABALLERIA_AMERICA' => array('450000', 'caballeria'), - 'CABALLERIA_CUBA' => array('134200', 'caballeria'), - 'CARREAU' => array('12900', 'carreau'), - 'CARUCATE' => array('486000', 'carucate'), - 'CAWNEY' => array('5400', 'cawney'), - 'CENTIARE' => array('1', 'ca'), - 'CONG' => array('1000', 'cong'), - 'COVER' => array('2698', 'cover'), - 'CUERDA' => array('3930', 'cda'), - 'DEKARE' => array('1000', 'dekare'), - 'DESSIATINA' => array('10925', 'dessiantina'), - 'DHUR' => array('16.929', 'dhur'), - 'DUNUM' => array('1000', 'dunum'), - 'DUNHAM' => array('1000', 'dunham'), - 'FALL_SCOTS' => array('32.15', 'fall'), - 'FALL' => array('47.03', 'fall'), - 'FANEGA' => array('6430', 'fanega'), - 'FARTHINGDALE' => array('1012', 'farthingdale'), - 'HACIENDA' => array('89600000', 'hacienda'), - 'HECTARE' => array('10000', 'ha'), - 'HIDE' => array('486000', 'hide'), - 'HOMESTEAD' => array('647500', 'homestead'), - 'HUNDRED' => array('50000000', 'hundred'), - 'JERIB' => array('2000', 'jerib'), - 'JITRO' => array('5755', 'jitro'), - 'JOCH' => array('5755', 'joch'), - 'JUTRO' => array('5755', 'jutro'), - 'JO' => array('1.62', 'jo'), - 'KAPPLAND' => array('154.26', 'kappland'), - 'KATTHA' => array('338', 'kattha'), - 'LABOR' => array('716850', 'labor'), - 'LEGUA' => array('17920000', 'legua'), - 'MANZANA_COSTA_RICA' => array('6988.96', 'manzana'), - 'MANZANA' => array('10000', 'manzana'), - 'MORGEN' => array('2500', 'morgen'), - 'MORGEN_AFRICA' => array('8567', 'morgen'), - 'MU' => array(array('' => '10000', '/' => '15'), 'mu'), - 'NGARN' => array('400', 'ngarn'), - 'NOOK' => array('80937.128', 'nook'), - 'OXGANG' => array('60000', 'oxgang'), - 'PERCH' => array('25.29285264', 'perch'), - 'PERCHE' => array('34.19', 'perche'), - 'PING' => array('3.305', 'ping'), - 'PYONG' => array('3.306', 'pyong'), - 'RAI' => array('1600', 'rai'), - 'ROOD' => array('1011.7141', 'rood'), - 'SECTION' => array('2589998.5', 'sec'), - 'SHED' => array('10e-52', 'shed'), - 'SITIO' => array('18000000', 'sitio'), - 'SQUARE' => array('9.290304', 'sq'), - 'SQUARE_ANGSTROM' => array('1.0e-20', 'A²'), - 'SQUARE_ASTRONOMICAL_UNIT' => array('2.2379523e+22', 'AU²'), - 'SQUARE_ATTOMETER' => array('1.0e-36', 'am²'), - 'SQUARE_BICRON' => array('1.0e-24', 'µµ²'), - 'SQUARE_CENTIMETER' => array('0.0001', 'cm²'), - 'SQUARE_CHAIN' => array('404.68726', 'ch²'), - 'SQUARE_CHAIN_ENGINEER' => array('929.03412', 'ch²'), - 'SQUARE_CITY_BLOCK_US_EAST' => array('4.97027584', 'sq block'), - 'SQUARE_CITY_BLOCK_US_WEST' => array('17.141056', 'sq block'), - 'SQUARE_CITY_BLOCK_US_SOUTH' => array('99.88110336', 'sq block'), - 'SQUARE_CUBIT' => array('0.20903184', 'sq cubit'), - 'SQUARE_DECIMETER' => array('0.01', 'dm²'), - 'SQUARE_DEKAMETER' => array('100', 'dam²'), - 'SQUARE_EXAMETER' => array('1.0e+36', 'Em²'), - 'SQUARE_FATHOM' => array('3.3445228', 'fth²'), - 'SQUARE_FEMTOMETER' => array('1.0e-30', 'fm²'), - 'SQUARE_FERMI' => array('1.0e-30', 'f²'), - 'SQUARE_FOOT' => array('0.09290304', 'ft²'), - 'SQUARE_FOOT_SURVEY' => array('0.092903412', 'ft²'), - 'SQUARE_FURLONG' => array('40468.726', 'fur²'), - 'SQUARE_GIGAMETER' => array('1.0e+18', 'Gm²'), - 'SQUARE_HECTOMETER' => array('10000', 'hm²'), - 'SQUARE_INCH' => array(array('' => '0.09290304','/' => '144'), 'in²'), - 'SQUARE_INCH_SURVEY' => array(array('' => '0.092903412','/' => '144'), 'in²'), - 'SQUARE_KILOMETER' => array('1000000', 'km²'), - 'SQUARE_LEAGUE_NAUTIC' => array('3.0869136e+07', 'sq league'), - 'SQUARE_LEAGUE' => array('2.3309986e+07', 'sq league'), - 'SQUARE_LIGHT_YEAR' => array('8.9505412e+31', 'ly²'), - 'SQUARE_LINK' => array('0.040468726', 'sq link'), - 'SQUARE_LINK_ENGINEER' => array('0.092903412', 'sq link'), - 'SQUARE_MEGAMETER' => array('1.0e+12', 'Mm²'), - 'SQUARE_METER' => array('1', 'm²'), - 'SQUARE_MICROINCH' => array(array('' => '1.0e-6','*' => '6.4516e-10'), 'µin²'), - 'SQUARE_MICROMETER' => array('1.0e-12', 'µm²'), - 'SQUARE_MICROMICRON' => array('1.0e-24', 'µµ²'), - 'SQUARE_MICRON' => array('1.0e-12', 'µ²'), - 'SQUARE_MIL' => array('6.4516e-10', 'sq mil'), - 'SQUARE_MILE' => array(array('' => '0.09290304','*' => '27878400'), 'mi²'), - 'SQUARE_MILE_NAUTIC' => array('3429904', 'mi²'), - 'SQUARE_MILE_SURVEY' => array('2589998.5', 'mi²'), - 'SQUARE_MILLIMETER' => array('0.000001', 'mm²'), - 'SQUARE_MILLIMICRON' => array('1.0e-18', 'mµ²'), - 'SQUARE_MYRIAMETER' => array('1.0e+8', 'mym²'), - 'SQUARE_NANOMETER' => array('1.0e-18', 'nm²'), - 'SQUARE_PARIS_FOOT' => array('0.1055', 'sq paris foot'), - 'SQUARE_PARSEC' => array('9.5214087e+32', 'pc²'), - 'SQUARE_PERCH' => array('25.292954', 'sq perch'), - 'SQUARE_PERCHE' => array('51.072', 'sq perche'), - 'SQUARE_PETAMETER' => array('1.0e+30', 'Pm²'), - 'SQUARE_PICOMETER' => array('1.0e-24', 'pm²'), - 'SQUARE_ROD' => array(array('' => '0.092903412','*' => '272.25'), 'rd²'), - 'SQUARE_TENTHMETER' => array('1.0e-20', 'sq tenth-meter'), - 'SQUARE_TERAMETER' => array('1.0e+24', 'Tm²'), - 'SQUARE_THOU' => array('6.4516e-10', 'sq thou'), - 'SQUARE_VARA' => array('0.70258205', 'sq vara'), - 'SQUARE_VARA_TEXAS' => array('0.71684731', 'sq vara'), - 'SQUARE_YARD' => array('0.83612736', 'yd²'), - 'SQUARE_YARD_SURVEY' => array('0.836130708', 'yd²'), - 'SQUARE_YOCTOMETER' => array('1.0e-48', 'ym²'), - 'SQUARE_YOTTAMETER' => array('1.0e+48', 'Ym²'), - 'STANG' => array('2709', 'stang'), - 'STREMMA' => array('1000', 'stremma'), - 'TAREA' => array('628.8', 'tarea'), - 'TATAMI' => array('1.62', 'tatami'), - 'TONDE_LAND' => array('5516', 'tonde land'), - 'TOWNSHIP' => array('93239945.3196288', 'twp'), - 'TSUBO' => array('3.3058', 'tsubo'), - 'TUNNLAND' => array('4936.4', 'tunnland'), - 'YARD' => array('0.83612736', 'yd'), - 'VIRGATE' => array('120000', 'virgate'), + protected $_units = [ + 'ACRE' => ['4046.856422', 'A'], + 'ACRE_COMMERCIAL' => ['3344.50944', 'A'], + 'ACRE_SURVEY' => ['4046.872627', 'A'], + 'ACRE_IRELAND' => ['6555', 'A'], + 'ARE' => ['100', 'a'], + 'ARPENT' => ['3418.89', 'arpent'], + 'BARN' => ['1e-28', 'b'], + 'BOVATE' => ['60000', 'bovate'], + 'BUNDER' => ['10000', 'bunder'], + 'CABALLERIA' => ['400000', 'caballeria'], + 'CABALLERIA_AMERICA' => ['450000', 'caballeria'], + 'CABALLERIA_CUBA' => ['134200', 'caballeria'], + 'CARREAU' => ['12900', 'carreau'], + 'CARUCATE' => ['486000', 'carucate'], + 'CAWNEY' => ['5400', 'cawney'], + 'CENTIARE' => ['1', 'ca'], + 'CONG' => ['1000', 'cong'], + 'COVER' => ['2698', 'cover'], + 'CUERDA' => ['3930', 'cda'], + 'DEKARE' => ['1000', 'dekare'], + 'DESSIATINA' => ['10925', 'dessiantina'], + 'DHUR' => ['16.929', 'dhur'], + 'DUNUM' => ['1000', 'dunum'], + 'DUNHAM' => ['1000', 'dunham'], + 'FALL_SCOTS' => ['32.15', 'fall'], + 'FALL' => ['47.03', 'fall'], + 'FANEGA' => ['6430', 'fanega'], + 'FARTHINGDALE' => ['1012', 'farthingdale'], + 'HACIENDA' => ['89600000', 'hacienda'], + 'HECTARE' => ['10000', 'ha'], + 'HIDE' => ['486000', 'hide'], + 'HOMESTEAD' => ['647500', 'homestead'], + 'HUNDRED' => ['50000000', 'hundred'], + 'JERIB' => ['2000', 'jerib'], + 'JITRO' => ['5755', 'jitro'], + 'JOCH' => ['5755', 'joch'], + 'JUTRO' => ['5755', 'jutro'], + 'JO' => ['1.62', 'jo'], + 'KAPPLAND' => ['154.26', 'kappland'], + 'KATTHA' => ['338', 'kattha'], + 'LABOR' => ['716850', 'labor'], + 'LEGUA' => ['17920000', 'legua'], + 'MANZANA_COSTA_RICA' => ['6988.96', 'manzana'], + 'MANZANA' => ['10000', 'manzana'], + 'MORGEN' => ['2500', 'morgen'], + 'MORGEN_AFRICA' => ['8567', 'morgen'], + 'MU' => [['' => '10000', '/' => '15'], 'mu'], + 'NGARN' => ['400', 'ngarn'], + 'NOOK' => ['80937.128', 'nook'], + 'OXGANG' => ['60000', 'oxgang'], + 'PERCH' => ['25.29285264', 'perch'], + 'PERCHE' => ['34.19', 'perche'], + 'PING' => ['3.305', 'ping'], + 'PYONG' => ['3.306', 'pyong'], + 'RAI' => ['1600', 'rai'], + 'ROOD' => ['1011.7141', 'rood'], + 'SECTION' => ['2589998.5', 'sec'], + 'SHED' => ['10e-52', 'shed'], + 'SITIO' => ['18000000', 'sitio'], + 'SQUARE' => ['9.290304', 'sq'], + 'SQUARE_ANGSTROM' => ['1.0e-20', 'A²'], + 'SQUARE_ASTRONOMICAL_UNIT' => ['2.2379523e+22', 'AU²'], + 'SQUARE_ATTOMETER' => ['1.0e-36', 'am²'], + 'SQUARE_BICRON' => ['1.0e-24', 'µµ²'], + 'SQUARE_CENTIMETER' => ['0.0001', 'cm²'], + 'SQUARE_CHAIN' => ['404.68726', 'ch²'], + 'SQUARE_CHAIN_ENGINEER' => ['929.03412', 'ch²'], + 'SQUARE_CITY_BLOCK_US_EAST' => ['4.97027584', 'sq block'], + 'SQUARE_CITY_BLOCK_US_WEST' => ['17.141056', 'sq block'], + 'SQUARE_CITY_BLOCK_US_SOUTH' => ['99.88110336', 'sq block'], + 'SQUARE_CUBIT' => ['0.20903184', 'sq cubit'], + 'SQUARE_DECIMETER' => ['0.01', 'dm²'], + 'SQUARE_DEKAMETER' => ['100', 'dam²'], + 'SQUARE_EXAMETER' => ['1.0e+36', 'Em²'], + 'SQUARE_FATHOM' => ['3.3445228', 'fth²'], + 'SQUARE_FEMTOMETER' => ['1.0e-30', 'fm²'], + 'SQUARE_FERMI' => ['1.0e-30', 'f²'], + 'SQUARE_FOOT' => ['0.09290304', 'ft²'], + 'SQUARE_FOOT_SURVEY' => ['0.092903412', 'ft²'], + 'SQUARE_FURLONG' => ['40468.726', 'fur²'], + 'SQUARE_GIGAMETER' => ['1.0e+18', 'Gm²'], + 'SQUARE_HECTOMETER' => ['10000', 'hm²'], + 'SQUARE_INCH' => [['' => '0.09290304','/' => '144'], 'in²'], + 'SQUARE_INCH_SURVEY' => [['' => '0.092903412','/' => '144'], 'in²'], + 'SQUARE_KILOMETER' => ['1000000', 'km²'], + 'SQUARE_LEAGUE_NAUTIC' => ['3.0869136e+07', 'sq league'], + 'SQUARE_LEAGUE' => ['2.3309986e+07', 'sq league'], + 'SQUARE_LIGHT_YEAR' => ['8.9505412e+31', 'ly²'], + 'SQUARE_LINK' => ['0.040468726', 'sq link'], + 'SQUARE_LINK_ENGINEER' => ['0.092903412', 'sq link'], + 'SQUARE_MEGAMETER' => ['1.0e+12', 'Mm²'], + 'SQUARE_METER' => ['1', 'm²'], + 'SQUARE_MICROINCH' => [['' => '1.0e-6','*' => '6.4516e-10'], 'µin²'], + 'SQUARE_MICROMETER' => ['1.0e-12', 'µm²'], + 'SQUARE_MICROMICRON' => ['1.0e-24', 'µµ²'], + 'SQUARE_MICRON' => ['1.0e-12', 'µ²'], + 'SQUARE_MIL' => ['6.4516e-10', 'sq mil'], + 'SQUARE_MILE' => [['' => '0.09290304','*' => '27878400'], 'mi²'], + 'SQUARE_MILE_NAUTIC' => ['3429904', 'mi²'], + 'SQUARE_MILE_SURVEY' => ['2589998.5', 'mi²'], + 'SQUARE_MILLIMETER' => ['0.000001', 'mm²'], + 'SQUARE_MILLIMICRON' => ['1.0e-18', 'mµ²'], + 'SQUARE_MYRIAMETER' => ['1.0e+8', 'mym²'], + 'SQUARE_NANOMETER' => ['1.0e-18', 'nm²'], + 'SQUARE_PARIS_FOOT' => ['0.1055', 'sq paris foot'], + 'SQUARE_PARSEC' => ['9.5214087e+32', 'pc²'], + 'SQUARE_PERCH' => ['25.292954', 'sq perch'], + 'SQUARE_PERCHE' => ['51.072', 'sq perche'], + 'SQUARE_PETAMETER' => ['1.0e+30', 'Pm²'], + 'SQUARE_PICOMETER' => ['1.0e-24', 'pm²'], + 'SQUARE_ROD' => [['' => '0.092903412','*' => '272.25'], 'rd²'], + 'SQUARE_TENTHMETER' => ['1.0e-20', 'sq tenth-meter'], + 'SQUARE_TERAMETER' => ['1.0e+24', 'Tm²'], + 'SQUARE_THOU' => ['6.4516e-10', 'sq thou'], + 'SQUARE_VARA' => ['0.70258205', 'sq vara'], + 'SQUARE_VARA_TEXAS' => ['0.71684731', 'sq vara'], + 'SQUARE_YARD' => ['0.83612736', 'yd²'], + 'SQUARE_YARD_SURVEY' => ['0.836130708', 'yd²'], + 'SQUARE_YOCTOMETER' => ['1.0e-48', 'ym²'], + 'SQUARE_YOTTAMETER' => ['1.0e+48', 'Ym²'], + 'STANG' => ['2709', 'stang'], + 'STREMMA' => ['1000', 'stremma'], + 'TAREA' => ['628.8', 'tarea'], + 'TATAMI' => ['1.62', 'tatami'], + 'TONDE_LAND' => ['5516', 'tonde land'], + 'TOWNSHIP' => ['93239945.3196288', 'twp'], + 'TSUBO' => ['3.3058', 'tsubo'], + 'TUNNLAND' => ['4936.4', 'tunnland'], + 'YARD' => ['0.83612736', 'yd'], + 'VIRGATE' => ['120000', 'virgate'], 'STANDARD' => 'SQUARE_METER' - ); + ]; } diff --git a/library/Zend/Measure/Binary.php b/library/Zend/Measure/Binary.php index e16527c4a8..40399204db 100644 --- a/library/Zend/Measure/Binary.php +++ b/library/Zend/Measure/Binary.php @@ -80,43 +80,43 @@ class Zend_Measure_Binary extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'BIT' => array('0.125', 'b'), - 'CRUMB' => array('0.25', 'crumb'), - 'NIBBLE' => array('0.5', 'nibble'), - 'BYTE' => array('1', 'B'), - 'KILOBYTE' => array('1024', 'kB'), - 'KIBIBYTE' => array('1024', 'KiB'), - 'KILO_BINARY_BYTE' => array('1024', 'KiB'), - 'KILOBYTE_SI' => array('1000', 'kB.'), - 'MEGABYTE' => array('1048576', 'MB'), - 'MEBIBYTE' => array('1048576', 'MiB'), - 'MEGA_BINARY_BYTE' => array('1048576', 'MiB'), - 'MEGABYTE_SI' => array('1000000', 'MB.'), - 'GIGABYTE' => array('1073741824', 'GB'), - 'GIBIBYTE' => array('1073741824', 'GiB'), - 'GIGA_BINARY_BYTE' => array('1073741824', 'GiB'), - 'GIGABYTE_SI' => array('1000000000', 'GB.'), - 'TERABYTE' => array('1099511627776', 'TB'), - 'TEBIBYTE' => array('1099511627776', 'TiB'), - 'TERA_BINARY_BYTE' => array('1099511627776', 'TiB'), - 'TERABYTE_SI' => array('1000000000000', 'TB.'), - 'PETABYTE' => array('1125899906842624', 'PB'), - 'PEBIBYTE' => array('1125899906842624', 'PiB'), - 'PETA_BINARY_BYTE' => array('1125899906842624', 'PiB'), - 'PETABYTE_SI' => array('1000000000000000', 'PB.'), - 'EXABYTE' => array('1152921504606846976', 'EB'), - 'EXBIBYTE' => array('1152921504606846976', 'EiB'), - 'EXA_BINARY_BYTE' => array('1152921504606846976', 'EiB'), - 'EXABYTE_SI' => array('1000000000000000000', 'EB.'), - 'ZETTABYTE' => array('1180591620717411303424', 'ZB'), - 'ZEBIBYTE' => array('1180591620717411303424', 'ZiB'), - 'ZETTA_BINARY_BYTE'=> array('1180591620717411303424', 'ZiB'), - 'ZETTABYTE_SI' => array('1000000000000000000000', 'ZB.'), - 'YOTTABYTE' => array('1208925819614629174706176', 'YB'), - 'YOBIBYTE' => array('1208925819614629174706176', 'YiB'), - 'YOTTA_BINARY_BYTE'=> array('1208925819614629174706176', 'YiB'), - 'YOTTABYTE_SI' => array('1000000000000000000000000', 'YB.'), + protected $_units = [ + 'BIT' => ['0.125', 'b'], + 'CRUMB' => ['0.25', 'crumb'], + 'NIBBLE' => ['0.5', 'nibble'], + 'BYTE' => ['1', 'B'], + 'KILOBYTE' => ['1024', 'kB'], + 'KIBIBYTE' => ['1024', 'KiB'], + 'KILO_BINARY_BYTE' => ['1024', 'KiB'], + 'KILOBYTE_SI' => ['1000', 'kB.'], + 'MEGABYTE' => ['1048576', 'MB'], + 'MEBIBYTE' => ['1048576', 'MiB'], + 'MEGA_BINARY_BYTE' => ['1048576', 'MiB'], + 'MEGABYTE_SI' => ['1000000', 'MB.'], + 'GIGABYTE' => ['1073741824', 'GB'], + 'GIBIBYTE' => ['1073741824', 'GiB'], + 'GIGA_BINARY_BYTE' => ['1073741824', 'GiB'], + 'GIGABYTE_SI' => ['1000000000', 'GB.'], + 'TERABYTE' => ['1099511627776', 'TB'], + 'TEBIBYTE' => ['1099511627776', 'TiB'], + 'TERA_BINARY_BYTE' => ['1099511627776', 'TiB'], + 'TERABYTE_SI' => ['1000000000000', 'TB.'], + 'PETABYTE' => ['1125899906842624', 'PB'], + 'PEBIBYTE' => ['1125899906842624', 'PiB'], + 'PETA_BINARY_BYTE' => ['1125899906842624', 'PiB'], + 'PETABYTE_SI' => ['1000000000000000', 'PB.'], + 'EXABYTE' => ['1152921504606846976', 'EB'], + 'EXBIBYTE' => ['1152921504606846976', 'EiB'], + 'EXA_BINARY_BYTE' => ['1152921504606846976', 'EiB'], + 'EXABYTE_SI' => ['1000000000000000000', 'EB.'], + 'ZETTABYTE' => ['1180591620717411303424', 'ZB'], + 'ZEBIBYTE' => ['1180591620717411303424', 'ZiB'], + 'ZETTA_BINARY_BYTE'=> ['1180591620717411303424', 'ZiB'], + 'ZETTABYTE_SI' => ['1000000000000000000000', 'ZB.'], + 'YOTTABYTE' => ['1208925819614629174706176', 'YB'], + 'YOBIBYTE' => ['1208925819614629174706176', 'YiB'], + 'YOTTA_BINARY_BYTE'=> ['1208925819614629174706176', 'YiB'], + 'YOTTABYTE_SI' => ['1000000000000000000000000', 'YB.'], 'STANDARD' => 'BYTE' - ); + ]; } diff --git a/library/Zend/Measure/Capacitance.php b/library/Zend/Measure/Capacitance.php index 9399c1db8e..ec5b1793cb 100644 --- a/library/Zend/Measure/Capacitance.php +++ b/library/Zend/Measure/Capacitance.php @@ -68,31 +68,31 @@ class Zend_Measure_Capacitance extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ABFARAD' => array('1.0e+9', 'abfarad'), - 'AMPERE_PER_SECOND_VOLT' => array('1', 'A/sV'), - 'CENTIFARAD' => array('0.01', 'cF'), - 'COULOMB_PER_VOLT' => array('1', 'C/V'), - 'DECIFARAD' => array('0.1', 'dF'), - 'DEKAFARAD' => array('10', 'daF'), - 'ELECTROMAGNETIC_UNIT' => array('1.0e+9', 'capacity emu'), - 'ELECTROSTATIC_UNIT' => array('1.11265e-12', 'capacity esu'), - 'FARAD' => array('1', 'F'), - 'FARAD_INTERNATIONAL' => array('0.99951', 'F'), - 'GAUSSIAN' => array('1.11265e-12', 'G'), - 'GIGAFARAD' => array('1.0e+9', 'GF'), - 'HECTOFARAD' => array('100', 'hF'), - 'JAR' => array('1.11265e-9', 'jar'), - 'KILOFARAD' => array('1000', 'kF'), - 'MEGAFARAD' => array('1000000', 'MF'), - 'MICROFARAD' => array('0.000001', 'µF'), - 'MILLIFARAD' => array('0.001', 'mF'), - 'NANOFARAD' => array('1.0e-9', 'nF'), - 'PICOFARAD' => array('1.0e-12', 'pF'), - 'PUFF' => array('1.0e-12', 'pF'), - 'SECOND_PER_OHM' => array('1', 's/Ohm'), - 'STATFARAD' => array('1.11265e-12', 'statfarad'), - 'TERAFARAD' => array('1.0e+12', 'TF'), + protected $_units = [ + 'ABFARAD' => ['1.0e+9', 'abfarad'], + 'AMPERE_PER_SECOND_VOLT' => ['1', 'A/sV'], + 'CENTIFARAD' => ['0.01', 'cF'], + 'COULOMB_PER_VOLT' => ['1', 'C/V'], + 'DECIFARAD' => ['0.1', 'dF'], + 'DEKAFARAD' => ['10', 'daF'], + 'ELECTROMAGNETIC_UNIT' => ['1.0e+9', 'capacity emu'], + 'ELECTROSTATIC_UNIT' => ['1.11265e-12', 'capacity esu'], + 'FARAD' => ['1', 'F'], + 'FARAD_INTERNATIONAL' => ['0.99951', 'F'], + 'GAUSSIAN' => ['1.11265e-12', 'G'], + 'GIGAFARAD' => ['1.0e+9', 'GF'], + 'HECTOFARAD' => ['100', 'hF'], + 'JAR' => ['1.11265e-9', 'jar'], + 'KILOFARAD' => ['1000', 'kF'], + 'MEGAFARAD' => ['1000000', 'MF'], + 'MICROFARAD' => ['0.000001', 'µF'], + 'MILLIFARAD' => ['0.001', 'mF'], + 'NANOFARAD' => ['1.0e-9', 'nF'], + 'PICOFARAD' => ['1.0e-12', 'pF'], + 'PUFF' => ['1.0e-12', 'pF'], + 'SECOND_PER_OHM' => ['1', 's/Ohm'], + 'STATFARAD' => ['1.11265e-12', 'statfarad'], + 'TERAFARAD' => ['1.0e+12', 'TF'], 'STANDARD' => 'FARAD' - ); + ]; } diff --git a/library/Zend/Measure/Cooking/Volume.php b/library/Zend/Measure/Cooking/Volume.php index 2eab0909ab..aee662a223 100644 --- a/library/Zend/Measure/Cooking/Volume.php +++ b/library/Zend/Measure/Cooking/Volume.php @@ -114,77 +114,77 @@ class Zend_Measure_Cooking_Volume extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'CAN_2POINT5' => array(array('' => '0.0037854118', '/' => '16', '' => '3.5'), '2.5th can'), - 'CAN_10' => array(array('' => '0.0037854118', '*' => '0.75'), '10th can'), - 'BARREL_WINE' => array('0.143201835', 'bbl'), - 'BARREL' => array('0.16365924', 'bbl'), - 'BARREL_US_DRY' => array(array('' => '26.7098656608', '/' => '231'), 'bbl'), - 'BARREL_US_FEDERAL' => array('0.1173477658', 'bbl'), - 'BARREL_US' => array('0.1192404717', 'bbl'), - 'BUCKET' => array('0.01818436', 'bucket'), - 'BUCKET_US' => array('0.018927059', 'bucket'), - 'BUSHEL' => array('0.03636872', 'bu'), - 'BUSHEL_US' => array('0.03523907', 'bu'), - 'CENTILITER' => array('0.00001', 'cl'), - 'COFFEE_SPOON' => array(array('' => '0.0037854118', '/' => '1536'), 'coffee spoon'), - 'CUBIC_CENTIMETER' => array('0.000001', 'cm³'), - 'CUBIC_DECIMETER' => array('0.001', 'dm³'), - 'CUBIC_FOOT' => array(array('' => '6.54119159', '/' => '231'), 'ft³'), - 'CUBIC_INCH' => array(array('' => '0.0037854118', '/' => '231'), 'in³'), - 'CUBIC_METER' => array('1', 'm³'), - 'CUBIC_MICROMETER' => array('1.0e-18', 'µm³'), - 'CUBIC_MILLIMETER' => array('1.0e-9', 'mm³'), - 'CUP_CANADA' => array('0.0002273045', 'c'), - 'CUP' => array('0.00025', 'c'), - 'CUP_US' => array(array('' => '0.0037854118', '/' => '16'), 'c'), - 'DASH' => array(array('' => '0.0037854118', '/' => '6144'), 'ds'), - 'DECILITER' => array('0.0001', 'dl'), - 'DEKALITER' => array('0.001', 'dal'), - 'DEMI' => array('0.00025', 'demi'), - 'DRAM' => array(array('' => '0.0037854118', '/' => '1024'), 'dr'), - 'DROP' => array(array('' => '0.0037854118', '/' => '73728'), 'ggt'), - 'FIFTH' => array('0.00075708236', 'fifth'), - 'GALLON' => array('0.00454609', 'gal'), - 'GALLON_US_DRY' => array('0.0044048838', 'gal'), - 'GALLON_US' => array('0.0037854118', 'gal'), - 'GILL' => array(array('' => '0.00454609', '/' => '32'), 'gi'), - 'GILL_US' => array(array('' => '0.0037854118', '/' => '32'), 'gi'), - 'HECTOLITER' => array('0.1', 'hl'), - 'HOGSHEAD' => array('0.28640367', 'hhd'), - 'HOGSHEAD_US' => array('0.2384809434', 'hhd'), - 'JIGGER' => array(array('' => '0.0037854118', '/' => '128', '*' => '1.5'), 'jigger'), - 'KILOLITER' => array('1', 'kl'), - 'LITER' => array('0.001', 'l'), - 'MEASURE' => array('0.0077', 'measure'), - 'MEGALITER' => array('1000', 'Ml'), - 'MICROLITER' => array('1.0e-9', 'µl'), - 'MILLILITER' => array('0.000001', 'ml'), - 'MINIM' => array(array('' => '0.00454609', '/' => '76800'), 'min'), - 'MINIM_US' => array(array('' => '0.0037854118','/' => '61440'), 'min'), - 'OUNCE' => array(array('' => '0.00454609', '/' => '160'), 'oz'), - 'OUNCE_US' => array(array('' => '0.0037854118', '/' => '128'), 'oz'), - 'PECK' => array('0.00909218', 'pk'), - 'PECK_US' => array('0.0088097676', 'pk'), - 'PINCH' => array(array('' => '0.0037854118', '/' => '12288'), 'pinch'), - 'PINT' => array(array('' => '0.00454609', '/' => '8'), 'pt'), - 'PINT_US_DRY' => array(array('' => '0.0044048838', '/' => '8'), 'pt'), - 'PINT_US' => array(array('' => '0.0037854118', '/' => '8'), 'pt'), - 'PIPE' => array('0.49097772', 'pipe'), - 'PIPE_US' => array('0.4769618868', 'pipe'), - 'PONY' => array(array('' => '0.0037854118', '/' => '128'), 'pony'), - 'QUART_GERMANY' => array('0.00114504', 'qt'), - 'QUART_ANCIENT' => array('0.00108', 'qt'), - 'QUART' => array(array('' => '0.00454609', '/' => '4'), 'qt'), - 'QUART_US_DRY' => array(array('' => '0.0044048838', '/' => '4'), 'qt'), - 'QUART_US' => array(array('' => '0.0037854118', '/' => '4'), 'qt'), - 'SHOT' => array(array('' => '0.0037854118', '/' => '128'), 'shot'), - 'TABLESPOON' => array('0.000015', 'tbsp'), - 'TABLESPOON_UK' => array(array('' => '0.00454609', '/' => '320'), 'tbsp'), - 'TABLESPOON_US' => array(array('' => '0.0037854118', '/' => '256'), 'tbsp'), - 'TEASPOON' => array('0.000005', 'tsp'), - 'TEASPOON_UK' => array(array('' => '0.00454609', '/' => '1280'), 'tsp'), - 'TEASPOON_US' => array(array('' => '0.0037854118', '/' => '768'), 'tsp'), + protected $_units = [ + 'CAN_2POINT5' => [['' => '0.0037854118', '/' => '16', '' => '3.5'], '2.5th can'], + 'CAN_10' => [['' => '0.0037854118', '*' => '0.75'], '10th can'], + 'BARREL_WINE' => ['0.143201835', 'bbl'], + 'BARREL' => ['0.16365924', 'bbl'], + 'BARREL_US_DRY' => [['' => '26.7098656608', '/' => '231'], 'bbl'], + 'BARREL_US_FEDERAL' => ['0.1173477658', 'bbl'], + 'BARREL_US' => ['0.1192404717', 'bbl'], + 'BUCKET' => ['0.01818436', 'bucket'], + 'BUCKET_US' => ['0.018927059', 'bucket'], + 'BUSHEL' => ['0.03636872', 'bu'], + 'BUSHEL_US' => ['0.03523907', 'bu'], + 'CENTILITER' => ['0.00001', 'cl'], + 'COFFEE_SPOON' => [['' => '0.0037854118', '/' => '1536'], 'coffee spoon'], + 'CUBIC_CENTIMETER' => ['0.000001', 'cm³'], + 'CUBIC_DECIMETER' => ['0.001', 'dm³'], + 'CUBIC_FOOT' => [['' => '6.54119159', '/' => '231'], 'ft³'], + 'CUBIC_INCH' => [['' => '0.0037854118', '/' => '231'], 'in³'], + 'CUBIC_METER' => ['1', 'm³'], + 'CUBIC_MICROMETER' => ['1.0e-18', 'µm³'], + 'CUBIC_MILLIMETER' => ['1.0e-9', 'mm³'], + 'CUP_CANADA' => ['0.0002273045', 'c'], + 'CUP' => ['0.00025', 'c'], + 'CUP_US' => [['' => '0.0037854118', '/' => '16'], 'c'], + 'DASH' => [['' => '0.0037854118', '/' => '6144'], 'ds'], + 'DECILITER' => ['0.0001', 'dl'], + 'DEKALITER' => ['0.001', 'dal'], + 'DEMI' => ['0.00025', 'demi'], + 'DRAM' => [['' => '0.0037854118', '/' => '1024'], 'dr'], + 'DROP' => [['' => '0.0037854118', '/' => '73728'], 'ggt'], + 'FIFTH' => ['0.00075708236', 'fifth'], + 'GALLON' => ['0.00454609', 'gal'], + 'GALLON_US_DRY' => ['0.0044048838', 'gal'], + 'GALLON_US' => ['0.0037854118', 'gal'], + 'GILL' => [['' => '0.00454609', '/' => '32'], 'gi'], + 'GILL_US' => [['' => '0.0037854118', '/' => '32'], 'gi'], + 'HECTOLITER' => ['0.1', 'hl'], + 'HOGSHEAD' => ['0.28640367', 'hhd'], + 'HOGSHEAD_US' => ['0.2384809434', 'hhd'], + 'JIGGER' => [['' => '0.0037854118', '/' => '128', '*' => '1.5'], 'jigger'], + 'KILOLITER' => ['1', 'kl'], + 'LITER' => ['0.001', 'l'], + 'MEASURE' => ['0.0077', 'measure'], + 'MEGALITER' => ['1000', 'Ml'], + 'MICROLITER' => ['1.0e-9', 'µl'], + 'MILLILITER' => ['0.000001', 'ml'], + 'MINIM' => [['' => '0.00454609', '/' => '76800'], 'min'], + 'MINIM_US' => [['' => '0.0037854118','/' => '61440'], 'min'], + 'OUNCE' => [['' => '0.00454609', '/' => '160'], 'oz'], + 'OUNCE_US' => [['' => '0.0037854118', '/' => '128'], 'oz'], + 'PECK' => ['0.00909218', 'pk'], + 'PECK_US' => ['0.0088097676', 'pk'], + 'PINCH' => [['' => '0.0037854118', '/' => '12288'], 'pinch'], + 'PINT' => [['' => '0.00454609', '/' => '8'], 'pt'], + 'PINT_US_DRY' => [['' => '0.0044048838', '/' => '8'], 'pt'], + 'PINT_US' => [['' => '0.0037854118', '/' => '8'], 'pt'], + 'PIPE' => ['0.49097772', 'pipe'], + 'PIPE_US' => ['0.4769618868', 'pipe'], + 'PONY' => [['' => '0.0037854118', '/' => '128'], 'pony'], + 'QUART_GERMANY' => ['0.00114504', 'qt'], + 'QUART_ANCIENT' => ['0.00108', 'qt'], + 'QUART' => [['' => '0.00454609', '/' => '4'], 'qt'], + 'QUART_US_DRY' => [['' => '0.0044048838', '/' => '4'], 'qt'], + 'QUART_US' => [['' => '0.0037854118', '/' => '4'], 'qt'], + 'SHOT' => [['' => '0.0037854118', '/' => '128'], 'shot'], + 'TABLESPOON' => ['0.000015', 'tbsp'], + 'TABLESPOON_UK' => [['' => '0.00454609', '/' => '320'], 'tbsp'], + 'TABLESPOON_US' => [['' => '0.0037854118', '/' => '256'], 'tbsp'], + 'TEASPOON' => ['0.000005', 'tsp'], + 'TEASPOON_UK' => [['' => '0.00454609', '/' => '1280'], 'tsp'], + 'TEASPOON_US' => [['' => '0.0037854118', '/' => '768'], 'tsp'], 'STANDARD' => 'CUBIC_METER' - ); + ]; } diff --git a/library/Zend/Measure/Cooking/Weight.php b/library/Zend/Measure/Cooking/Weight.php index e1ee11577b..e18706348c 100644 --- a/library/Zend/Measure/Cooking/Weight.php +++ b/library/Zend/Measure/Cooking/Weight.php @@ -54,17 +54,17 @@ class Zend_Measure_Cooking_Weight extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'HALF_STICK' => array(array('' => '453.59237', '/' => '8'), 'half stk'), - 'STICK' => array(array('' => '453.59237', '/' => '4'), 'stk'), - 'CUP' => array(array('' => '453.59237', '/' => '2'), 'c'), - 'GRAM' => array('1', 'g'), - 'OUNCE' => array(array('' => '453.59237', '/' => '16'), 'oz'), - 'POUND' => array('453.59237', 'lb'), - 'TEASPOON' => array(array('' => '1.2503332', '' => '453.59237', '/' => '128'), 'tsp'), - 'TEASPOON_US' => array(array('' => '453.59237', '/' => '96'), 'tsp'), - 'TABLESPOON' => array(array('' => '1.2503332', '' => '453.59237', '/' => '32'), 'tbsp'), - 'TABLESPOON_US' => array(array('' => '453.59237', '/' => '32'), 'tbsp'), + protected $_units = [ + 'HALF_STICK' => [['' => '453.59237', '/' => '8'], 'half stk'], + 'STICK' => [['' => '453.59237', '/' => '4'], 'stk'], + 'CUP' => [['' => '453.59237', '/' => '2'], 'c'], + 'GRAM' => ['1', 'g'], + 'OUNCE' => [['' => '453.59237', '/' => '16'], 'oz'], + 'POUND' => ['453.59237', 'lb'], + 'TEASPOON' => [['' => '1.2503332', '' => '453.59237', '/' => '128'], 'tsp'], + 'TEASPOON_US' => [['' => '453.59237', '/' => '96'], 'tsp'], + 'TABLESPOON' => [['' => '1.2503332', '' => '453.59237', '/' => '32'], 'tbsp'], + 'TABLESPOON_US' => [['' => '453.59237', '/' => '32'], 'tbsp'], 'STANDARD' => 'GRAM' - ); + ]; } diff --git a/library/Zend/Measure/Current.php b/library/Zend/Measure/Current.php index 177fe6e0a6..b14f37a8d2 100644 --- a/library/Zend/Measure/Current.php +++ b/library/Zend/Measure/Current.php @@ -70,33 +70,33 @@ class Zend_Measure_Current extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ABAMPERE' => array('10', 'abampere'), - 'AMPERE' => array('1', 'A'), - 'BIOT' => array('10', 'Bi'), - 'CENTIAMPERE' => array('0.01', 'cA'), - 'COULOMB_PER_SECOND' => array('1', 'C/s'), - 'DECIAMPERE' => array('0.1', 'dA'), - 'DEKAAMPERE' => array('10', 'daA'), - 'ELECTROMAGNATIC_UNIT' => array('10', 'current emu'), - 'ELECTROSTATIC_UNIT' => array('3.335641e-10', 'current esu'), - 'FRANCLIN_PER_SECOND' => array('3.335641e-10', 'Fr/s'), - 'GAUSSIAN' => array('3.335641e-10', 'G current'), - 'GIGAAMPERE' => array('1.0e+9', 'GA'), - 'GILBERT' => array('0.79577472', 'Gi'), - 'HECTOAMPERE' => array('100', 'hA'), - 'KILOAMPERE' => array('1000', 'kA'), - 'MEGAAMPERE' => array('1000000', 'MA') , - 'MICROAMPERE' => array('0.000001', 'µA'), - 'MILLIAMPERE' => array('0.001', 'mA'), - 'NANOAMPERE' => array('1.0e-9', 'nA'), - 'PICOAMPERE' => array('1.0e-12', 'pA'), - 'SIEMENS_VOLT' => array('1', 'SV'), - 'STATAMPERE' => array('3.335641e-10', 'statampere'), - 'TERAAMPERE' => array('1.0e+12', 'TA'), - 'VOLT_PER_OHM' => array('1', 'V/Ohm'), - 'WATT_PER_VOLT' => array('1', 'W/V'), - 'WEBER_PER_HENRY' => array('1', 'Wb/H'), + protected $_units = [ + 'ABAMPERE' => ['10', 'abampere'], + 'AMPERE' => ['1', 'A'], + 'BIOT' => ['10', 'Bi'], + 'CENTIAMPERE' => ['0.01', 'cA'], + 'COULOMB_PER_SECOND' => ['1', 'C/s'], + 'DECIAMPERE' => ['0.1', 'dA'], + 'DEKAAMPERE' => ['10', 'daA'], + 'ELECTROMAGNATIC_UNIT' => ['10', 'current emu'], + 'ELECTROSTATIC_UNIT' => ['3.335641e-10', 'current esu'], + 'FRANCLIN_PER_SECOND' => ['3.335641e-10', 'Fr/s'], + 'GAUSSIAN' => ['3.335641e-10', 'G current'], + 'GIGAAMPERE' => ['1.0e+9', 'GA'], + 'GILBERT' => ['0.79577472', 'Gi'], + 'HECTOAMPERE' => ['100', 'hA'], + 'KILOAMPERE' => ['1000', 'kA'], + 'MEGAAMPERE' => ['1000000', 'MA'] , + 'MICROAMPERE' => ['0.000001', 'µA'], + 'MILLIAMPERE' => ['0.001', 'mA'], + 'NANOAMPERE' => ['1.0e-9', 'nA'], + 'PICOAMPERE' => ['1.0e-12', 'pA'], + 'SIEMENS_VOLT' => ['1', 'SV'], + 'STATAMPERE' => ['3.335641e-10', 'statampere'], + 'TERAAMPERE' => ['1.0e+12', 'TA'], + 'VOLT_PER_OHM' => ['1', 'V/Ohm'], + 'WATT_PER_VOLT' => ['1', 'W/V'], + 'WEBER_PER_HENRY' => ['1', 'Wb/H'], 'STANDARD' => 'AMPERE' - ); + ]; } diff --git a/library/Zend/Measure/Density.php b/library/Zend/Measure/Density.php index f7023bb0d8..8742edf35a 100644 --- a/library/Zend/Measure/Density.php +++ b/library/Zend/Measure/Density.php @@ -122,85 +122,85 @@ class Zend_Measure_Density extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ALUMINIUM' => array('2643', 'aluminium'), - 'COPPER' => array('8906', 'copper'), - 'GOLD' => array('19300', 'gold'), - 'GRAIN_PER_CUBIC_FOOT' => array('0.0022883519', 'gr/ft³'), - 'GRAIN_PER_CUBIC_INCH' => array('3.9542721', 'gr/in³'), - 'GRAIN_PER_CUBIC_YARD' => array('0.000084753774', 'gr/yd³'), - 'GRAIN_PER_GALLON' => array('0.014253768', 'gr/gal'), - 'GRAIN_PER_GALLON_US' => array('0.017118061', 'gr/gal'), - 'GRAM_PER_CUBIC_CENTIMETER' => array('1000', 'g/cm³'), - 'GRAM_PER_CUBIC_DECIMETER' => array('1', 'g/dm³'), - 'GRAM_PER_CUBIC_METER' => array('0.001', 'g/m³'), - 'GRAM_PER_LITER' => array('1', 'g/l'), - 'GRAM_PER_MILLILITER' => array('1000', 'g/ml'), - 'IRON' => array('7658', 'iron'), - 'KILOGRAM_PER_CUBIC_CENTIMETER' => array('1000000', 'kg/cm³'), - 'KILOGRAM_PER_CUBIC_DECIMETER' => array('1000', 'kg/dm³'), - 'KILOGRAM_PER_CUBIC_METER' => array('1', 'kg/m³'), - 'KILOGRAM_PER_CUBIC_MILLIMETER' => array('1000000000', 'kg/l'), - 'KILOGRAM_PER_LITER' => array('1000', 'kg/ml'), - 'KILOGRAM_PER_MILLILITER' => array('1000000', 'kg/ml'), - 'LEAD' => array('11370', 'lead'), - 'MEGAGRAM_PER_CUBIC_CENTIMETER' => array('1.0e+9', 'Mg/cm³'), - 'MEGAGRAM_PER_CUBIC_DECIMETER' => array('1000000', 'Mg/dm³'), - 'MEGAGRAM_PER_CUBIC_METER' => array('1000', 'Mg/m³'), - 'MEGAGRAM_PER_LITER' => array('1000000', 'Mg/l'), - 'MEGAGRAM_PER_MILLILITER' => array('1.0e+9', 'Mg/ml'), - 'MICROGRAM_PER_CUBIC_CENTIMETER' => array('0.001', 'µg/cm³'), - 'MICROGRAM_PER_CUBIC_DECIMETER' => array('1.0e-6', 'µg/dm³'), - 'MICROGRAM_PER_CUBIC_METER' => array('1.0e-9', 'µg/m³'), - 'MICROGRAM_PER_LITER' => array('1.0e-6', 'µg/l'), - 'MICROGRAM_PER_MILLILITER' => array('0.001', 'µg/ml'), - 'MILLIGRAM_PER_CUBIC_CENTIMETER' => array('1', 'mg/cm³'), - 'MILLIGRAM_PER_CUBIC_DECIMETER' => array('0.001', 'mg/dm³'), - 'MILLIGRAM_PER_CUBIC_METER' => array('0.000001', 'mg/m³'), - 'MILLIGRAM_PER_LITER' => array('0.001', 'mg/l'), - 'MILLIGRAM_PER_MILLILITER' => array('1', 'mg/ml'), - 'OUNCE_PER_CUBIC_FOOT' => array('1.001154', 'oz/ft³'), - 'OUNCE_PER_CUBIC_FOOT_TROY' => array('1.0984089', 'oz/ft³'), - 'OUNCE_PER_CUBIC_INCH' => array('1729.994', 'oz/in³'), - 'OUNCE_PER_CUBIC_INCH_TROY' => array('1898.0506', 'oz/in³'), - 'OUNCE_PER_CUBIC_YARD' => array('0.037079776', 'oz/yd³'), - 'OUNCE_PER_CUBIC_YARD_TROY' => array('0.040681812', 'oz/yd³'), - 'OUNCE_PER_GALLON' => array('6.2360233', 'oz/gal'), - 'OUNCE_PER_GALLON_US' => array('7.4891517', 'oz/gal'), - 'OUNCE_PER_GALLON_TROY' => array('6.8418084', 'oz/gal'), - 'OUNCE_PER_GALLON_US_TROY' => array('8.2166693', 'oz/gal'), - 'POUND_PER_CIRCULAR_MIL_FOOT' => array('2.9369291', 'lb/cmil ft'), - 'POUND_PER_CUBIC_FOOT' => array('16.018463', 'lb/in³'), - 'POUND_PER_CUBIC_INCH' => array('27679.905', 'lb/in³'), - 'POUND_PER_CUBIC_YARD' => array('0.59327642', 'lb/yd³'), - 'POUND_PER_GALLON' => array('99.776373', 'lb/gal'), - 'POUND_PER_KILOGALLON' => array('0.099776373', 'lb/kgal'), - 'POUND_PER_MEGAGALLON' => array('0.000099776373', 'lb/Mgal'), - 'POUND_PER_GALLON_US' => array('119.82643', 'lb/gal'), - 'POUND_PER_KILOGALLON_US' => array('0.11982643', 'lb/kgal'), - 'POUND_PER_MEGAGALLON_US' => array('0.00011982643', 'lb/Mgal'), - 'SILVER' => array('10510', 'silver'), - 'SLUG_PER_CUBIC_FOOT' => array('515.37882', 'slug/ft³'), - 'SLUG_PER_CUBIC_INCH' => array('890574.6', 'slug/in³'), - 'SLUG_PER_CUBIC_YARD' => array('19.088104', 'slug/yd³'), - 'SLUG_PER_GALLON' => array('3210.2099', 'slug/gal'), - 'SLUG_PER_GALLON_US' => array('3855.3013', 'slug/gal'), - 'TON_PER_CUBIC_FOOT_LONG' => array('35881.358', 't/ft³'), - 'TON_PER_CUBIC_FOOT' => array('32036.927', 't/ft³'), - 'TON_PER_CUBIC_INCH_LONG' => array('6.2202987e+7', 't/in³'), - 'TON_PER_CUBIC_INCH' => array('5.5359809e+7', 't/in³'), - 'TON_PER_CUBIC_YARD_LONG' => array('1328.9392', 't/yd³'), - 'TON_PER_CUBIC_YARD' => array('1186.5528', 't/yd³'), - 'TON_PER_GALLON_LONG' => array('223499.07', 't/gal'), - 'TON_PER_GALLON_US_LONG' => array('268411.2', 't/gal'), - 'TON_PER_GALLON' => array('199522.75', 't/gal'), - 'TON_PER_GALLON_US' => array('239652.85', 't/gal'), - 'TONNE_PER_CUBIC_CENTIMETER' => array('1.0e+9', 't/cm³'), - 'TONNE_PER_CUBIC_DECIMETER' => array('1000000', 't/dm³'), - 'TONNE_PER_CUBIC_METER' => array('1000', 't/m³'), - 'TONNE_PER_LITER' => array('1000000', 't/l'), - 'TONNE_PER_MILLILITER' => array('1.0e+9', 't/ml'), - 'WATER' => array('1000', 'water'), + protected $_units = [ + 'ALUMINIUM' => ['2643', 'aluminium'], + 'COPPER' => ['8906', 'copper'], + 'GOLD' => ['19300', 'gold'], + 'GRAIN_PER_CUBIC_FOOT' => ['0.0022883519', 'gr/ft³'], + 'GRAIN_PER_CUBIC_INCH' => ['3.9542721', 'gr/in³'], + 'GRAIN_PER_CUBIC_YARD' => ['0.000084753774', 'gr/yd³'], + 'GRAIN_PER_GALLON' => ['0.014253768', 'gr/gal'], + 'GRAIN_PER_GALLON_US' => ['0.017118061', 'gr/gal'], + 'GRAM_PER_CUBIC_CENTIMETER' => ['1000', 'g/cm³'], + 'GRAM_PER_CUBIC_DECIMETER' => ['1', 'g/dm³'], + 'GRAM_PER_CUBIC_METER' => ['0.001', 'g/m³'], + 'GRAM_PER_LITER' => ['1', 'g/l'], + 'GRAM_PER_MILLILITER' => ['1000', 'g/ml'], + 'IRON' => ['7658', 'iron'], + 'KILOGRAM_PER_CUBIC_CENTIMETER' => ['1000000', 'kg/cm³'], + 'KILOGRAM_PER_CUBIC_DECIMETER' => ['1000', 'kg/dm³'], + 'KILOGRAM_PER_CUBIC_METER' => ['1', 'kg/m³'], + 'KILOGRAM_PER_CUBIC_MILLIMETER' => ['1000000000', 'kg/l'], + 'KILOGRAM_PER_LITER' => ['1000', 'kg/ml'], + 'KILOGRAM_PER_MILLILITER' => ['1000000', 'kg/ml'], + 'LEAD' => ['11370', 'lead'], + 'MEGAGRAM_PER_CUBIC_CENTIMETER' => ['1.0e+9', 'Mg/cm³'], + 'MEGAGRAM_PER_CUBIC_DECIMETER' => ['1000000', 'Mg/dm³'], + 'MEGAGRAM_PER_CUBIC_METER' => ['1000', 'Mg/m³'], + 'MEGAGRAM_PER_LITER' => ['1000000', 'Mg/l'], + 'MEGAGRAM_PER_MILLILITER' => ['1.0e+9', 'Mg/ml'], + 'MICROGRAM_PER_CUBIC_CENTIMETER' => ['0.001', 'µg/cm³'], + 'MICROGRAM_PER_CUBIC_DECIMETER' => ['1.0e-6', 'µg/dm³'], + 'MICROGRAM_PER_CUBIC_METER' => ['1.0e-9', 'µg/m³'], + 'MICROGRAM_PER_LITER' => ['1.0e-6', 'µg/l'], + 'MICROGRAM_PER_MILLILITER' => ['0.001', 'µg/ml'], + 'MILLIGRAM_PER_CUBIC_CENTIMETER' => ['1', 'mg/cm³'], + 'MILLIGRAM_PER_CUBIC_DECIMETER' => ['0.001', 'mg/dm³'], + 'MILLIGRAM_PER_CUBIC_METER' => ['0.000001', 'mg/m³'], + 'MILLIGRAM_PER_LITER' => ['0.001', 'mg/l'], + 'MILLIGRAM_PER_MILLILITER' => ['1', 'mg/ml'], + 'OUNCE_PER_CUBIC_FOOT' => ['1.001154', 'oz/ft³'], + 'OUNCE_PER_CUBIC_FOOT_TROY' => ['1.0984089', 'oz/ft³'], + 'OUNCE_PER_CUBIC_INCH' => ['1729.994', 'oz/in³'], + 'OUNCE_PER_CUBIC_INCH_TROY' => ['1898.0506', 'oz/in³'], + 'OUNCE_PER_CUBIC_YARD' => ['0.037079776', 'oz/yd³'], + 'OUNCE_PER_CUBIC_YARD_TROY' => ['0.040681812', 'oz/yd³'], + 'OUNCE_PER_GALLON' => ['6.2360233', 'oz/gal'], + 'OUNCE_PER_GALLON_US' => ['7.4891517', 'oz/gal'], + 'OUNCE_PER_GALLON_TROY' => ['6.8418084', 'oz/gal'], + 'OUNCE_PER_GALLON_US_TROY' => ['8.2166693', 'oz/gal'], + 'POUND_PER_CIRCULAR_MIL_FOOT' => ['2.9369291', 'lb/cmil ft'], + 'POUND_PER_CUBIC_FOOT' => ['16.018463', 'lb/in³'], + 'POUND_PER_CUBIC_INCH' => ['27679.905', 'lb/in³'], + 'POUND_PER_CUBIC_YARD' => ['0.59327642', 'lb/yd³'], + 'POUND_PER_GALLON' => ['99.776373', 'lb/gal'], + 'POUND_PER_KILOGALLON' => ['0.099776373', 'lb/kgal'], + 'POUND_PER_MEGAGALLON' => ['0.000099776373', 'lb/Mgal'], + 'POUND_PER_GALLON_US' => ['119.82643', 'lb/gal'], + 'POUND_PER_KILOGALLON_US' => ['0.11982643', 'lb/kgal'], + 'POUND_PER_MEGAGALLON_US' => ['0.00011982643', 'lb/Mgal'], + 'SILVER' => ['10510', 'silver'], + 'SLUG_PER_CUBIC_FOOT' => ['515.37882', 'slug/ft³'], + 'SLUG_PER_CUBIC_INCH' => ['890574.6', 'slug/in³'], + 'SLUG_PER_CUBIC_YARD' => ['19.088104', 'slug/yd³'], + 'SLUG_PER_GALLON' => ['3210.2099', 'slug/gal'], + 'SLUG_PER_GALLON_US' => ['3855.3013', 'slug/gal'], + 'TON_PER_CUBIC_FOOT_LONG' => ['35881.358', 't/ft³'], + 'TON_PER_CUBIC_FOOT' => ['32036.927', 't/ft³'], + 'TON_PER_CUBIC_INCH_LONG' => ['6.2202987e+7', 't/in³'], + 'TON_PER_CUBIC_INCH' => ['5.5359809e+7', 't/in³'], + 'TON_PER_CUBIC_YARD_LONG' => ['1328.9392', 't/yd³'], + 'TON_PER_CUBIC_YARD' => ['1186.5528', 't/yd³'], + 'TON_PER_GALLON_LONG' => ['223499.07', 't/gal'], + 'TON_PER_GALLON_US_LONG' => ['268411.2', 't/gal'], + 'TON_PER_GALLON' => ['199522.75', 't/gal'], + 'TON_PER_GALLON_US' => ['239652.85', 't/gal'], + 'TONNE_PER_CUBIC_CENTIMETER' => ['1.0e+9', 't/cm³'], + 'TONNE_PER_CUBIC_DECIMETER' => ['1000000', 't/dm³'], + 'TONNE_PER_CUBIC_METER' => ['1000', 't/m³'], + 'TONNE_PER_LITER' => ['1000000', 't/l'], + 'TONNE_PER_MILLILITER' => ['1.0e+9', 't/ml'], + 'WATER' => ['1000', 'water'], 'STANDARD' => 'KILOGRAM_PER_CUBIC_METER' - ); + ]; } diff --git a/library/Zend/Measure/Energy.php b/library/Zend/Measure/Energy.php index 9a3049668e..30cf94cbb6 100644 --- a/library/Zend/Measure/Energy.php +++ b/library/Zend/Measure/Energy.php @@ -145,108 +145,108 @@ class Zend_Measure_Energy extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ATTOJOULE' => array('1.0e-18', 'aJ'), - 'BOARD_OF_TRADE_UNIT' => array('3600000', 'BOTU'), - 'BTU' => array('1055.0559', 'Btu'), - 'BTU_TERMOCHEMICAL' => array('1054.3503', 'Btu'), - 'CALORIE' => array('4.1868', 'cal'), - 'CALORIE_15C' => array('6.1858', 'cal'), - 'CALORIE_NUTRITIONAL' => array('4186.8', 'cal'), - 'CALORIE_THERMOCHEMICAL' => array('4.184', 'cal'), - 'CELSIUS_HEAT_UNIT' => array('1899.1005', 'Chu'), - 'CENTIJOULE' => array('0.01', 'cJ'), - 'CHEVAL_VAPEUR_HEURE' => array('2647795.5', 'cv heure'), - 'DECIJOULE' => array('0.1', 'dJ'), - 'DEKAJOULE' => array('10', 'daJ'), - 'DEKAWATT_HOUR' => array('36000', 'daWh'), - 'DEKATHERM' => array('1.055057e+9', 'dathm'), - 'ELECTRONVOLT' => array('1.6021773e-19', 'eV'), - 'ERG' => array('0.0000001', 'erg'), - 'EXAJOULE' => array('1.0e+18', 'EJ'), - 'EXAWATT_HOUR' => array('3.6e+21', 'EWh'), - 'FEMTOJOULE' => array('1.0e-15', 'fJ'), - 'FOOT_POUND' => array('1.3558179', 'ft lb'), - 'FOOT_POUNDAL' => array('0.04214011', 'ft poundal'), - 'GALLON_UK_AUTOMOTIVE' => array('158237172', 'gal car gasoline'), - 'GALLON_US_AUTOMOTIVE' => array('131760000', 'gal car gasoline'), - 'GALLON_UK_AVIATION' => array('158237172', 'gal jet gasoline'), - 'GALLON_US_AVIATION' => array('131760000', 'gal jet gasoline'), - 'GALLON_UK_DIESEL' => array('175963194', 'gal diesel'), - 'GALLON_US_DIESEL' => array('146520000', 'gal diesel'), - 'GALLON_UK_DISTILATE' => array('175963194', 'gal destilate fuel'), - 'GALLON_US_DISTILATE' => array('146520000', 'gal destilate fuel'), - 'GALLON_UK_KEROSINE_JET' => array('170775090', 'gal jet kerosine'), - 'GALLON_US_KEROSINE_JET' => array('142200000', 'gal jet kerosine'), - 'GALLON_UK_LPG' => array('121005126.0865275', 'gal lpg'), - 'GALLON_US_LPG' => array('100757838.45', 'gal lpg'), - 'GALLON_UK_NAPHTA' => array('160831224', 'gal jet fuel'), - 'GALLON_US_NAPHTA' => array('133920000', 'gal jet fuel'), - 'GALLON_UK_KEROSINE' => array('170775090', 'gal kerosine'), - 'GALLON_US_KEROSINE' => array('142200000', 'gal kerosine'), - 'GALLON_UK_RESIDUAL' => array('189798138', 'gal residual fuel'), - 'GALLON_US_RESIDUAL' => array('158040000', 'gal residual fuel'), - 'GIGAELECTRONVOLT' => array('1.6021773e-10', 'GeV'), - 'GIGACALORIE' => array('4186800000', 'Gcal'), - 'GIGACALORIE_15C' => array('4185800000', 'Gcal'), - 'GIGAJOULE' => array('1.0e+9', 'GJ'), - 'GIGAWATT_HOUR' => array('3.6e+12', 'GWh'), - 'GRAM_CALORIE' => array('4.1858', 'g cal'), - 'HARTREE' => array('4.3597482e-18', 'Eh'), - 'HECTOJOULE' => array('100', 'hJ'), - 'HECTOWATT_HOUR' => array('360000', 'hWh'), - 'HORSEPOWER_HOUR' => array('2684519.5', 'hph'), - 'HUNDRED_CUBIC_FOOT_GAS' => array('108720000', 'hundred ft� gas'), - 'INCH_OUNCE' => array('0.0070615518', 'in oc'), - 'INCH_POUND' => array('0.112984825', 'in lb'), - 'JOULE' => array('1', 'J'), - 'KILOCALORIE_15C' => array('4185.8', 'kcal'), - 'KILOCALORIE' => array('4186','8', 'kcal'), - 'KILOCALORIE_THERMOCHEMICAL' => array('4184', 'kcal'), - 'KILOELECTRONVOLT' => array('1.6021773e-16', 'keV'), - 'KILOGRAM_CALORIE' => array('4185.8', 'kg cal'), - 'KILOGRAM_FORCE_METER' => array('9.80665', 'kgf m'), - 'KILOJOULE' => array('1000', 'kJ'), - 'KILOPOND_METER' => array('9.80665', 'kp m'), - 'KILOTON' => array('4.184e+12', 'kt'), - 'KILOWATT_HOUR' => array('3600000', 'kWh'), - 'LITER_ATMOSPHERE' => array('101.325', 'l atm'), - 'MEGAELECTRONVOLT' => array('1.6021773e-13', 'MeV'), - 'MEGACALORIE' => array('4186800', 'Mcal'), - 'MEGACALORIE_15C' => array('4185800', 'Mcal'), - 'MEGAJOULE' => array('1000000', 'MJ'), - 'MEGALERG' => array('0.1', 'megalerg'), - 'MEGATON' => array('4.184e+15', 'Mt'), - 'MEGAWATTHOUR' => array('3.6e+9', 'MWh'), - 'METER_KILOGRAM_FORCE' => array('9.80665', 'm kgf'), - 'MICROJOULE' => array('0.000001', '�J'), - 'MILLIJOULE' => array('0.001', 'mJ'), - 'MYRIAWATT_HOUR' => array('3.6e+7', 'myWh'), - 'NANOJOULE' => array('1.0e-9', 'nJ'), - 'NEWTON_METER' => array('1', 'Nm'), - 'PETAJOULE' => array('1.0e+15', 'PJ'), - 'PETAWATTHOUR' => array('3.6e+18', 'PWh'), - 'PFERDESTAERKENSTUNDE' => array('2647795.5', 'ps h'), - 'PICOJOULE' => array('1.0e-12', 'pJ'), - 'Q_UNIT' => array('1.0550559e+21', 'Q unit'), - 'QUAD' => array('1.0550559e+18', 'quad'), - 'TERAELECTRONVOLT' => array('1.6021773e-7', 'TeV'), - 'TERAJOULE' => array('1.0e+12', 'TJ'), - 'TERAWATTHOUR' => array('3.6e+15', 'TWh'), - 'THERM' => array('1.0550559e+8', 'thm'), - 'THERM_US' => array('1.054804e+8', 'thm'), - 'THERMIE' => array('4185800', 'th'), - 'TON' => array('4.184e+9', 'T explosive'), - 'TONNE_COAL' => array('2.93076e+10', 'T coal'), - 'TONNE_OIL' => array('4.1868e+10', 'T oil'), - 'WATTHOUR' => array('3600', 'Wh'), - 'WATTSECOND' => array('1', 'Ws'), - 'YOCTOJOULE' => array('1.0e-24', 'yJ'), - 'YOTTAJOULE' => array('1.0e+24', 'YJ'), - 'YOTTAWATTHOUR' => array('3.6e+27', 'YWh'), - 'ZEPTOJOULE' => array('1.0e-21', 'zJ'), - 'ZETTAJOULE' => array('1.0e+21', 'ZJ'), - 'ZETTAWATTHOUR' => array('3.6e+24', 'ZWh'), + protected $_units = [ + 'ATTOJOULE' => ['1.0e-18', 'aJ'], + 'BOARD_OF_TRADE_UNIT' => ['3600000', 'BOTU'], + 'BTU' => ['1055.0559', 'Btu'], + 'BTU_TERMOCHEMICAL' => ['1054.3503', 'Btu'], + 'CALORIE' => ['4.1868', 'cal'], + 'CALORIE_15C' => ['6.1858', 'cal'], + 'CALORIE_NUTRITIONAL' => ['4186.8', 'cal'], + 'CALORIE_THERMOCHEMICAL' => ['4.184', 'cal'], + 'CELSIUS_HEAT_UNIT' => ['1899.1005', 'Chu'], + 'CENTIJOULE' => ['0.01', 'cJ'], + 'CHEVAL_VAPEUR_HEURE' => ['2647795.5', 'cv heure'], + 'DECIJOULE' => ['0.1', 'dJ'], + 'DEKAJOULE' => ['10', 'daJ'], + 'DEKAWATT_HOUR' => ['36000', 'daWh'], + 'DEKATHERM' => ['1.055057e+9', 'dathm'], + 'ELECTRONVOLT' => ['1.6021773e-19', 'eV'], + 'ERG' => ['0.0000001', 'erg'], + 'EXAJOULE' => ['1.0e+18', 'EJ'], + 'EXAWATT_HOUR' => ['3.6e+21', 'EWh'], + 'FEMTOJOULE' => ['1.0e-15', 'fJ'], + 'FOOT_POUND' => ['1.3558179', 'ft lb'], + 'FOOT_POUNDAL' => ['0.04214011', 'ft poundal'], + 'GALLON_UK_AUTOMOTIVE' => ['158237172', 'gal car gasoline'], + 'GALLON_US_AUTOMOTIVE' => ['131760000', 'gal car gasoline'], + 'GALLON_UK_AVIATION' => ['158237172', 'gal jet gasoline'], + 'GALLON_US_AVIATION' => ['131760000', 'gal jet gasoline'], + 'GALLON_UK_DIESEL' => ['175963194', 'gal diesel'], + 'GALLON_US_DIESEL' => ['146520000', 'gal diesel'], + 'GALLON_UK_DISTILATE' => ['175963194', 'gal destilate fuel'], + 'GALLON_US_DISTILATE' => ['146520000', 'gal destilate fuel'], + 'GALLON_UK_KEROSINE_JET' => ['170775090', 'gal jet kerosine'], + 'GALLON_US_KEROSINE_JET' => ['142200000', 'gal jet kerosine'], + 'GALLON_UK_LPG' => ['121005126.0865275', 'gal lpg'], + 'GALLON_US_LPG' => ['100757838.45', 'gal lpg'], + 'GALLON_UK_NAPHTA' => ['160831224', 'gal jet fuel'], + 'GALLON_US_NAPHTA' => ['133920000', 'gal jet fuel'], + 'GALLON_UK_KEROSINE' => ['170775090', 'gal kerosine'], + 'GALLON_US_KEROSINE' => ['142200000', 'gal kerosine'], + 'GALLON_UK_RESIDUAL' => ['189798138', 'gal residual fuel'], + 'GALLON_US_RESIDUAL' => ['158040000', 'gal residual fuel'], + 'GIGAELECTRONVOLT' => ['1.6021773e-10', 'GeV'], + 'GIGACALORIE' => ['4186800000', 'Gcal'], + 'GIGACALORIE_15C' => ['4185800000', 'Gcal'], + 'GIGAJOULE' => ['1.0e+9', 'GJ'], + 'GIGAWATT_HOUR' => ['3.6e+12', 'GWh'], + 'GRAM_CALORIE' => ['4.1858', 'g cal'], + 'HARTREE' => ['4.3597482e-18', 'Eh'], + 'HECTOJOULE' => ['100', 'hJ'], + 'HECTOWATT_HOUR' => ['360000', 'hWh'], + 'HORSEPOWER_HOUR' => ['2684519.5', 'hph'], + 'HUNDRED_CUBIC_FOOT_GAS' => ['108720000', 'hundred ft� gas'], + 'INCH_OUNCE' => ['0.0070615518', 'in oc'], + 'INCH_POUND' => ['0.112984825', 'in lb'], + 'JOULE' => ['1', 'J'], + 'KILOCALORIE_15C' => ['4185.8', 'kcal'], + 'KILOCALORIE' => ['4186','8', 'kcal'], + 'KILOCALORIE_THERMOCHEMICAL' => ['4184', 'kcal'], + 'KILOELECTRONVOLT' => ['1.6021773e-16', 'keV'], + 'KILOGRAM_CALORIE' => ['4185.8', 'kg cal'], + 'KILOGRAM_FORCE_METER' => ['9.80665', 'kgf m'], + 'KILOJOULE' => ['1000', 'kJ'], + 'KILOPOND_METER' => ['9.80665', 'kp m'], + 'KILOTON' => ['4.184e+12', 'kt'], + 'KILOWATT_HOUR' => ['3600000', 'kWh'], + 'LITER_ATMOSPHERE' => ['101.325', 'l atm'], + 'MEGAELECTRONVOLT' => ['1.6021773e-13', 'MeV'], + 'MEGACALORIE' => ['4186800', 'Mcal'], + 'MEGACALORIE_15C' => ['4185800', 'Mcal'], + 'MEGAJOULE' => ['1000000', 'MJ'], + 'MEGALERG' => ['0.1', 'megalerg'], + 'MEGATON' => ['4.184e+15', 'Mt'], + 'MEGAWATTHOUR' => ['3.6e+9', 'MWh'], + 'METER_KILOGRAM_FORCE' => ['9.80665', 'm kgf'], + 'MICROJOULE' => ['0.000001', '�J'], + 'MILLIJOULE' => ['0.001', 'mJ'], + 'MYRIAWATT_HOUR' => ['3.6e+7', 'myWh'], + 'NANOJOULE' => ['1.0e-9', 'nJ'], + 'NEWTON_METER' => ['1', 'Nm'], + 'PETAJOULE' => ['1.0e+15', 'PJ'], + 'PETAWATTHOUR' => ['3.6e+18', 'PWh'], + 'PFERDESTAERKENSTUNDE' => ['2647795.5', 'ps h'], + 'PICOJOULE' => ['1.0e-12', 'pJ'], + 'Q_UNIT' => ['1.0550559e+21', 'Q unit'], + 'QUAD' => ['1.0550559e+18', 'quad'], + 'TERAELECTRONVOLT' => ['1.6021773e-7', 'TeV'], + 'TERAJOULE' => ['1.0e+12', 'TJ'], + 'TERAWATTHOUR' => ['3.6e+15', 'TWh'], + 'THERM' => ['1.0550559e+8', 'thm'], + 'THERM_US' => ['1.054804e+8', 'thm'], + 'THERMIE' => ['4185800', 'th'], + 'TON' => ['4.184e+9', 'T explosive'], + 'TONNE_COAL' => ['2.93076e+10', 'T coal'], + 'TONNE_OIL' => ['4.1868e+10', 'T oil'], + 'WATTHOUR' => ['3600', 'Wh'], + 'WATTSECOND' => ['1', 'Ws'], + 'YOCTOJOULE' => ['1.0e-24', 'yJ'], + 'YOTTAJOULE' => ['1.0e+24', 'YJ'], + 'YOTTAWATTHOUR' => ['3.6e+27', 'YWh'], + 'ZEPTOJOULE' => ['1.0e-21', 'zJ'], + 'ZETTAJOULE' => ['1.0e+21', 'ZJ'], + 'ZETTAWATTHOUR' => ['3.6e+24', 'ZWh'], 'STANDARD' => 'JOULE' - ); + ]; } diff --git a/library/Zend/Measure/Flow/Mass.php b/library/Zend/Measure/Flow/Mass.php index ae68e2943e..4ccc6f4097 100644 --- a/library/Zend/Measure/Flow/Mass.php +++ b/library/Zend/Measure/Flow/Mass.php @@ -80,43 +80,43 @@ class Zend_Measure_Flow_Mass extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'CENTIGRAM_PER_DAY' => array(array('' => '0.00001', '/' => '86400'), 'cg/day'), - 'CENTIGRAM_PER_HOUR' => array(array('' => '0.00001', '/' => '3600'), 'cg/h'), - 'CENTIGRAM_PER_MINUTE' => array(array('' => '0.00001', '/' => '60'), 'cg/m'), - 'CENTIGRAM_PER_SECOND' => array('0.00001', 'cg/s'), - 'GRAM_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'g/day'), - 'GRAM_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'g/h'), - 'GRAM_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'g/m'), - 'GRAM_PER_SECOND' => array('0.001', 'g/s'), - 'KILOGRAM_PER_DAY' => array(array('' => '1', '/' => '86400'), 'kg/day'), - 'KILOGRAM_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'kg/h'), - 'KILOGRAM_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'kg/m'), - 'KILOGRAM_PER_SECOND' => array('1', 'kg/s'), - 'MILLIGRAM_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'mg/day'), - 'MILLIGRAM_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'mg/h'), - 'MILLIGRAM_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'mg/m'), - 'MILLIGRAM_PER_SECOND' => array('0.000001', 'mg/s'), - 'OUNCE_PER_DAY' => array(array('' => '0.0283495', '/' => '86400'), 'oz/day'), - 'OUNCE_PER_HOUR' => array(array('' => '0.0283495', '/' => '3600'), 'oz/h'), - 'OUNCE_PER_MINUTE' => array(array('' => '0.0283495', '/' => '60'), 'oz/m'), - 'OUNCE_PER_SECOND' => array('0.0283495', 'oz/s'), - 'POUND_PER_DAY' => array(array('' => '0.453592', '/' => '86400'), 'lb/day'), - 'POUND_PER_HOUR' => array(array('' => '0.453592', '/' => '3600'), 'lb/h'), - 'POUND_PER_MINUTE' => array(array('' => '0.453592', '/' => '60'), 'lb/m'), - 'POUND_PER_SECOND' => array('0.453592', 'lb/s'), - 'TON_LONG_PER_DAY' => array(array('' => '1016.04608', '/' => '86400'), 't/day'), - 'TON_LONG_PER_HOUR' => array(array('' => '1016.04608', '/' => '3600'), 't/h'), - 'TON_LONG_PER_MINUTE' => array(array('' => '1016.04608', '/' => '60'), 't/m'), - 'TON_LONG_PER_SECOND' => array('1016.04608', 't/s'), - 'TON_PER_DAY' => array(array('' => '1000', '/' => '86400'), 't/day'), - 'TON_PER_HOUR' => array(array('' => '1000', '/' => '3600'), 't/h'), - 'TON_PER_MINUTE' => array(array('' => '1000', '/' => '60'), 't/m'), - 'TON_PER_SECOND' => array('1000', 't/s'), - 'TON_SHORT_PER_DAY' => array(array('' => '907.184', '/' => '86400'), 't/day'), - 'TON_SHORT_PER_HOUR' => array(array('' => '907.184', '/' => '3600'), 't/h'), - 'TON_SHORT_PER_MINUTE' => array(array('' => '907.184', '/' => '60'), 't/m'), - 'TON_SHORT_PER_SECOND' => array('907.184', 't/s'), + protected $_units = [ + 'CENTIGRAM_PER_DAY' => [['' => '0.00001', '/' => '86400'], 'cg/day'], + 'CENTIGRAM_PER_HOUR' => [['' => '0.00001', '/' => '3600'], 'cg/h'], + 'CENTIGRAM_PER_MINUTE' => [['' => '0.00001', '/' => '60'], 'cg/m'], + 'CENTIGRAM_PER_SECOND' => ['0.00001', 'cg/s'], + 'GRAM_PER_DAY' => [['' => '0.001', '/' => '86400'], 'g/day'], + 'GRAM_PER_HOUR' => [['' => '0.001', '/' => '3600'], 'g/h'], + 'GRAM_PER_MINUTE' => [['' => '0.001', '/' => '60'], 'g/m'], + 'GRAM_PER_SECOND' => ['0.001', 'g/s'], + 'KILOGRAM_PER_DAY' => [['' => '1', '/' => '86400'], 'kg/day'], + 'KILOGRAM_PER_HOUR' => [['' => '1', '/' => '3600'], 'kg/h'], + 'KILOGRAM_PER_MINUTE' => [['' => '1', '/' => '60'], 'kg/m'], + 'KILOGRAM_PER_SECOND' => ['1', 'kg/s'], + 'MILLIGRAM_PER_DAY' => [['' => '0.000001', '/' => '86400'], 'mg/day'], + 'MILLIGRAM_PER_HOUR' => [['' => '0.000001', '/' => '3600'], 'mg/h'], + 'MILLIGRAM_PER_MINUTE' => [['' => '0.000001', '/' => '60'], 'mg/m'], + 'MILLIGRAM_PER_SECOND' => ['0.000001', 'mg/s'], + 'OUNCE_PER_DAY' => [['' => '0.0283495', '/' => '86400'], 'oz/day'], + 'OUNCE_PER_HOUR' => [['' => '0.0283495', '/' => '3600'], 'oz/h'], + 'OUNCE_PER_MINUTE' => [['' => '0.0283495', '/' => '60'], 'oz/m'], + 'OUNCE_PER_SECOND' => ['0.0283495', 'oz/s'], + 'POUND_PER_DAY' => [['' => '0.453592', '/' => '86400'], 'lb/day'], + 'POUND_PER_HOUR' => [['' => '0.453592', '/' => '3600'], 'lb/h'], + 'POUND_PER_MINUTE' => [['' => '0.453592', '/' => '60'], 'lb/m'], + 'POUND_PER_SECOND' => ['0.453592', 'lb/s'], + 'TON_LONG_PER_DAY' => [['' => '1016.04608', '/' => '86400'], 't/day'], + 'TON_LONG_PER_HOUR' => [['' => '1016.04608', '/' => '3600'], 't/h'], + 'TON_LONG_PER_MINUTE' => [['' => '1016.04608', '/' => '60'], 't/m'], + 'TON_LONG_PER_SECOND' => ['1016.04608', 't/s'], + 'TON_PER_DAY' => [['' => '1000', '/' => '86400'], 't/day'], + 'TON_PER_HOUR' => [['' => '1000', '/' => '3600'], 't/h'], + 'TON_PER_MINUTE' => [['' => '1000', '/' => '60'], 't/m'], + 'TON_PER_SECOND' => ['1000', 't/s'], + 'TON_SHORT_PER_DAY' => [['' => '907.184', '/' => '86400'], 't/day'], + 'TON_SHORT_PER_HOUR' => [['' => '907.184', '/' => '3600'], 't/h'], + 'TON_SHORT_PER_MINUTE' => [['' => '907.184', '/' => '60'], 't/m'], + 'TON_SHORT_PER_SECOND' => ['907.184', 't/s'], 'STANDARD' => 'KILOGRAM_PER_SECOND' - ); + ]; } diff --git a/library/Zend/Measure/Flow/Mole.php b/library/Zend/Measure/Flow/Mole.php index 86ac90397b..b99eb2966e 100644 --- a/library/Zend/Measure/Flow/Mole.php +++ b/library/Zend/Measure/Flow/Mole.php @@ -64,27 +64,27 @@ class Zend_Measure_Flow_Mole extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'CENTIMOLE_PER_DAY' => array(array('' => '0.01', '/' => '86400'), 'cmol/day'), - 'CENTIMOLE_PER_HOUR' => array(array('' => '0.01', '/' => '3600'), 'cmol/h'), - 'CENTIMOLE_PER_MINUTE' => array(array('' => '0.01', '/' => '60'), 'cmol/m'), - 'CENTIMOLE_PER_SECOND' => array('0.01', 'cmol/s'), - 'MEGAMOLE_PER_DAY' => array(array('' => '1000000', '/' => '86400'), 'Mmol/day'), - 'MEGAMOLE_PER_HOUR' => array(array('' => '1000000', '/' => '3600'), 'Mmol/h'), - 'MEGAMOLE_PER_MINUTE' => array(array('' => '1000000', '/' => '60'), 'Mmol/m'), - 'MEGAMOLE_PER_SECOND' => array('1000000', 'Mmol/s'), - 'MICROMOLE_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'µmol/day'), - 'MICROMOLE_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'µmol/h'), - 'MICROMOLE_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'µmol/m'), - 'MICROMOLE_PER_SECOND' => array('0.000001', 'µmol/s'), - 'MILLIMOLE_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'mmol/day'), - 'MILLIMOLE_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'mmol/h'), - 'MILLIMOLE_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'mmol/m'), - 'MILLIMOLE_PER_SECOND' => array('0.001', 'mmol/s'), - 'MOLE_PER_DAY' => array(array('' => '1', '/' => '86400'), 'mol/day'), - 'MOLE_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'mol/h'), - 'MOLE_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'mol/m'), - 'MOLE_PER_SECOND' => array('1', 'mol/s'), + protected $_units = [ + 'CENTIMOLE_PER_DAY' => [['' => '0.01', '/' => '86400'], 'cmol/day'], + 'CENTIMOLE_PER_HOUR' => [['' => '0.01', '/' => '3600'], 'cmol/h'], + 'CENTIMOLE_PER_MINUTE' => [['' => '0.01', '/' => '60'], 'cmol/m'], + 'CENTIMOLE_PER_SECOND' => ['0.01', 'cmol/s'], + 'MEGAMOLE_PER_DAY' => [['' => '1000000', '/' => '86400'], 'Mmol/day'], + 'MEGAMOLE_PER_HOUR' => [['' => '1000000', '/' => '3600'], 'Mmol/h'], + 'MEGAMOLE_PER_MINUTE' => [['' => '1000000', '/' => '60'], 'Mmol/m'], + 'MEGAMOLE_PER_SECOND' => ['1000000', 'Mmol/s'], + 'MICROMOLE_PER_DAY' => [['' => '0.000001', '/' => '86400'], 'µmol/day'], + 'MICROMOLE_PER_HOUR' => [['' => '0.000001', '/' => '3600'], 'µmol/h'], + 'MICROMOLE_PER_MINUTE' => [['' => '0.000001', '/' => '60'], 'µmol/m'], + 'MICROMOLE_PER_SECOND' => ['0.000001', 'µmol/s'], + 'MILLIMOLE_PER_DAY' => [['' => '0.001', '/' => '86400'], 'mmol/day'], + 'MILLIMOLE_PER_HOUR' => [['' => '0.001', '/' => '3600'], 'mmol/h'], + 'MILLIMOLE_PER_MINUTE' => [['' => '0.001', '/' => '60'], 'mmol/m'], + 'MILLIMOLE_PER_SECOND' => ['0.001', 'mmol/s'], + 'MOLE_PER_DAY' => [['' => '1', '/' => '86400'], 'mol/day'], + 'MOLE_PER_HOUR' => [['' => '1', '/' => '3600'], 'mol/h'], + 'MOLE_PER_MINUTE' => [['' => '1', '/' => '60'], 'mol/m'], + 'MOLE_PER_SECOND' => ['1', 'mol/s'], 'STANDARD' => 'MOLE_PER_SECOND' - ); + ]; } diff --git a/library/Zend/Measure/Flow/Volume.php b/library/Zend/Measure/Flow/Volume.php index d8d2572f25..bb7e4cc83f 100644 --- a/library/Zend/Measure/Flow/Volume.php +++ b/library/Zend/Measure/Flow/Volume.php @@ -220,183 +220,183 @@ class Zend_Measure_Flow_Volume extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ACRE_FOOT_PER_DAY' => array(array('' => '1233.48184', '/' => '86400'), 'ac ft/day'), - 'ACRE_FOOT_PER_HOUR' => array(array('' => '1233.48184', '/' => '3600'), 'ac ft/h'), - 'ACRE_FOOT_PER_MINUTE' => array(array('' => '1233.48184', '/' => '60'), 'ac ft/m'), - 'ACRE_FOOT_PER_SECOND' => array('1233.48184', 'ac ft/s'), - 'ACRE_FOOT_SURVEY_PER_DAY' => array(array('' => '1233.48924', '/' => '86400'), 'ac ft/day'), - 'ACRE_FOOT_SURVEY_PER_HOUR' => array(array('' => '1233.48924', '/' => '3600'), 'ac ft/h'), - 'ACRE_FOOT_SURVEY_PER_MINUTE' => array(array('' => '1233.48924', '/' => '60'), 'ac ft/m'), - 'ACRE_FOOT_SURVEY_PER_SECOND' => array('1233.48924', 'ac ft/s'), - 'ACRE_INCH_PER_DAY' => array(array('' => '1233.48184', '/' => '1036800'), 'ac in/day'), - 'ACRE_INCH_PER_HOUR' => array(array('' => '1233.48184', '/' => '43200'), 'ac in/h'), - 'ACRE_INCH_PER_MINUTE' => array(array('' => '1233.48184', '/' => '720'), 'ac in/m'), - 'ACRE_INCH_PER_SECOND' => array(array('' => '1233.48184', '/' => '12'), 'ac in/s'), - 'ACRE_INCH_SURVEY_PER_DAY' => array(array('' => '1233.48924', '/' => '1036800'), 'ac in/day'), - 'ACRE_INCH_SURVEY_PER_HOUR' => array(array('' => '1233.48924', '/' => '43200'), 'ac in/h'), - 'ACRE_INCH_SURVEY_PER_MINUTE' => array(array('' => '1233.48924', '/' => '720'), 'ac in /m'), - 'ACRE_INCH_SURVEY_PER_SECOND' => array(array('' => '1233.48924', '/' => '12'), 'ac in/s'), - 'BARREL_PETROLEUM_PER_DAY' => array(array('' => '0.1589872956', '/' => '86400'), 'bbl/day'), - 'BARREL_PETROLEUM_PER_HOUR' => array(array('' => '0.1589872956', '/' => '3600'), 'bbl/h'), - 'BARREL_PETROLEUM_PER_MINUTE' => array(array('' => '0.1589872956', '/' => '60'), 'bbl/m'), - 'BARREL_PETROLEUM_PER_SECOND' => array('0.1589872956', 'bbl/s'), - 'BARREL_PER_DAY' => array(array('' => '0.16365924', '/' => '86400'), 'bbl/day'), - 'BARREL_PER_HOUR' => array(array('' => '0.16365924', '/' => '3600'), 'bbl/h'), - 'BARREL_PER_MINUTE' => array(array('' => '0.16365924', '/' => '60'), 'bbl/m'), - 'BARREL_PER_SECOND' => array('0.16365924', 'bbl/s'), - 'BARREL_US_PER_DAY' => array(array('' => '0.1192404717', '/' => '86400'), 'bbl/day'), - 'BARREL_US_PER_HOUR' => array(array('' => '0.1192404717', '/' => '3600'), 'bbl/h'), - 'BARREL_US_PER_MINUTE' => array(array('' => '0.1192404717', '/' => '60'), 'bbl/m'), - 'BARREL_US_PER_SECOND' => array('0.1192404717', 'bbl/s'), - 'BARREL_WINE_PER_DAY' => array(array('' => '0.1173477658', '/' => '86400'), 'bbl/day'), - 'BARREL_WINE_PER_HOUR' => array(array('' => '0.1173477658', '/' => '3600'), 'bbl/h'), - 'BARREL_WINE_PER_MINUTE' => array(array('' => '0.1173477658', '/' => '60'), 'bbl/m'), - 'BARREL_WINE_PER_SECOND' => array('0.1173477658', 'bbl/s'), - 'BARREL_BEER_PER_DAY' => array(array('' => '0.1173477658', '/' => '86400'), 'bbl/day'), - 'BARREL_BEER_PER_HOUR' => array(array('' => '0.1173477658', '/' => '3600'), 'bbl/h'), - 'BARREL_BEER_PER_MINUTE' => array(array('' => '0.1173477658', '/' => '60'), 'bbl/m'), - 'BARREL_BEER_PER_SECOND' => array('0.1173477658', 'bbl/s'), - 'BILLION_CUBIC_FOOT_PER_DAY' => array(array('' => '28316847', '/' => '86400'), 'bn ft³/day'), - 'BILLION_CUBIC_FOOT_PER_HOUR' => array(array('' => '28316847', '/' => '3600'), 'bn ft³/h'), - 'BILLION_CUBIC_FOOT_PER_MINUTE' => array(array('' => '28316847', '/' => '60'), 'bn ft³/m'), - 'BILLION_CUBIC_FOOT_PER_SECOND' => array('28316847', 'bn ft³/s'), - 'CENTILITER_PER_DAY' => array(array('' => '0.00001', '/' => '86400'), 'cl/day'), - 'CENTILITER_PER_HOUR' => array(array('' => '0.00001', '/' => '3600'), 'cl/h'), - 'CENTILITER_PER_MINUTE' => array(array('' => '0.00001', '/' => '60'), 'cl/m'), - 'CENTILITER_PER_SECOND' => array('0.00001', 'cl/s'), - 'CUBEM_PER_DAY' => array(array('' => '4168181830', '/' => '86400'), 'cubem/day'), - 'CUBEM_PER_HOUR' => array(array('' => '4168181830', '/' => '3600'), 'cubem/h'), - 'CUBEM_PER_MINUTE' => array(array('' => '4168181830', '/' => '60'), 'cubem/m'), - 'CUBEM_PER_SECOND' => array('4168181830', 'cubem/s'), - 'CUBIC_CENTIMETER_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'cm³/day'), - 'CUBIC_CENTIMETER_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'cm³/h'), - 'CUBIC_CENTIMETER_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'cm³/m'), - 'CUBIC_CENTIMETER_PER_SECOND' => array('0.000001', 'cm³/s'), - 'CUBIC_DECIMETER_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'dm³/day'), - 'CUBIC_DECIMETER_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'dm³/h'), - 'CUBIC_DECIMETER_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'dm³/m'), - 'CUBIC_DECIMETER_PER_SECOND' => array('0.001', 'dm³/s'), - 'CUBIC_DEKAMETER_PER_DAY' => array(array('' => '1000', '/' => '86400'), 'dam³/day'), - 'CUBIC_DEKAMETER_PER_HOUR' => array(array('' => '1000', '/' => '3600'), 'dam³/h'), - 'CUBIC_DEKAMETER_PER_MINUTE' => array(array('' => '1000', '/' => '60'), 'dam³/m'), - 'CUBIC_DEKAMETER_PER_SECOND' => array('1000', 'dam³/s'), - 'CUBIC_FOOT_PER_DAY' => array(array('' => '0.028316847', '/' => '86400'), 'ft³/day'), - 'CUBIC_FOOT_PER_HOUR' => array(array('' => '0.028316847', '/' => '3600'), 'ft³/h'), - 'CUBIC_FOOT_PER_MINUTE' => array(array('' => '0.028316847', '/' => '60'), 'ft³/m'), - 'CUBIC_FOOT_PER_SECOND' => array('0.028316847', 'ft³/s'), - 'CUBIC_INCH_PER_DAY' => array(array('' => '0.028316847', '/' => '149299200'), 'in³/day'), - 'CUBIC_INCH_PER_HOUR' => array(array('' => '0.028316847', '/' => '6220800'), 'in³/h'), - 'CUBIC_INCH_PER_MINUTE' => array(array('' => '0.028316847', '/' => '103680'), 'in³/m'), - 'CUBIC_INCH_PER_SECOND' => array('0.028316847', 'in³/s'), - 'CUBIC_KILOMETER_PER_DAY' => array(array('' => '1000000000', '/' => '86400'), 'km³/day'), - 'CUBIC_KILOMETER_PER_HOUR' => array(array('' => '1000000000', '/' => '3600'), 'km³/h'), - 'CUBIC_KILOMETER_PER_MINUTE' => array(array('' => '1000000000', '/' => '60'), 'km³/m'), - 'CUBIC_KILOMETER_PER_SECOND' => array('1000000000', 'km³/s'), - 'CUBIC_METER_PER_DAY' => array(array('' => '1', '/' => '86400'), 'm³/day'), - 'CUBIC_METER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'm³/h'), - 'CUBIC_METER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'm³/m'), - 'CUBIC_METER_PER_SECOND' => array('1', 'm³/s'), - 'CUBIC_MILE_PER_DAY' => array(array('' => '4168181830', '/' => '86400'), 'mi³/day'), - 'CUBIC_MILE_PER_HOUR' => array(array('' => '4168181830', '/' => '3600'), 'mi³/h'), - 'CUBIC_MILE_PER_MINUTE' => array(array('' => '4168181830', '/' => '60'), 'mi³/m'), - 'CUBIC_MILE_PER_SECOND' => array('4168181830', 'mi³/s'), - 'CUBIC_MILLIMETER_PER_DAY' => array(array('' => '0.000000001', '/' => '86400'), 'mm³/day'), - 'CUBIC_MILLIMETER_PER_HOUR' => array(array('' => '0.000000001', '/' => '3600'), 'mm³/h'), - 'CUBIC_MILLIMETER_PER_MINUTE' => array(array('' => '0.000000001', '/' => '60'), 'mm³/m'), - 'CUBIC_MILLIMETER_PER_SECOND' => array('0.000000001', 'mm³/s'), - 'CUBIC_YARD_PER_DAY' => array(array('' => '0.764554869', '/' => '86400'), 'yd³/day'), - 'CUBIC_YARD_PER_HOUR' => array(array('' => '0.764554869', '/' => '3600'), 'yd³/h'), - 'CUBIC_YARD_PER_MINUTE' => array(array('' => '0.764554869', '/' => '60'), 'yd³/m'), - 'CUBIC_YARD_PER_SECOND' => array('0.764554869', 'yd³/s'), - 'CUSEC' => array('0.028316847', 'cusec'), - 'DECILITER_PER_DAY' => array(array('' => '0.0001', '/' => '86400'), 'dl/day'), - 'DECILITER_PER_HOUR' => array(array('' => '0.0001', '/' => '3600'), 'dl/h'), - 'DECILITER_PER_MINUTE' => array(array('' => '0.0001', '/' => '60'), 'dl/m'), - 'DECILITER_PER_SECOND' => array('0.0001', 'dl/s'), - 'DEKALITER_PER_DAY' => array(array('' => '0.01', '/' => '86400'), 'dal/day'), - 'DEKALITER_PER_HOUR' => array(array('' => '0.01', '/' => '3600'), 'dal/h'), - 'DEKALITER_PER_MINUTE' => array(array('' => '0.01', '/' => '60'), 'dal/m'), - 'DEKALITER_PER_SECOND' => array('0.01', 'dal/s'), - 'GALLON_PER_DAY' => array(array('' => '0.00454609', '/' => '86400'), 'gal/day'), - 'GALLON_PER_HOUR' => array(array('' => '0.00454609', '/' => '3600'), 'gal/h'), - 'GALLON_PER_MINUTE' => array(array('' => '0.00454609', '/' => '60'), 'gal/m'), - 'GALLON_PER_SECOND' => array('0.00454609', 'gal/s'), - 'GALLON_US_PER_DAY' => array(array('' => '0.0037854118', '/' => '86400'), 'gal/day'), - 'GALLON_US_PER_HOUR' => array(array('' => '0.0037854118', '/' => '3600'), 'gal/h'), - 'GALLON_US_PER_MINUTE' => array(array('' => '0.0037854118', '/' => '60'), 'gal/m'), - 'GALLON_US_PER_SECOND' => array('0.0037854118', 'gal/s'), - 'HECTARE_METER_PER_DAY' => array(array('' => '10000', '/' => '86400'), 'ha m/day'), - 'HECTARE_METER_PER_HOUR' => array(array('' => '10000', '/' => '3600'), 'ha m/h'), - 'HECTARE_METER_PER_MINUTE' => array(array('' => '10000', '/' => '60'), 'ha m/m'), - 'HECTARE_METER_PER_SECOND' => array('10000', 'ha m/s'), - 'HECTOLITER_PER_DAY' => array(array('' => '0.1', '/' => '86400'), 'hl/day'), - 'HECTOLITER_PER_HOUR' => array(array('' => '0.1', '/' => '3600'), 'hl/h'), - 'HECTOLITER_PER_MINUTE' => array(array('' => '0.1', '/' => '60'), 'hl/m'), - 'HECTOLITER_PER_SECOND' => array('0.1', 'hl/s'), - 'KILOLITER_PER_DAY' => array(array('' => '1', '/' => '86400'), 'kl/day'), - 'KILOLITER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'kl/h'), - 'KILOLITER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'kl/m'), - 'KILOLITER_PER_SECOND' => array('1', 'kl/s'), - 'LAMBDA_PER_DAY' => array(array('' => '0.000000001', '/' => '86400'), 'λ/day'), - 'LAMBDA_PER_HOUR' => array(array('' => '0.000000001', '/' => '3600'), 'λ/h'), - 'LAMBDA_PER_MINUTE' => array(array('' => '0.000000001', '/' => '60'), 'λ/m'), - 'LAMBDA_PER_SECOND' => array('0.000000001', 'λ/s'), - 'LITER_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'l/day'), - 'LITER_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'l/h'), - 'LITER_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'l/m'), - 'LITER_PER_SECOND' => array('0.001', 'l/s'), - 'MILLILITER_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'ml/day'), - 'MILLILITER_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'ml/h'), - 'MILLILITER_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'ml/m'), - 'MILLILITER_PER_SECOND' => array('0.000001', 'ml/s'), - 'MILLION_ACRE_FOOT_PER_DAY' => array(array('' => '1233481840', '/' => '86400'), 'million ac ft/day'), - 'MILLION_ACRE_FOOT_PER_HOUR' => array(array('' => '1233481840', '/' => '3600'), 'million ac ft/h'), - 'MILLION_ACRE_FOOT_PER_MINUTE' => array(array('' => '1233481840', '/' => '60'), 'million ac ft/m'), - 'MILLION_ACRE_FOOT_PER_SECOND' => array('1233481840', 'million ac ft/s'), - 'MILLION_CUBIC_FOOT_PER_DAY' => array(array('' => '28316.847', '/' => '86400'), 'million ft³/day'), - 'MILLION_CUBIC_FOOT_PER_HOUR' => array(array('' => '28316.847', '/' => '3600'), 'million ft³/h'), - 'MILLION_CUBIC_FOOT_PER_MINUTE' => array(array('' => '28316.847', '/' => '60'), 'million ft³/m'), - 'MILLION_CUBIC_FOOT_PER_SECOND' => array('28316.847', 'million ft³/s'), - 'MILLION_GALLON_PER_DAY' => array(array('' => '4546.09', '/' => '86400'), 'million gal/day'), - 'MILLION_GALLON_PER_HOUR' => array(array('' => '4546.09', '/' => '3600'), 'million gal/h'), - 'MILLION_GALLON_PER_MINUTE' => array(array('' => '4546.09', '/' => '60'), 'million gal/m'), - 'MILLION_GALLON_PER_SECOND' => array('4546.09', 'million gal/s'), - 'MILLION_GALLON_US_PER_DAY' => array(array('' => '3785.4118', '/' => '86400'), 'million gal/day'), - 'MILLION_GALLON_US_PER_HOUR' => array(array('' => '3785.4118', '/' => '3600'), 'million gal/h'), - 'MILLION_GALLON_US_PER_MINUTE'=> array(array('' => '3785.4118', '/' => '60'), 'million gal/m'), - 'MILLION_GALLON_US_PER_SECOND'=> array('3785.4118', 'million gal/s'), - 'MINERS_INCH_AZ' => array(array('' => '0.0424752705', '/' => '60'), "miner's inch"), - 'MINERS_INCH_CA' => array(array('' => '0.0424752705', '/' => '60'), "miner's inch"), - 'MINERS_INCH_OR' => array(array('' => '0.0424752705', '/' => '60'), "miner's inch"), - 'MINERS_INCH_CO' => array(array('' => '0.0442450734375', '/' => '60'), "miner's inch"), - 'MINERS_INCH_ID' => array(array('' => '0.0340687062', '/' => '60'), "miner's inch"), - 'MINERS_INCH_WA' => array(array('' => '0.0340687062', '/' => '60'), "miner's inch"), - 'MINERS_INCH_NM' => array(array('' => '0.0340687062', '/' => '60'), "miner's inch"), - 'OUNCE_PER_DAY' => array(array('' => '0.00454609', '/' => '13824000'), 'oz/day'), - 'OUNCE_PER_HOUR' => array(array('' => '0.00454609', '/' => '576000'), 'oz/h'), - 'OUNCE_PER_MINUTE' => array(array('' => '0.00454609', '/' => '9600'), 'oz/m'), - 'OUNCE_PER_SECOND' => array(array('' => '0.00454609', '/' => '160'), 'oz/s'), - 'OUNCE_US_PER_DAY' => array(array('' => '0.0037854118', '/' => '11059200'), 'oz/day'), - 'OUNCE_US_PER_HOUR' => array(array('' => '0.0037854118', '/' => '460800'), 'oz/h'), - 'OUNCE_US_PER_MINUTE' => array(array('' => '0.0037854118', '/' => '7680'), 'oz/m'), - 'OUNCE_US_PER_SECOND' => array(array('' => '0.0037854118', '/' => '128'), 'oz/s'), - 'PETROGRAD_STANDARD_PER_DAY' => array(array('' => '4.672279755', '/' => '86400'), 'petrograd standard/day'), - 'PETROGRAD_STANDARD_PER_HOUR' => array(array('' => '4.672279755', '/' => '3600'), 'petrograd standard/h'), - 'PETROGRAD_STANDARD_PER_MINUTE' => array(array('' => '4.672279755', '/' => '60'), 'petrograd standard/m'), - 'PETROGRAD_STANDARD_PER_SECOND' => array('4.672279755', 'petrograd standard/s'), - 'STERE_PER_DAY' => array(array('' => '1', '/' => '86400'), 'st/day'), - 'STERE_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'st/h'), - 'STERE_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'st/m'), - 'STERE_PER_SECOND' => array('1', 'st/s'), - 'THOUSAND_CUBIC_FOOT_PER_DAY' => array(array('' => '28.316847', '/' => '86400'), 'thousand ft³/day'), - 'THOUSAND_CUBIC_FOOT_PER_HOUR' => array(array('' => '28.316847', '/' => '3600'), 'thousand ft³/h'), - 'THOUSAND_CUBIC_FOOT_PER_MINUTE' => array(array('' => '28.316847', '/' => '60'), 'thousand ft³/m'), - 'THOUSAND_CUBIC_FOOT_PER_SECOND' => array('28.316847', 'thousand ft³/s'), - 'TRILLION_CUBIC_FOOT_PER_DAY' => array(array('' => '28316847000', '/' => '86400'), 'trillion ft³/day'), - 'TRILLION_CUBIC_FOOT_PER_HOUR' => array(array('' => '28316847000', '/' => '3600'), 'trillion ft³/h'), - 'TRILLION_CUBIC_FOOT_PER_MINUTE' => array(array('' => '28316847000', '/' => '60'), 'trillion ft³/m'), - 'TRILLION_CUBIC_FOOT_PER_' => array('28316847000', 'trillion ft³/s'), + protected $_units = [ + 'ACRE_FOOT_PER_DAY' => [['' => '1233.48184', '/' => '86400'], 'ac ft/day'], + 'ACRE_FOOT_PER_HOUR' => [['' => '1233.48184', '/' => '3600'], 'ac ft/h'], + 'ACRE_FOOT_PER_MINUTE' => [['' => '1233.48184', '/' => '60'], 'ac ft/m'], + 'ACRE_FOOT_PER_SECOND' => ['1233.48184', 'ac ft/s'], + 'ACRE_FOOT_SURVEY_PER_DAY' => [['' => '1233.48924', '/' => '86400'], 'ac ft/day'], + 'ACRE_FOOT_SURVEY_PER_HOUR' => [['' => '1233.48924', '/' => '3600'], 'ac ft/h'], + 'ACRE_FOOT_SURVEY_PER_MINUTE' => [['' => '1233.48924', '/' => '60'], 'ac ft/m'], + 'ACRE_FOOT_SURVEY_PER_SECOND' => ['1233.48924', 'ac ft/s'], + 'ACRE_INCH_PER_DAY' => [['' => '1233.48184', '/' => '1036800'], 'ac in/day'], + 'ACRE_INCH_PER_HOUR' => [['' => '1233.48184', '/' => '43200'], 'ac in/h'], + 'ACRE_INCH_PER_MINUTE' => [['' => '1233.48184', '/' => '720'], 'ac in/m'], + 'ACRE_INCH_PER_SECOND' => [['' => '1233.48184', '/' => '12'], 'ac in/s'], + 'ACRE_INCH_SURVEY_PER_DAY' => [['' => '1233.48924', '/' => '1036800'], 'ac in/day'], + 'ACRE_INCH_SURVEY_PER_HOUR' => [['' => '1233.48924', '/' => '43200'], 'ac in/h'], + 'ACRE_INCH_SURVEY_PER_MINUTE' => [['' => '1233.48924', '/' => '720'], 'ac in /m'], + 'ACRE_INCH_SURVEY_PER_SECOND' => [['' => '1233.48924', '/' => '12'], 'ac in/s'], + 'BARREL_PETROLEUM_PER_DAY' => [['' => '0.1589872956', '/' => '86400'], 'bbl/day'], + 'BARREL_PETROLEUM_PER_HOUR' => [['' => '0.1589872956', '/' => '3600'], 'bbl/h'], + 'BARREL_PETROLEUM_PER_MINUTE' => [['' => '0.1589872956', '/' => '60'], 'bbl/m'], + 'BARREL_PETROLEUM_PER_SECOND' => ['0.1589872956', 'bbl/s'], + 'BARREL_PER_DAY' => [['' => '0.16365924', '/' => '86400'], 'bbl/day'], + 'BARREL_PER_HOUR' => [['' => '0.16365924', '/' => '3600'], 'bbl/h'], + 'BARREL_PER_MINUTE' => [['' => '0.16365924', '/' => '60'], 'bbl/m'], + 'BARREL_PER_SECOND' => ['0.16365924', 'bbl/s'], + 'BARREL_US_PER_DAY' => [['' => '0.1192404717', '/' => '86400'], 'bbl/day'], + 'BARREL_US_PER_HOUR' => [['' => '0.1192404717', '/' => '3600'], 'bbl/h'], + 'BARREL_US_PER_MINUTE' => [['' => '0.1192404717', '/' => '60'], 'bbl/m'], + 'BARREL_US_PER_SECOND' => ['0.1192404717', 'bbl/s'], + 'BARREL_WINE_PER_DAY' => [['' => '0.1173477658', '/' => '86400'], 'bbl/day'], + 'BARREL_WINE_PER_HOUR' => [['' => '0.1173477658', '/' => '3600'], 'bbl/h'], + 'BARREL_WINE_PER_MINUTE' => [['' => '0.1173477658', '/' => '60'], 'bbl/m'], + 'BARREL_WINE_PER_SECOND' => ['0.1173477658', 'bbl/s'], + 'BARREL_BEER_PER_DAY' => [['' => '0.1173477658', '/' => '86400'], 'bbl/day'], + 'BARREL_BEER_PER_HOUR' => [['' => '0.1173477658', '/' => '3600'], 'bbl/h'], + 'BARREL_BEER_PER_MINUTE' => [['' => '0.1173477658', '/' => '60'], 'bbl/m'], + 'BARREL_BEER_PER_SECOND' => ['0.1173477658', 'bbl/s'], + 'BILLION_CUBIC_FOOT_PER_DAY' => [['' => '28316847', '/' => '86400'], 'bn ft³/day'], + 'BILLION_CUBIC_FOOT_PER_HOUR' => [['' => '28316847', '/' => '3600'], 'bn ft³/h'], + 'BILLION_CUBIC_FOOT_PER_MINUTE' => [['' => '28316847', '/' => '60'], 'bn ft³/m'], + 'BILLION_CUBIC_FOOT_PER_SECOND' => ['28316847', 'bn ft³/s'], + 'CENTILITER_PER_DAY' => [['' => '0.00001', '/' => '86400'], 'cl/day'], + 'CENTILITER_PER_HOUR' => [['' => '0.00001', '/' => '3600'], 'cl/h'], + 'CENTILITER_PER_MINUTE' => [['' => '0.00001', '/' => '60'], 'cl/m'], + 'CENTILITER_PER_SECOND' => ['0.00001', 'cl/s'], + 'CUBEM_PER_DAY' => [['' => '4168181830', '/' => '86400'], 'cubem/day'], + 'CUBEM_PER_HOUR' => [['' => '4168181830', '/' => '3600'], 'cubem/h'], + 'CUBEM_PER_MINUTE' => [['' => '4168181830', '/' => '60'], 'cubem/m'], + 'CUBEM_PER_SECOND' => ['4168181830', 'cubem/s'], + 'CUBIC_CENTIMETER_PER_DAY' => [['' => '0.000001', '/' => '86400'], 'cm³/day'], + 'CUBIC_CENTIMETER_PER_HOUR' => [['' => '0.000001', '/' => '3600'], 'cm³/h'], + 'CUBIC_CENTIMETER_PER_MINUTE' => [['' => '0.000001', '/' => '60'], 'cm³/m'], + 'CUBIC_CENTIMETER_PER_SECOND' => ['0.000001', 'cm³/s'], + 'CUBIC_DECIMETER_PER_DAY' => [['' => '0.001', '/' => '86400'], 'dm³/day'], + 'CUBIC_DECIMETER_PER_HOUR' => [['' => '0.001', '/' => '3600'], 'dm³/h'], + 'CUBIC_DECIMETER_PER_MINUTE' => [['' => '0.001', '/' => '60'], 'dm³/m'], + 'CUBIC_DECIMETER_PER_SECOND' => ['0.001', 'dm³/s'], + 'CUBIC_DEKAMETER_PER_DAY' => [['' => '1000', '/' => '86400'], 'dam³/day'], + 'CUBIC_DEKAMETER_PER_HOUR' => [['' => '1000', '/' => '3600'], 'dam³/h'], + 'CUBIC_DEKAMETER_PER_MINUTE' => [['' => '1000', '/' => '60'], 'dam³/m'], + 'CUBIC_DEKAMETER_PER_SECOND' => ['1000', 'dam³/s'], + 'CUBIC_FOOT_PER_DAY' => [['' => '0.028316847', '/' => '86400'], 'ft³/day'], + 'CUBIC_FOOT_PER_HOUR' => [['' => '0.028316847', '/' => '3600'], 'ft³/h'], + 'CUBIC_FOOT_PER_MINUTE' => [['' => '0.028316847', '/' => '60'], 'ft³/m'], + 'CUBIC_FOOT_PER_SECOND' => ['0.028316847', 'ft³/s'], + 'CUBIC_INCH_PER_DAY' => [['' => '0.028316847', '/' => '149299200'], 'in³/day'], + 'CUBIC_INCH_PER_HOUR' => [['' => '0.028316847', '/' => '6220800'], 'in³/h'], + 'CUBIC_INCH_PER_MINUTE' => [['' => '0.028316847', '/' => '103680'], 'in³/m'], + 'CUBIC_INCH_PER_SECOND' => ['0.028316847', 'in³/s'], + 'CUBIC_KILOMETER_PER_DAY' => [['' => '1000000000', '/' => '86400'], 'km³/day'], + 'CUBIC_KILOMETER_PER_HOUR' => [['' => '1000000000', '/' => '3600'], 'km³/h'], + 'CUBIC_KILOMETER_PER_MINUTE' => [['' => '1000000000', '/' => '60'], 'km³/m'], + 'CUBIC_KILOMETER_PER_SECOND' => ['1000000000', 'km³/s'], + 'CUBIC_METER_PER_DAY' => [['' => '1', '/' => '86400'], 'm³/day'], + 'CUBIC_METER_PER_HOUR' => [['' => '1', '/' => '3600'], 'm³/h'], + 'CUBIC_METER_PER_MINUTE' => [['' => '1', '/' => '60'], 'm³/m'], + 'CUBIC_METER_PER_SECOND' => ['1', 'm³/s'], + 'CUBIC_MILE_PER_DAY' => [['' => '4168181830', '/' => '86400'], 'mi³/day'], + 'CUBIC_MILE_PER_HOUR' => [['' => '4168181830', '/' => '3600'], 'mi³/h'], + 'CUBIC_MILE_PER_MINUTE' => [['' => '4168181830', '/' => '60'], 'mi³/m'], + 'CUBIC_MILE_PER_SECOND' => ['4168181830', 'mi³/s'], + 'CUBIC_MILLIMETER_PER_DAY' => [['' => '0.000000001', '/' => '86400'], 'mm³/day'], + 'CUBIC_MILLIMETER_PER_HOUR' => [['' => '0.000000001', '/' => '3600'], 'mm³/h'], + 'CUBIC_MILLIMETER_PER_MINUTE' => [['' => '0.000000001', '/' => '60'], 'mm³/m'], + 'CUBIC_MILLIMETER_PER_SECOND' => ['0.000000001', 'mm³/s'], + 'CUBIC_YARD_PER_DAY' => [['' => '0.764554869', '/' => '86400'], 'yd³/day'], + 'CUBIC_YARD_PER_HOUR' => [['' => '0.764554869', '/' => '3600'], 'yd³/h'], + 'CUBIC_YARD_PER_MINUTE' => [['' => '0.764554869', '/' => '60'], 'yd³/m'], + 'CUBIC_YARD_PER_SECOND' => ['0.764554869', 'yd³/s'], + 'CUSEC' => ['0.028316847', 'cusec'], + 'DECILITER_PER_DAY' => [['' => '0.0001', '/' => '86400'], 'dl/day'], + 'DECILITER_PER_HOUR' => [['' => '0.0001', '/' => '3600'], 'dl/h'], + 'DECILITER_PER_MINUTE' => [['' => '0.0001', '/' => '60'], 'dl/m'], + 'DECILITER_PER_SECOND' => ['0.0001', 'dl/s'], + 'DEKALITER_PER_DAY' => [['' => '0.01', '/' => '86400'], 'dal/day'], + 'DEKALITER_PER_HOUR' => [['' => '0.01', '/' => '3600'], 'dal/h'], + 'DEKALITER_PER_MINUTE' => [['' => '0.01', '/' => '60'], 'dal/m'], + 'DEKALITER_PER_SECOND' => ['0.01', 'dal/s'], + 'GALLON_PER_DAY' => [['' => '0.00454609', '/' => '86400'], 'gal/day'], + 'GALLON_PER_HOUR' => [['' => '0.00454609', '/' => '3600'], 'gal/h'], + 'GALLON_PER_MINUTE' => [['' => '0.00454609', '/' => '60'], 'gal/m'], + 'GALLON_PER_SECOND' => ['0.00454609', 'gal/s'], + 'GALLON_US_PER_DAY' => [['' => '0.0037854118', '/' => '86400'], 'gal/day'], + 'GALLON_US_PER_HOUR' => [['' => '0.0037854118', '/' => '3600'], 'gal/h'], + 'GALLON_US_PER_MINUTE' => [['' => '0.0037854118', '/' => '60'], 'gal/m'], + 'GALLON_US_PER_SECOND' => ['0.0037854118', 'gal/s'], + 'HECTARE_METER_PER_DAY' => [['' => '10000', '/' => '86400'], 'ha m/day'], + 'HECTARE_METER_PER_HOUR' => [['' => '10000', '/' => '3600'], 'ha m/h'], + 'HECTARE_METER_PER_MINUTE' => [['' => '10000', '/' => '60'], 'ha m/m'], + 'HECTARE_METER_PER_SECOND' => ['10000', 'ha m/s'], + 'HECTOLITER_PER_DAY' => [['' => '0.1', '/' => '86400'], 'hl/day'], + 'HECTOLITER_PER_HOUR' => [['' => '0.1', '/' => '3600'], 'hl/h'], + 'HECTOLITER_PER_MINUTE' => [['' => '0.1', '/' => '60'], 'hl/m'], + 'HECTOLITER_PER_SECOND' => ['0.1', 'hl/s'], + 'KILOLITER_PER_DAY' => [['' => '1', '/' => '86400'], 'kl/day'], + 'KILOLITER_PER_HOUR' => [['' => '1', '/' => '3600'], 'kl/h'], + 'KILOLITER_PER_MINUTE' => [['' => '1', '/' => '60'], 'kl/m'], + 'KILOLITER_PER_SECOND' => ['1', 'kl/s'], + 'LAMBDA_PER_DAY' => [['' => '0.000000001', '/' => '86400'], 'λ/day'], + 'LAMBDA_PER_HOUR' => [['' => '0.000000001', '/' => '3600'], 'λ/h'], + 'LAMBDA_PER_MINUTE' => [['' => '0.000000001', '/' => '60'], 'λ/m'], + 'LAMBDA_PER_SECOND' => ['0.000000001', 'λ/s'], + 'LITER_PER_DAY' => [['' => '0.001', '/' => '86400'], 'l/day'], + 'LITER_PER_HOUR' => [['' => '0.001', '/' => '3600'], 'l/h'], + 'LITER_PER_MINUTE' => [['' => '0.001', '/' => '60'], 'l/m'], + 'LITER_PER_SECOND' => ['0.001', 'l/s'], + 'MILLILITER_PER_DAY' => [['' => '0.000001', '/' => '86400'], 'ml/day'], + 'MILLILITER_PER_HOUR' => [['' => '0.000001', '/' => '3600'], 'ml/h'], + 'MILLILITER_PER_MINUTE' => [['' => '0.000001', '/' => '60'], 'ml/m'], + 'MILLILITER_PER_SECOND' => ['0.000001', 'ml/s'], + 'MILLION_ACRE_FOOT_PER_DAY' => [['' => '1233481840', '/' => '86400'], 'million ac ft/day'], + 'MILLION_ACRE_FOOT_PER_HOUR' => [['' => '1233481840', '/' => '3600'], 'million ac ft/h'], + 'MILLION_ACRE_FOOT_PER_MINUTE' => [['' => '1233481840', '/' => '60'], 'million ac ft/m'], + 'MILLION_ACRE_FOOT_PER_SECOND' => ['1233481840', 'million ac ft/s'], + 'MILLION_CUBIC_FOOT_PER_DAY' => [['' => '28316.847', '/' => '86400'], 'million ft³/day'], + 'MILLION_CUBIC_FOOT_PER_HOUR' => [['' => '28316.847', '/' => '3600'], 'million ft³/h'], + 'MILLION_CUBIC_FOOT_PER_MINUTE' => [['' => '28316.847', '/' => '60'], 'million ft³/m'], + 'MILLION_CUBIC_FOOT_PER_SECOND' => ['28316.847', 'million ft³/s'], + 'MILLION_GALLON_PER_DAY' => [['' => '4546.09', '/' => '86400'], 'million gal/day'], + 'MILLION_GALLON_PER_HOUR' => [['' => '4546.09', '/' => '3600'], 'million gal/h'], + 'MILLION_GALLON_PER_MINUTE' => [['' => '4546.09', '/' => '60'], 'million gal/m'], + 'MILLION_GALLON_PER_SECOND' => ['4546.09', 'million gal/s'], + 'MILLION_GALLON_US_PER_DAY' => [['' => '3785.4118', '/' => '86400'], 'million gal/day'], + 'MILLION_GALLON_US_PER_HOUR' => [['' => '3785.4118', '/' => '3600'], 'million gal/h'], + 'MILLION_GALLON_US_PER_MINUTE'=> [['' => '3785.4118', '/' => '60'], 'million gal/m'], + 'MILLION_GALLON_US_PER_SECOND'=> ['3785.4118', 'million gal/s'], + 'MINERS_INCH_AZ' => [['' => '0.0424752705', '/' => '60'], "miner's inch"], + 'MINERS_INCH_CA' => [['' => '0.0424752705', '/' => '60'], "miner's inch"], + 'MINERS_INCH_OR' => [['' => '0.0424752705', '/' => '60'], "miner's inch"], + 'MINERS_INCH_CO' => [['' => '0.0442450734375', '/' => '60'], "miner's inch"], + 'MINERS_INCH_ID' => [['' => '0.0340687062', '/' => '60'], "miner's inch"], + 'MINERS_INCH_WA' => [['' => '0.0340687062', '/' => '60'], "miner's inch"], + 'MINERS_INCH_NM' => [['' => '0.0340687062', '/' => '60'], "miner's inch"], + 'OUNCE_PER_DAY' => [['' => '0.00454609', '/' => '13824000'], 'oz/day'], + 'OUNCE_PER_HOUR' => [['' => '0.00454609', '/' => '576000'], 'oz/h'], + 'OUNCE_PER_MINUTE' => [['' => '0.00454609', '/' => '9600'], 'oz/m'], + 'OUNCE_PER_SECOND' => [['' => '0.00454609', '/' => '160'], 'oz/s'], + 'OUNCE_US_PER_DAY' => [['' => '0.0037854118', '/' => '11059200'], 'oz/day'], + 'OUNCE_US_PER_HOUR' => [['' => '0.0037854118', '/' => '460800'], 'oz/h'], + 'OUNCE_US_PER_MINUTE' => [['' => '0.0037854118', '/' => '7680'], 'oz/m'], + 'OUNCE_US_PER_SECOND' => [['' => '0.0037854118', '/' => '128'], 'oz/s'], + 'PETROGRAD_STANDARD_PER_DAY' => [['' => '4.672279755', '/' => '86400'], 'petrograd standard/day'], + 'PETROGRAD_STANDARD_PER_HOUR' => [['' => '4.672279755', '/' => '3600'], 'petrograd standard/h'], + 'PETROGRAD_STANDARD_PER_MINUTE' => [['' => '4.672279755', '/' => '60'], 'petrograd standard/m'], + 'PETROGRAD_STANDARD_PER_SECOND' => ['4.672279755', 'petrograd standard/s'], + 'STERE_PER_DAY' => [['' => '1', '/' => '86400'], 'st/day'], + 'STERE_PER_HOUR' => [['' => '1', '/' => '3600'], 'st/h'], + 'STERE_PER_MINUTE' => [['' => '1', '/' => '60'], 'st/m'], + 'STERE_PER_SECOND' => ['1', 'st/s'], + 'THOUSAND_CUBIC_FOOT_PER_DAY' => [['' => '28.316847', '/' => '86400'], 'thousand ft³/day'], + 'THOUSAND_CUBIC_FOOT_PER_HOUR' => [['' => '28.316847', '/' => '3600'], 'thousand ft³/h'], + 'THOUSAND_CUBIC_FOOT_PER_MINUTE' => [['' => '28.316847', '/' => '60'], 'thousand ft³/m'], + 'THOUSAND_CUBIC_FOOT_PER_SECOND' => ['28.316847', 'thousand ft³/s'], + 'TRILLION_CUBIC_FOOT_PER_DAY' => [['' => '28316847000', '/' => '86400'], 'trillion ft³/day'], + 'TRILLION_CUBIC_FOOT_PER_HOUR' => [['' => '28316847000', '/' => '3600'], 'trillion ft³/h'], + 'TRILLION_CUBIC_FOOT_PER_MINUTE' => [['' => '28316847000', '/' => '60'], 'trillion ft³/m'], + 'TRILLION_CUBIC_FOOT_PER_' => ['28316847000', 'trillion ft³/s'], 'STANDARD' => 'CUBIC_METER_PER_SECOND' - ); + ]; } diff --git a/library/Zend/Measure/Force.php b/library/Zend/Measure/Force.php index 0547499330..2805e8452d 100644 --- a/library/Zend/Measure/Force.php +++ b/library/Zend/Measure/Force.php @@ -82,45 +82,45 @@ class Zend_Measure_Force extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ATTONEWTON' => array('1.0e-18', 'aN'), - 'CENTINEWTON' => array('0.01', 'cN'), - 'DECIGRAM_FORCE' => array('0.000980665', 'dgf'), - 'DECINEWTON' => array('0.1', 'dN'), - 'DEKAGRAM_FORCE' => array('0.0980665', 'dagf'), - 'DEKANEWTON' => array('10', 'daN'), - 'DYNE' => array('0.00001', 'dyn'), - 'EXANEWTON' => array('1.0e+18', 'EN'), - 'FEMTONEWTON' => array('1.0e-15', 'fN'), - 'GIGANEWTON' => array('1.0e+9', 'GN'), - 'GRAM_FORCE' => array('0.00980665', 'gf'), - 'HECTONEWTON' => array('100', 'hN'), - 'JOULE_PER_METER' => array('1', 'J/m'), - 'KILOGRAM_FORCE' => array('9.80665', 'kgf'), - 'KILONEWTON' => array('1000', 'kN'), - 'KILOPOND' => array('9.80665', 'kp'), - 'KIP' => array('4448.2216', 'kip'), - 'MEGANEWTON' => array('1000000', 'Mp'), - 'MEGAPOND' => array('9806.65', 'MN'), - 'MICRONEWTON' => array('0.000001', 'µN'), - 'MILLINEWTON' => array('0.001', 'mN'), - 'NANONEWTON' => array('0.000000001', 'nN'), - 'NEWTON' => array('1', 'N'), - 'OUNCE_FORCE' => array('0.27801385', 'ozf'), - 'PETANEWTON' => array('1.0e+15', 'PN'), - 'PICONEWTON' => array('1.0e-12', 'pN'), - 'POND' => array('0.00980665', 'pond'), - 'POUND_FORCE' => array('4.4482216', 'lbf'), - 'POUNDAL' => array('0.13825495', 'pdl'), - 'STHENE' => array('1000', 'sn'), - 'TERANEWTON' => array('1.0e+12', 'TN'), - 'TON_FORCE_LONG' => array('9964.016384', 'tnf'), - 'TON_FORCE' => array('9806.65', 'tnf'), - 'TON_FORCE_SHORT' => array('8896.4432', 'tnf'), - 'YOCTONEWTON' => array('1.0e-24', 'yN'), - 'YOTTANEWTON' => array('1.0e+24', 'YN'), - 'ZEPTONEWTON' => array('1.0e-21', 'zN'), - 'ZETTANEWTON' => array('1.0e+21', 'ZN'), + protected $_units = [ + 'ATTONEWTON' => ['1.0e-18', 'aN'], + 'CENTINEWTON' => ['0.01', 'cN'], + 'DECIGRAM_FORCE' => ['0.000980665', 'dgf'], + 'DECINEWTON' => ['0.1', 'dN'], + 'DEKAGRAM_FORCE' => ['0.0980665', 'dagf'], + 'DEKANEWTON' => ['10', 'daN'], + 'DYNE' => ['0.00001', 'dyn'], + 'EXANEWTON' => ['1.0e+18', 'EN'], + 'FEMTONEWTON' => ['1.0e-15', 'fN'], + 'GIGANEWTON' => ['1.0e+9', 'GN'], + 'GRAM_FORCE' => ['0.00980665', 'gf'], + 'HECTONEWTON' => ['100', 'hN'], + 'JOULE_PER_METER' => ['1', 'J/m'], + 'KILOGRAM_FORCE' => ['9.80665', 'kgf'], + 'KILONEWTON' => ['1000', 'kN'], + 'KILOPOND' => ['9.80665', 'kp'], + 'KIP' => ['4448.2216', 'kip'], + 'MEGANEWTON' => ['1000000', 'Mp'], + 'MEGAPOND' => ['9806.65', 'MN'], + 'MICRONEWTON' => ['0.000001', 'µN'], + 'MILLINEWTON' => ['0.001', 'mN'], + 'NANONEWTON' => ['0.000000001', 'nN'], + 'NEWTON' => ['1', 'N'], + 'OUNCE_FORCE' => ['0.27801385', 'ozf'], + 'PETANEWTON' => ['1.0e+15', 'PN'], + 'PICONEWTON' => ['1.0e-12', 'pN'], + 'POND' => ['0.00980665', 'pond'], + 'POUND_FORCE' => ['4.4482216', 'lbf'], + 'POUNDAL' => ['0.13825495', 'pdl'], + 'STHENE' => ['1000', 'sn'], + 'TERANEWTON' => ['1.0e+12', 'TN'], + 'TON_FORCE_LONG' => ['9964.016384', 'tnf'], + 'TON_FORCE' => ['9806.65', 'tnf'], + 'TON_FORCE_SHORT' => ['8896.4432', 'tnf'], + 'YOCTONEWTON' => ['1.0e-24', 'yN'], + 'YOTTANEWTON' => ['1.0e+24', 'YN'], + 'ZEPTONEWTON' => ['1.0e-21', 'zN'], + 'ZETTANEWTON' => ['1.0e+21', 'ZN'], 'STANDARD' => 'NEWTON' - ); + ]; } diff --git a/library/Zend/Measure/Frequency.php b/library/Zend/Measure/Frequency.php index 908af54dd6..d0ac650ef8 100644 --- a/library/Zend/Measure/Frequency.php +++ b/library/Zend/Measure/Frequency.php @@ -62,25 +62,25 @@ class Zend_Measure_Frequency extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ONE_PER_SECOND' => array('1', '1/s'), - 'CYCLE_PER_SECOND' => array('1', 'cps'), - 'DEGREE_PER_HOUR' => array(array('' => '1', '/' => '1296000'), '°/h'), - 'DEGREE_PER_MINUTE' => array(array('' => '1', '/' => '21600'), '°/m'), - 'DEGREE_PER_SECOND' => array(array('' => '1', '/' => '360'), '°/s'), - 'GIGAHERTZ' => array('1000000000', 'GHz'), - 'HERTZ' => array('1', 'Hz'), - 'KILOHERTZ' => array('1000', 'kHz'), - 'MEGAHERTZ' => array('1000000', 'MHz'), - 'MILLIHERTZ' => array('0.001', 'mHz'), - 'RADIAN_PER_HOUR' => array(array('' => '1', '/' => '22619.467'), 'rad/h'), - 'RADIAN_PER_MINUTE' => array(array('' => '1', '/' => '376.99112'), 'rad/m'), - 'RADIAN_PER_SECOND' => array(array('' => '1', '/' => '6.2831853'), 'rad/s'), - 'REVOLUTION_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'rph'), - 'REVOLUTION_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'rpm'), - 'REVOLUTION_PER_SECOND' => array('1', 'rps'), - 'RPM' => array(array('' => '1', '/' => '60'), 'rpm'), - 'TERRAHERTZ' => array('1000000000000', 'THz'), + protected $_units = [ + 'ONE_PER_SECOND' => ['1', '1/s'], + 'CYCLE_PER_SECOND' => ['1', 'cps'], + 'DEGREE_PER_HOUR' => [['' => '1', '/' => '1296000'], '°/h'], + 'DEGREE_PER_MINUTE' => [['' => '1', '/' => '21600'], '°/m'], + 'DEGREE_PER_SECOND' => [['' => '1', '/' => '360'], '°/s'], + 'GIGAHERTZ' => ['1000000000', 'GHz'], + 'HERTZ' => ['1', 'Hz'], + 'KILOHERTZ' => ['1000', 'kHz'], + 'MEGAHERTZ' => ['1000000', 'MHz'], + 'MILLIHERTZ' => ['0.001', 'mHz'], + 'RADIAN_PER_HOUR' => [['' => '1', '/' => '22619.467'], 'rad/h'], + 'RADIAN_PER_MINUTE' => [['' => '1', '/' => '376.99112'], 'rad/m'], + 'RADIAN_PER_SECOND' => [['' => '1', '/' => '6.2831853'], 'rad/s'], + 'REVOLUTION_PER_HOUR' => [['' => '1', '/' => '3600'], 'rph'], + 'REVOLUTION_PER_MINUTE' => [['' => '1', '/' => '60'], 'rpm'], + 'REVOLUTION_PER_SECOND' => ['1', 'rps'], + 'RPM' => [['' => '1', '/' => '60'], 'rpm'], + 'TERRAHERTZ' => ['1000000000000', 'THz'], 'STANDARD' =>'HERTZ' - ); + ]; } diff --git a/library/Zend/Measure/Illumination.php b/library/Zend/Measure/Illumination.php index 93dda6eaac..fe6dc313f6 100644 --- a/library/Zend/Measure/Illumination.php +++ b/library/Zend/Measure/Illumination.php @@ -55,18 +55,18 @@ class Zend_Measure_Illumination extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'FOOTCANDLE' => array('10.7639104', 'fc'), - 'KILOLUX' => array('1000', 'klx'), - 'LUMEN_PER_SQUARE_CENTIMETER' => array('10000', 'lm/cm²'), - 'LUMEN_PER_SQUARE_FOOT' => array('10.7639104', 'lm/ft²'), - 'LUMEN_PER_SQUARE_INCH' => array('1550.0030976', 'lm/in²'), - 'LUMEN_PER_SQUARE_METER' => array('1', 'lm/m²'), - 'LUX' => array('1', 'lx'), - 'METERCANDLE' => array('1', 'metercandle'), - 'MILLIPHOT' => array('10', 'mph'), - 'NOX' => array('0.001', 'nox'), - 'PHOT' => array('10000', 'ph'), + protected $_units = [ + 'FOOTCANDLE' => ['10.7639104', 'fc'], + 'KILOLUX' => ['1000', 'klx'], + 'LUMEN_PER_SQUARE_CENTIMETER' => ['10000', 'lm/cm²'], + 'LUMEN_PER_SQUARE_FOOT' => ['10.7639104', 'lm/ft²'], + 'LUMEN_PER_SQUARE_INCH' => ['1550.0030976', 'lm/in²'], + 'LUMEN_PER_SQUARE_METER' => ['1', 'lm/m²'], + 'LUX' => ['1', 'lx'], + 'METERCANDLE' => ['1', 'metercandle'], + 'MILLIPHOT' => ['10', 'mph'], + 'NOX' => ['0.001', 'nox'], + 'PHOT' => ['10000', 'ph'], 'STANDARD' => 'LUX' - ); + ]; } diff --git a/library/Zend/Measure/Length.php b/library/Zend/Measure/Length.php index beb37ab70d..c58a38cc44 100644 --- a/library/Zend/Measure/Length.php +++ b/library/Zend/Measure/Length.php @@ -356,319 +356,319 @@ class Zend_Measure_Length extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'AGATE' => array(array('' => '0.0254', '/' => '72'), 'agate'), - 'ALEN_DANISH' => array('0.6277', 'alen'), - 'ALEN' => array('0.6', 'alen'), - 'ALEN_SWEDISH' => array('0.5938', 'alen'), - 'ANGSTROM' => array('1.0e-10', 'Å'), - 'ARMS' => array('0.7', 'arms'), - 'ARPENT_CANADIAN' => array('58.47', 'arpent'), - 'ARPENT' => array('58.471308', 'arpent'), - 'ARSHEEN' => array('0.7112', 'arsheen'), - 'ARSHIN' => array('1.04', 'arshin'), - 'ARSHIN_IRAQ' => array('74.5', 'arshin'), - 'ASTRONOMICAL_UNIT' => array('149597870691', 'AU'), - 'ATTOMETER' => array('1.0e-18', 'am'), - 'BAMBOO' => array('3.2', 'bamboo'), - 'BARLEYCORN' => array('0.0085', 'barleycorn'), - 'BEE_SPACE' => array('0.0065', 'bee space'), - 'BICRON' => array('1.0e-12', 'µµ'), - 'BLOCK_US_EAST' => array('80.4672', 'block'), - 'BLOCK_US_WEST' => array('100.584', 'block'), - 'BLOCK_US_SOUTH' => array('160.9344', 'block'), - 'BOHR' => array('52.918e-12', 'a₀'), - 'BRACCIO' => array('0.7', 'braccio'), - 'BRAZA_ARGENTINA' => array('1.733', 'braza'), - 'BRAZA' => array('1.67', 'braza'), - 'BRAZA_US' => array('1.693', 'braza'), - 'BUTTON' => array('0.000635', 'button'), - 'CABLE_US' => array('219.456', 'cable'), - 'CABLE_UK' => array('185.3184', 'cable'), - 'CALIBER' => array('0.0254', 'cal'), - 'CANA' => array('2', 'cana'), - 'CAPE_FOOT' => array('0.314858', 'cf'), - 'CAPE_INCH' => array(array('' => '0.314858','/' => '12'), 'ci'), - 'CAPE_ROOD' => array('3.778296', 'cr'), - 'CENTIMETER' => array('0.01', 'cm'), - 'CHAIN' => array(array('' => '79200','/' => '3937'), 'ch'), - 'CHAIN_ENGINEER' => array('30.48', 'ch'), - 'CHIH' => array('0.35814', "ch'ih"), - 'CHINESE_FOOT' => array('0.371475', 'ft'), - 'CHINESE_INCH' => array('0.0371475', 'in'), - 'CHINESE_MILE' => array('557.21', 'mi'), - 'CHINESE_YARD' => array('0.89154', 'yd'), - 'CITY_BLOCK_US_EAST' => array('80.4672', 'block'), - 'CITY_BLOCK_US_WEST' => array('100.584', 'block'), - 'CITY_BLOCK_US_SOUTH' => array('160.9344', 'block'), - 'CLICK' => array('1000', 'click'), - 'CUADRA' => array('84', 'cuadra'), - 'CUADRA_ARGENTINA'=> array('130', 'cuadra'), - 'Length:CUBIT_EGYPT' => array('0.45', 'cubit'), - 'CUBIT_ROYAL' => array('0.5235', 'cubit'), - 'CUBIT_UK' => array('0.4572', 'cubit'), - 'CUBIT' => array('0.444', 'cubit'), - 'CUERDA' => array('21', 'cda'), - 'DECIMETER' => array('0.1', 'dm'), - 'DEKAMETER' => array('10', 'dam'), - 'DIDOT_POINT' => array('0.000377', 'didot point'), - 'DIGIT' => array('0.019', 'digit'), - 'DIRAA' => array('0.58', ''), - 'DONG' => array(array('' => '7','/' => '300'), 'dong'), - 'DOUZIEME_WATCH' => array('0.000188', 'douzième'), - 'DOUZIEME' => array('0.00017638888889', 'douzième'), - 'DRA_IRAQ' => array('0.745', 'dra'), - 'DRA' => array('0.7112', 'dra'), - 'EL' => array('0.69', 'el'), - 'ELL' => array('1.143', 'ell'), - 'ELL_SCOTTISH' => array('0.945', 'ell'), - 'ELLE' => array('0.6', 'ellen'), - 'ELLE_VIENNA' => array('0.7793', 'ellen'), - 'EM' => array('0.0042175176', 'em'), - 'ESTADIO_PORTUGAL'=> array('261', 'estadio'), - 'ESTADIO' => array('174', 'estadio'), - 'EXAMETER' => array('1.0e+18', 'Em'), - 'FADEN_AUSTRIA' => array('1.8965', 'faden'), - 'FADEN' => array('1.8', 'faden'), - 'FALL' => array('6.858', 'fall'), - 'FALL_SCOTTISH' => array('5.67', 'fall'), - 'FATHOM' => array('1.8288', 'fth'), - 'FATHOM_ANCIENT' => array('1.829', 'fth'), - 'FAUST' => array('0.10536', 'faust'), - 'FEET_OLD_CANADIAN' => array('0.325', 'ft'), - 'FEET_EGYPT' => array('0.36', 'ft'), - 'FEET_FRANCE' => array('0.3248406', 'ft'), - 'FEET' => array('0.3048', 'ft'), - 'FEET_IRAQ' => array('0.316', 'ft'), - 'FEET_NETHERLAND' => array('0.28313', 'ft'), - 'FEET_ITALIC' => array('0.296', 'ft'), - 'FEET_SURVEY' => array(array('' => '1200', '/' => '3937'), 'ft'), - 'FEMTOMETER' => array('1.0e-15', 'fm'), - 'FERMI' => array('1.0e-15', 'f'), - 'FINGER' => array('0.1143', 'finger'), - 'FINGERBREADTH' => array('0.01905', 'fingerbreadth'), - 'FIST' => array('0.1', 'fist'), - 'FOD' => array('0.3141', 'fod'), - 'FOOT_EGYPT' => array('0.36', 'ft'), - 'FOOT_FRANCE' => array('0.3248406', 'ft'), - 'FOOT' => array('0.3048', 'ft'), - 'FOOT_IRAQ' => array('0.316', 'ft'), - 'FOOT_NETHERLAND' => array('0.28313', 'ft'), - 'FOOT_ITALIC' => array('0.296', 'ft'), - 'FOOT_SURVEY' => array(array('' => '1200', '/' => '3937'), 'ft'), - 'FOOTBALL_FIELD_CANADA' => array('100.584', 'football field'), - 'FOOTBALL_FIELD_US' => array('91.44', 'football field'), - 'FOOTBALL_FIELD' => array('109.728', 'football field'), - 'FURLONG' => array('201.168', 'fur'), - 'FURLONG_SURVEY' => array(array('' => '792000', '/' => '3937'), 'fur'), - 'FUSS' => array('0.31608', 'fuss'), - 'GIGAMETER' => array('1.0e+9', 'Gm'), - 'GIGAPARSEC' => array('30.85678e+24', 'Gpc'), - 'GNATS_EYE' => array('0.000125', "gnat's eye"), - 'GOAD' => array('1.3716', 'goad'), - 'GRY' => array('0.000211667', 'gry'), - 'HAIRS_BREADTH' => array('0.0001', "hair's breadth"), - 'HAND' => array('0.1016', 'hand'), - 'HANDBREADTH' => array('0.08', "hand's breadth"), - 'HAT' => array('0.5', 'hat'), - 'HECTOMETER' => array('100', 'hm'), - 'HEER' => array('73.152', 'heer'), - 'HIRO' => array('1.818', 'hiro'), - 'HUBBLE' => array('9.4605e+24', 'hubble'), - 'HVAT' => array('1.8965', 'hvat'), - 'INCH' => array('0.0254', 'in'), - 'IRON' => array(array('' => '0.0254', '/' => '48'), 'iron'), - 'KEN' => array('1.818', 'ken'), - 'KERAT' => array('0.0286', 'kerat'), - 'KILOFOOT' => array('304.8', 'kft'), - 'KILOMETER' => array('1000', 'km'), - 'KILOPARSEC' => array('3.0856776e+19', 'kpc'), - 'KILOYARD' => array('914.4', 'kyd'), - 'KIND' => array('0.5', 'kind'), - 'KLAFTER' => array('1.8965', 'klafter'), - 'KLAFTER_SWISS' => array('1.8', 'klafter'), - 'KLICK' => array('1000', 'klick'), - 'KYU' => array('0.00025', 'kyu'), - 'LAP_ANCIENT' => array('402.336', ''), - 'LAP' => array('400', 'lap'), - 'LAP_POOL' => array('100', 'lap'), - 'LEAGUE_ANCIENT' => array('2275', 'league'), - 'LEAGUE_NAUTIC' => array('5556', 'league'), - 'LEAGUE_UK_NAUTIC'=> array('5559.552', 'league'), - 'LEAGUE' => array('4828', 'league'), - 'LEAGUE_US' => array('4828.0417', 'league'), - 'LEAP' => array('2.0574', 'leap'), - 'LEGOA' => array('6174.1', 'legoa'), - 'LEGUA' => array('4200', 'legua'), - 'LEGUA_US' => array('4233.4', 'legua'), - 'LEGUA_SPAIN_OLD' => array('4179.4', 'legua'), - 'LEGUA_SPAIN' => array('6680', 'legua'), - 'LI_ANCIENT' => array('500', 'li'), - 'LI_IMPERIAL' => array('644.65', 'li'), - 'LI' => array('500', 'li'), - 'LIEUE' => array('3898', 'lieue'), - 'LIEUE_METRIC' => array('4000', 'lieue'), - 'LIEUE_NAUTIC' => array('5556', 'lieue'), - 'LIGHT_SECOND' => array('299792458', 'light second'), - 'LIGHT_MINUTE' => array('17987547480', 'light minute'), - 'LIGHT_HOUR' => array('1079252848800', 'light hour'), - 'LIGHT_DAY' => array('25902068371200', 'light day'), - 'LIGHT_YEAR' => array('9460528404879000', 'ly'), - 'LIGNE' => array('0.0021167', 'ligne'), - 'LIGNE_SWISS' => array('0.002256', 'ligne'), - 'LINE' => array('0.0021167', 'li'), - 'LINE_SMALL' => array('0.000635', 'li'), - 'LINK' => array(array('' => '792','/' => '3937'), 'link'), - 'LINK_ENGINEER' => array('0.3048', 'link'), - 'LUG' => array('5.0292', 'lug'), - 'LUG_GREAT' => array('6.4008', 'lug'), - 'MARATHON' => array('42194.988', 'marathon'), - 'MARK_TWAIN' => array('3.6576074', 'mark twain'), - 'MEGAMETER' => array('1000000', 'Mm'), - 'MEGAPARSEC' => array('3.085677e+22', 'Mpc'), - 'MEILE_AUSTRIAN' => array('7586', 'meile'), - 'MEILE' => array('7412.7', 'meile'), - 'MEILE_GERMAN' => array('7532.5', 'meile'), - 'METER' => array('1', 'm'), - 'METRE' => array('1', 'm'), - 'METRIC_MILE' => array('1500', 'metric mile'), - 'METRIC_MILE_US' => array('1600', 'metric mile'), - 'MICROINCH' => array('2.54e-08', 'µin'), - 'MICROMETER' => array('0.000001', 'µm'), - 'MICROMICRON' => array('1.0e-12', 'µµ'), - 'MICRON' => array('0.000001', 'µm'), - 'MIGLIO' => array('1488.6', 'miglio'), - 'MIIL' => array('7500', 'miil'), - 'MIIL_DENMARK' => array('7532.5', 'miil'), - 'MIIL_SWEDISH' => array('10687', 'miil'), - 'MIL' => array('0.0000254', 'mil'), - 'MIL_SWEDISH' => array('10000', 'mil'), - 'MILE_UK' => array('1609', 'mi'), - 'MILE_IRISH' => array('2048', 'mi'), - 'MILE' => array('1609.344', 'mi'), - 'MILE_NAUTIC' => array('1852', 'mi'), - 'MILE_NAUTIC_UK' => array('1853.184', 'mi'), - 'MILE_NAUTIC_US' => array('1852', 'mi'), - 'MILE_ANCIENT' => array('1520', 'mi'), - 'MILE_SCOTTISH' => array('1814', 'mi'), - 'MILE_STATUTE' => array('1609.344', 'mi'), - 'MILE_US' => array(array('' => '6336000','/' => '3937'), 'mi'), - 'MILHA' => array('2087.3', 'milha'), - 'MILITARY_PACE' => array('0.762', 'mil. pace'), - 'MILITARY_PACE_DOUBLE' => array('0.9144', 'mil. pace'), - 'MILLA' => array('1392', 'milla'), - 'MILLE' => array('1949', 'mille'), - 'MILLIARE' => array('0.001478', 'milliare'), - 'MILLIMETER' => array('0.001', 'mm'), - 'MILLIMICRON' => array('1.0e-9', 'mµ'), - 'MKONO' => array('0.4572', 'mkono'), - 'MOOT' => array('0.0762', 'moot'), - 'MYRIAMETER' => array('10000', 'mym'), - 'NAIL' => array('0.05715', 'nail'), - 'NANOMETER' => array('1.0e-9', 'nm'), - 'NANON' => array('1.0e-9', 'nanon'), - 'PACE' => array('1.524', 'pace'), - 'PACE_ROMAN' => array('1.48', 'pace'), - 'PALM_DUTCH' => array('0.10', 'palm'), - 'PALM_UK' => array('0.075', 'palm'), - 'PALM' => array('0.2286', 'palm'), - 'PALMO_PORTUGUESE'=> array('0.22', 'palmo'), - 'PALMO' => array('0.20', 'palmo'), - 'PALMO_US' => array('0.2117', 'palmo'), - 'PARASANG' => array('6000', 'parasang'), - 'PARIS_FOOT' => array('0.3248406', 'paris foot'), - 'PARSEC' => array('3.0856776e+16', 'pc'), - 'PE' => array('0.33324', 'pé'), - 'PEARL' => array('0.001757299', 'pearl'), - 'PERCH' => array('5.0292', 'perch'), - 'PERCH_IRELAND' => array('6.4008', 'perch'), - 'PERTICA' => array('2.96', 'pertica'), - 'PES' => array('0.2967', 'pes'), - 'PETAMETER' => array('1.0e+15', 'Pm'), - 'PICA' => array('0.0042175176', 'pi'), - 'PICOMETER' => array('1.0e-12', 'pm'), - 'PIE_ARGENTINA' => array('0.2889', 'pie'), - 'PIE_ITALIC' => array('0.298', 'pie'), - 'PIE' => array('0.2786', 'pie'), - 'PIE_US' => array('0.2822', 'pie'), - 'PIED_DE_ROI' => array('0.3248406', 'pied de roi'), - 'PIK' => array('0.71', 'pik'), - 'PIKE' => array('0.71', 'pike'), - 'POINT_ADOBE' => array(array('' => '0.3048', '/' => '864'), 'pt'), - 'POINT' => array('0.00035', 'pt'), - 'POINT_DIDOT' => array('0.000377', 'pt'), - 'POINT_TEX' => array('0.0003514598035', 'pt'), - 'POLE' => array('5.0292', 'pole'), - 'POLEGADA' => array('0.02777', 'polegada'), - 'POUCE' => array('0.02707', 'pouce'), - 'PU' => array('1.7907', 'pu'), - 'PULGADA' => array('0.02365', 'pulgada'), - 'PYGME' => array('0.346', 'pygme'), - 'Q' => array('0.00025', 'q'), - 'QUADRANT' => array('10001300', 'quad'), - 'QUARTER' => array('402.336', 'Q'), - 'QUARTER_CLOTH' => array('0.2286', 'Q'), - 'QUARTER_PRINT' => array('0.00025', 'Q'), - 'RANGE' => array(array('' => '38016000','/' => '3937'), 'range'), - 'REED' => array('2.679', 'reed'), - 'RI' => array('3927', 'ri'), - 'RIDGE' => array('6.1722', 'ridge'), - 'RIVER' => array('2000', 'river'), - 'ROD' => array('5.0292', 'rd'), - 'ROD_SURVEY' => array(array('' => '19800', '/' => '3937'), 'rd'), - 'ROEDE' => array('10', 'roede'), - 'ROOD' => array('3.7783', 'rood'), - 'ROPE' => array('3.7783', 'rope'), - 'ROYAL_FOOT' => array('0.3248406', 'royal foot'), - 'RUTE' => array('3.75', 'rute'), - 'SADZHEN' => array('2.1336', 'sadzhen'), - 'SAGENE' => array('2.1336', 'sagene'), - 'SCOTS_FOOT' => array('0.30645', 'scots foot'), - 'SCOTS_MILE' => array('1814.2', 'scots mile'), - 'SEEMEILE' => array('1852', 'seemeile'), - 'SHACKLE' => array('27.432', 'shackle'), - 'SHAFTMENT' => array('0.15124', 'shaftment'), - 'SHAFTMENT_ANCIENT' => array('0.165', 'shaftment'), - 'SHAKU' => array('0.303', 'shaku'), - 'SIRIOMETER' => array('1.4959787e+17', 'siriometer'), - 'SMOOT' => array('1.7018', 'smoot'), - 'SPAN' => array('0.2286', 'span'), - 'SPAT' => array('1.0e+12', 'spat'), - 'STADIUM' => array('185', 'stadium'), - 'STEP' => array('0.762', 'step'), - 'STICK' => array('3.048', 'stk'), - 'STORY' => array('3.3', 'story'), - 'STRIDE' => array('1.524', 'stride'), - 'STRIDE_ROMAN' => array('1.48', 'stride'), - 'TENTHMETER' => array('1.0e-10', 'tenth-meter'), - 'TERAMETER' => array('1.0e+12', 'Tm'), - 'THOU' => array('0.0000254', 'thou'), - 'TOISE' => array('1.949', 'toise'), - 'TOWNSHIP' => array(array('' => '38016000','/' => '3937'), 'twp'), - 'T_SUN' => array('0.0358', "t'sun"), - 'TU' => array('161130', 'tu'), - 'TWAIN' => array('3.6576074', 'twain'), - 'TWIP' => array('0.000017639', 'twip'), - 'U' => array('0.04445', 'U'), - 'VARA_CALIFORNIA' => array('0.83820168', 'vara'), - 'VARA_MEXICAN' => array('0.83802', 'vara'), - 'VARA_PORTUGUESE' => array('1.10', 'vara'), - 'VARA_AMERICA' => array('0.864', 'vara'), - 'VARA' => array('0.83587', 'vara'), - 'VARA_TEXAS' => array('0.84666836', 'vara'), - 'VERGE' => array('0.9144', 'verge'), - 'VERSHOK' => array('0.04445', 'vershok'), - 'VERST' => array('1066.8', 'verst'), - 'WAH' => array('2', 'wah'), - 'WERST' => array('1066.8', 'werst'), - 'X_UNIT' => array('1.0020722e-13', 'Xu'), - 'YARD' => array('0.9144', 'yd'), - 'YOCTOMETER' => array('1.0e-24', 'ym'), - 'YOTTAMETER' => array('1.0e+24', 'Ym'), - 'ZEPTOMETER' => array('1.0e-21', 'zm'), - 'ZETTAMETER' => array('1.0e+21', 'Zm'), - 'ZOLL' => array('0.02634', 'zoll'), - 'ZOLL_SWISS' => array('0.03', 'zoll'), + protected $_units = [ + 'AGATE' => [['' => '0.0254', '/' => '72'], 'agate'], + 'ALEN_DANISH' => ['0.6277', 'alen'], + 'ALEN' => ['0.6', 'alen'], + 'ALEN_SWEDISH' => ['0.5938', 'alen'], + 'ANGSTROM' => ['1.0e-10', 'Å'], + 'ARMS' => ['0.7', 'arms'], + 'ARPENT_CANADIAN' => ['58.47', 'arpent'], + 'ARPENT' => ['58.471308', 'arpent'], + 'ARSHEEN' => ['0.7112', 'arsheen'], + 'ARSHIN' => ['1.04', 'arshin'], + 'ARSHIN_IRAQ' => ['74.5', 'arshin'], + 'ASTRONOMICAL_UNIT' => ['149597870691', 'AU'], + 'ATTOMETER' => ['1.0e-18', 'am'], + 'BAMBOO' => ['3.2', 'bamboo'], + 'BARLEYCORN' => ['0.0085', 'barleycorn'], + 'BEE_SPACE' => ['0.0065', 'bee space'], + 'BICRON' => ['1.0e-12', 'µµ'], + 'BLOCK_US_EAST' => ['80.4672', 'block'], + 'BLOCK_US_WEST' => ['100.584', 'block'], + 'BLOCK_US_SOUTH' => ['160.9344', 'block'], + 'BOHR' => ['52.918e-12', 'a₀'], + 'BRACCIO' => ['0.7', 'braccio'], + 'BRAZA_ARGENTINA' => ['1.733', 'braza'], + 'BRAZA' => ['1.67', 'braza'], + 'BRAZA_US' => ['1.693', 'braza'], + 'BUTTON' => ['0.000635', 'button'], + 'CABLE_US' => ['219.456', 'cable'], + 'CABLE_UK' => ['185.3184', 'cable'], + 'CALIBER' => ['0.0254', 'cal'], + 'CANA' => ['2', 'cana'], + 'CAPE_FOOT' => ['0.314858', 'cf'], + 'CAPE_INCH' => [['' => '0.314858','/' => '12'], 'ci'], + 'CAPE_ROOD' => ['3.778296', 'cr'], + 'CENTIMETER' => ['0.01', 'cm'], + 'CHAIN' => [['' => '79200','/' => '3937'], 'ch'], + 'CHAIN_ENGINEER' => ['30.48', 'ch'], + 'CHIH' => ['0.35814', "ch'ih"], + 'CHINESE_FOOT' => ['0.371475', 'ft'], + 'CHINESE_INCH' => ['0.0371475', 'in'], + 'CHINESE_MILE' => ['557.21', 'mi'], + 'CHINESE_YARD' => ['0.89154', 'yd'], + 'CITY_BLOCK_US_EAST' => ['80.4672', 'block'], + 'CITY_BLOCK_US_WEST' => ['100.584', 'block'], + 'CITY_BLOCK_US_SOUTH' => ['160.9344', 'block'], + 'CLICK' => ['1000', 'click'], + 'CUADRA' => ['84', 'cuadra'], + 'CUADRA_ARGENTINA'=> ['130', 'cuadra'], + 'Length:CUBIT_EGYPT' => ['0.45', 'cubit'], + 'CUBIT_ROYAL' => ['0.5235', 'cubit'], + 'CUBIT_UK' => ['0.4572', 'cubit'], + 'CUBIT' => ['0.444', 'cubit'], + 'CUERDA' => ['21', 'cda'], + 'DECIMETER' => ['0.1', 'dm'], + 'DEKAMETER' => ['10', 'dam'], + 'DIDOT_POINT' => ['0.000377', 'didot point'], + 'DIGIT' => ['0.019', 'digit'], + 'DIRAA' => ['0.58', ''], + 'DONG' => [['' => '7','/' => '300'], 'dong'], + 'DOUZIEME_WATCH' => ['0.000188', 'douzième'], + 'DOUZIEME' => ['0.00017638888889', 'douzième'], + 'DRA_IRAQ' => ['0.745', 'dra'], + 'DRA' => ['0.7112', 'dra'], + 'EL' => ['0.69', 'el'], + 'ELL' => ['1.143', 'ell'], + 'ELL_SCOTTISH' => ['0.945', 'ell'], + 'ELLE' => ['0.6', 'ellen'], + 'ELLE_VIENNA' => ['0.7793', 'ellen'], + 'EM' => ['0.0042175176', 'em'], + 'ESTADIO_PORTUGAL'=> ['261', 'estadio'], + 'ESTADIO' => ['174', 'estadio'], + 'EXAMETER' => ['1.0e+18', 'Em'], + 'FADEN_AUSTRIA' => ['1.8965', 'faden'], + 'FADEN' => ['1.8', 'faden'], + 'FALL' => ['6.858', 'fall'], + 'FALL_SCOTTISH' => ['5.67', 'fall'], + 'FATHOM' => ['1.8288', 'fth'], + 'FATHOM_ANCIENT' => ['1.829', 'fth'], + 'FAUST' => ['0.10536', 'faust'], + 'FEET_OLD_CANADIAN' => ['0.325', 'ft'], + 'FEET_EGYPT' => ['0.36', 'ft'], + 'FEET_FRANCE' => ['0.3248406', 'ft'], + 'FEET' => ['0.3048', 'ft'], + 'FEET_IRAQ' => ['0.316', 'ft'], + 'FEET_NETHERLAND' => ['0.28313', 'ft'], + 'FEET_ITALIC' => ['0.296', 'ft'], + 'FEET_SURVEY' => [['' => '1200', '/' => '3937'], 'ft'], + 'FEMTOMETER' => ['1.0e-15', 'fm'], + 'FERMI' => ['1.0e-15', 'f'], + 'FINGER' => ['0.1143', 'finger'], + 'FINGERBREADTH' => ['0.01905', 'fingerbreadth'], + 'FIST' => ['0.1', 'fist'], + 'FOD' => ['0.3141', 'fod'], + 'FOOT_EGYPT' => ['0.36', 'ft'], + 'FOOT_FRANCE' => ['0.3248406', 'ft'], + 'FOOT' => ['0.3048', 'ft'], + 'FOOT_IRAQ' => ['0.316', 'ft'], + 'FOOT_NETHERLAND' => ['0.28313', 'ft'], + 'FOOT_ITALIC' => ['0.296', 'ft'], + 'FOOT_SURVEY' => [['' => '1200', '/' => '3937'], 'ft'], + 'FOOTBALL_FIELD_CANADA' => ['100.584', 'football field'], + 'FOOTBALL_FIELD_US' => ['91.44', 'football field'], + 'FOOTBALL_FIELD' => ['109.728', 'football field'], + 'FURLONG' => ['201.168', 'fur'], + 'FURLONG_SURVEY' => [['' => '792000', '/' => '3937'], 'fur'], + 'FUSS' => ['0.31608', 'fuss'], + 'GIGAMETER' => ['1.0e+9', 'Gm'], + 'GIGAPARSEC' => ['30.85678e+24', 'Gpc'], + 'GNATS_EYE' => ['0.000125', "gnat's eye"], + 'GOAD' => ['1.3716', 'goad'], + 'GRY' => ['0.000211667', 'gry'], + 'HAIRS_BREADTH' => ['0.0001', "hair's breadth"], + 'HAND' => ['0.1016', 'hand'], + 'HANDBREADTH' => ['0.08', "hand's breadth"], + 'HAT' => ['0.5', 'hat'], + 'HECTOMETER' => ['100', 'hm'], + 'HEER' => ['73.152', 'heer'], + 'HIRO' => ['1.818', 'hiro'], + 'HUBBLE' => ['9.4605e+24', 'hubble'], + 'HVAT' => ['1.8965', 'hvat'], + 'INCH' => ['0.0254', 'in'], + 'IRON' => [['' => '0.0254', '/' => '48'], 'iron'], + 'KEN' => ['1.818', 'ken'], + 'KERAT' => ['0.0286', 'kerat'], + 'KILOFOOT' => ['304.8', 'kft'], + 'KILOMETER' => ['1000', 'km'], + 'KILOPARSEC' => ['3.0856776e+19', 'kpc'], + 'KILOYARD' => ['914.4', 'kyd'], + 'KIND' => ['0.5', 'kind'], + 'KLAFTER' => ['1.8965', 'klafter'], + 'KLAFTER_SWISS' => ['1.8', 'klafter'], + 'KLICK' => ['1000', 'klick'], + 'KYU' => ['0.00025', 'kyu'], + 'LAP_ANCIENT' => ['402.336', ''], + 'LAP' => ['400', 'lap'], + 'LAP_POOL' => ['100', 'lap'], + 'LEAGUE_ANCIENT' => ['2275', 'league'], + 'LEAGUE_NAUTIC' => ['5556', 'league'], + 'LEAGUE_UK_NAUTIC'=> ['5559.552', 'league'], + 'LEAGUE' => ['4828', 'league'], + 'LEAGUE_US' => ['4828.0417', 'league'], + 'LEAP' => ['2.0574', 'leap'], + 'LEGOA' => ['6174.1', 'legoa'], + 'LEGUA' => ['4200', 'legua'], + 'LEGUA_US' => ['4233.4', 'legua'], + 'LEGUA_SPAIN_OLD' => ['4179.4', 'legua'], + 'LEGUA_SPAIN' => ['6680', 'legua'], + 'LI_ANCIENT' => ['500', 'li'], + 'LI_IMPERIAL' => ['644.65', 'li'], + 'LI' => ['500', 'li'], + 'LIEUE' => ['3898', 'lieue'], + 'LIEUE_METRIC' => ['4000', 'lieue'], + 'LIEUE_NAUTIC' => ['5556', 'lieue'], + 'LIGHT_SECOND' => ['299792458', 'light second'], + 'LIGHT_MINUTE' => ['17987547480', 'light minute'], + 'LIGHT_HOUR' => ['1079252848800', 'light hour'], + 'LIGHT_DAY' => ['25902068371200', 'light day'], + 'LIGHT_YEAR' => ['9460528404879000', 'ly'], + 'LIGNE' => ['0.0021167', 'ligne'], + 'LIGNE_SWISS' => ['0.002256', 'ligne'], + 'LINE' => ['0.0021167', 'li'], + 'LINE_SMALL' => ['0.000635', 'li'], + 'LINK' => [['' => '792','/' => '3937'], 'link'], + 'LINK_ENGINEER' => ['0.3048', 'link'], + 'LUG' => ['5.0292', 'lug'], + 'LUG_GREAT' => ['6.4008', 'lug'], + 'MARATHON' => ['42194.988', 'marathon'], + 'MARK_TWAIN' => ['3.6576074', 'mark twain'], + 'MEGAMETER' => ['1000000', 'Mm'], + 'MEGAPARSEC' => ['3.085677e+22', 'Mpc'], + 'MEILE_AUSTRIAN' => ['7586', 'meile'], + 'MEILE' => ['7412.7', 'meile'], + 'MEILE_GERMAN' => ['7532.5', 'meile'], + 'METER' => ['1', 'm'], + 'METRE' => ['1', 'm'], + 'METRIC_MILE' => ['1500', 'metric mile'], + 'METRIC_MILE_US' => ['1600', 'metric mile'], + 'MICROINCH' => ['2.54e-08', 'µin'], + 'MICROMETER' => ['0.000001', 'µm'], + 'MICROMICRON' => ['1.0e-12', 'µµ'], + 'MICRON' => ['0.000001', 'µm'], + 'MIGLIO' => ['1488.6', 'miglio'], + 'MIIL' => ['7500', 'miil'], + 'MIIL_DENMARK' => ['7532.5', 'miil'], + 'MIIL_SWEDISH' => ['10687', 'miil'], + 'MIL' => ['0.0000254', 'mil'], + 'MIL_SWEDISH' => ['10000', 'mil'], + 'MILE_UK' => ['1609', 'mi'], + 'MILE_IRISH' => ['2048', 'mi'], + 'MILE' => ['1609.344', 'mi'], + 'MILE_NAUTIC' => ['1852', 'mi'], + 'MILE_NAUTIC_UK' => ['1853.184', 'mi'], + 'MILE_NAUTIC_US' => ['1852', 'mi'], + 'MILE_ANCIENT' => ['1520', 'mi'], + 'MILE_SCOTTISH' => ['1814', 'mi'], + 'MILE_STATUTE' => ['1609.344', 'mi'], + 'MILE_US' => [['' => '6336000','/' => '3937'], 'mi'], + 'MILHA' => ['2087.3', 'milha'], + 'MILITARY_PACE' => ['0.762', 'mil. pace'], + 'MILITARY_PACE_DOUBLE' => ['0.9144', 'mil. pace'], + 'MILLA' => ['1392', 'milla'], + 'MILLE' => ['1949', 'mille'], + 'MILLIARE' => ['0.001478', 'milliare'], + 'MILLIMETER' => ['0.001', 'mm'], + 'MILLIMICRON' => ['1.0e-9', 'mµ'], + 'MKONO' => ['0.4572', 'mkono'], + 'MOOT' => ['0.0762', 'moot'], + 'MYRIAMETER' => ['10000', 'mym'], + 'NAIL' => ['0.05715', 'nail'], + 'NANOMETER' => ['1.0e-9', 'nm'], + 'NANON' => ['1.0e-9', 'nanon'], + 'PACE' => ['1.524', 'pace'], + 'PACE_ROMAN' => ['1.48', 'pace'], + 'PALM_DUTCH' => ['0.10', 'palm'], + 'PALM_UK' => ['0.075', 'palm'], + 'PALM' => ['0.2286', 'palm'], + 'PALMO_PORTUGUESE'=> ['0.22', 'palmo'], + 'PALMO' => ['0.20', 'palmo'], + 'PALMO_US' => ['0.2117', 'palmo'], + 'PARASANG' => ['6000', 'parasang'], + 'PARIS_FOOT' => ['0.3248406', 'paris foot'], + 'PARSEC' => ['3.0856776e+16', 'pc'], + 'PE' => ['0.33324', 'pé'], + 'PEARL' => ['0.001757299', 'pearl'], + 'PERCH' => ['5.0292', 'perch'], + 'PERCH_IRELAND' => ['6.4008', 'perch'], + 'PERTICA' => ['2.96', 'pertica'], + 'PES' => ['0.2967', 'pes'], + 'PETAMETER' => ['1.0e+15', 'Pm'], + 'PICA' => ['0.0042175176', 'pi'], + 'PICOMETER' => ['1.0e-12', 'pm'], + 'PIE_ARGENTINA' => ['0.2889', 'pie'], + 'PIE_ITALIC' => ['0.298', 'pie'], + 'PIE' => ['0.2786', 'pie'], + 'PIE_US' => ['0.2822', 'pie'], + 'PIED_DE_ROI' => ['0.3248406', 'pied de roi'], + 'PIK' => ['0.71', 'pik'], + 'PIKE' => ['0.71', 'pike'], + 'POINT_ADOBE' => [['' => '0.3048', '/' => '864'], 'pt'], + 'POINT' => ['0.00035', 'pt'], + 'POINT_DIDOT' => ['0.000377', 'pt'], + 'POINT_TEX' => ['0.0003514598035', 'pt'], + 'POLE' => ['5.0292', 'pole'], + 'POLEGADA' => ['0.02777', 'polegada'], + 'POUCE' => ['0.02707', 'pouce'], + 'PU' => ['1.7907', 'pu'], + 'PULGADA' => ['0.02365', 'pulgada'], + 'PYGME' => ['0.346', 'pygme'], + 'Q' => ['0.00025', 'q'], + 'QUADRANT' => ['10001300', 'quad'], + 'QUARTER' => ['402.336', 'Q'], + 'QUARTER_CLOTH' => ['0.2286', 'Q'], + 'QUARTER_PRINT' => ['0.00025', 'Q'], + 'RANGE' => [['' => '38016000','/' => '3937'], 'range'], + 'REED' => ['2.679', 'reed'], + 'RI' => ['3927', 'ri'], + 'RIDGE' => ['6.1722', 'ridge'], + 'RIVER' => ['2000', 'river'], + 'ROD' => ['5.0292', 'rd'], + 'ROD_SURVEY' => [['' => '19800', '/' => '3937'], 'rd'], + 'ROEDE' => ['10', 'roede'], + 'ROOD' => ['3.7783', 'rood'], + 'ROPE' => ['3.7783', 'rope'], + 'ROYAL_FOOT' => ['0.3248406', 'royal foot'], + 'RUTE' => ['3.75', 'rute'], + 'SADZHEN' => ['2.1336', 'sadzhen'], + 'SAGENE' => ['2.1336', 'sagene'], + 'SCOTS_FOOT' => ['0.30645', 'scots foot'], + 'SCOTS_MILE' => ['1814.2', 'scots mile'], + 'SEEMEILE' => ['1852', 'seemeile'], + 'SHACKLE' => ['27.432', 'shackle'], + 'SHAFTMENT' => ['0.15124', 'shaftment'], + 'SHAFTMENT_ANCIENT' => ['0.165', 'shaftment'], + 'SHAKU' => ['0.303', 'shaku'], + 'SIRIOMETER' => ['1.4959787e+17', 'siriometer'], + 'SMOOT' => ['1.7018', 'smoot'], + 'SPAN' => ['0.2286', 'span'], + 'SPAT' => ['1.0e+12', 'spat'], + 'STADIUM' => ['185', 'stadium'], + 'STEP' => ['0.762', 'step'], + 'STICK' => ['3.048', 'stk'], + 'STORY' => ['3.3', 'story'], + 'STRIDE' => ['1.524', 'stride'], + 'STRIDE_ROMAN' => ['1.48', 'stride'], + 'TENTHMETER' => ['1.0e-10', 'tenth-meter'], + 'TERAMETER' => ['1.0e+12', 'Tm'], + 'THOU' => ['0.0000254', 'thou'], + 'TOISE' => ['1.949', 'toise'], + 'TOWNSHIP' => [['' => '38016000','/' => '3937'], 'twp'], + 'T_SUN' => ['0.0358', "t'sun"], + 'TU' => ['161130', 'tu'], + 'TWAIN' => ['3.6576074', 'twain'], + 'TWIP' => ['0.000017639', 'twip'], + 'U' => ['0.04445', 'U'], + 'VARA_CALIFORNIA' => ['0.83820168', 'vara'], + 'VARA_MEXICAN' => ['0.83802', 'vara'], + 'VARA_PORTUGUESE' => ['1.10', 'vara'], + 'VARA_AMERICA' => ['0.864', 'vara'], + 'VARA' => ['0.83587', 'vara'], + 'VARA_TEXAS' => ['0.84666836', 'vara'], + 'VERGE' => ['0.9144', 'verge'], + 'VERSHOK' => ['0.04445', 'vershok'], + 'VERST' => ['1066.8', 'verst'], + 'WAH' => ['2', 'wah'], + 'WERST' => ['1066.8', 'werst'], + 'X_UNIT' => ['1.0020722e-13', 'Xu'], + 'YARD' => ['0.9144', 'yd'], + 'YOCTOMETER' => ['1.0e-24', 'ym'], + 'YOTTAMETER' => ['1.0e+24', 'Ym'], + 'ZEPTOMETER' => ['1.0e-21', 'zm'], + 'ZETTAMETER' => ['1.0e+21', 'Zm'], + 'ZOLL' => ['0.02634', 'zoll'], + 'ZOLL_SWISS' => ['0.03', 'zoll'], 'STANDARD' => 'METER' - ); + ]; } diff --git a/library/Zend/Measure/Lightness.php b/library/Zend/Measure/Lightness.php index 542d428e11..9ade513a25 100644 --- a/library/Zend/Measure/Lightness.php +++ b/library/Zend/Measure/Lightness.php @@ -59,22 +59,22 @@ class Zend_Measure_Lightness extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'APOSTILB' => array('0.31830989', 'asb'), - 'BLONDEL' => array('0.31830989', 'blondel'), - 'CANDELA_PER_SQUARE_CENTIMETER' => array('10000', 'cd/cm²'), - 'CANDELA_PER_SQUARE_FOOT' => array('10.76391', 'cd/ft²'), - 'CANDELA_PER_SQUARE_INCH' => array('1550.00304', 'cd/in²'), - 'CANDELA_PER_SQUARE_METER' => array('1', 'cd/m²'), - 'FOOTLAMBERT' => array('3.4262591', 'ftL'), - 'KILOCANDELA_PER_SQUARE_CENTIMETER' => array('10000000', 'kcd/cm²'), - 'KILOCANDELA_PER_SQUARE_FOOT' => array('10763.91', 'kcd/ft²'), - 'KILOCANDELA_PER_SQUARE_INCH' => array('1550003.04', 'kcd/in²'), - 'KILOCANDELA_PER_SQUARE_METER' => array('1000', 'kcd/m²'), - 'LAMBERT' => array('3183.0989', 'L'), - 'MILLILAMBERT' => array('3.1830989', 'mL'), - 'NIT' => array('1', 'nt'), - 'STILB' => array('10000', 'sb'), + protected $_units = [ + 'APOSTILB' => ['0.31830989', 'asb'], + 'BLONDEL' => ['0.31830989', 'blondel'], + 'CANDELA_PER_SQUARE_CENTIMETER' => ['10000', 'cd/cm²'], + 'CANDELA_PER_SQUARE_FOOT' => ['10.76391', 'cd/ft²'], + 'CANDELA_PER_SQUARE_INCH' => ['1550.00304', 'cd/in²'], + 'CANDELA_PER_SQUARE_METER' => ['1', 'cd/m²'], + 'FOOTLAMBERT' => ['3.4262591', 'ftL'], + 'KILOCANDELA_PER_SQUARE_CENTIMETER' => ['10000000', 'kcd/cm²'], + 'KILOCANDELA_PER_SQUARE_FOOT' => ['10763.91', 'kcd/ft²'], + 'KILOCANDELA_PER_SQUARE_INCH' => ['1550003.04', 'kcd/in²'], + 'KILOCANDELA_PER_SQUARE_METER' => ['1000', 'kcd/m²'], + 'LAMBERT' => ['3183.0989', 'L'], + 'MILLILAMBERT' => ['3.1830989', 'mL'], + 'NIT' => ['1', 'nt'], + 'STILB' => ['10000', 'sb'], 'STANDARD' => 'CANDELA_PER_SQUARE_METER' - ); + ]; } diff --git a/library/Zend/Measure/Number.php b/library/Zend/Measure/Number.php index ef7419539c..23a911c40e 100644 --- a/library/Zend/Measure/Number.php +++ b/library/Zend/Measure/Number.php @@ -58,28 +58,28 @@ class Zend_Measure_Number extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'BINARY' => array(2, '⑵'), - 'TERNARY' => array(3, '⑶'), - 'QUATERNARY' => array(4, '⑷'), - 'QUINARY' => array(5, '⑸'), - 'SENARY' => array(6, '⑹'), - 'SEPTENARY' => array(7, '⑺'), - 'OCTAL' => array(8, '⑻'), - 'NONARY' => array(9, '⑼'), - 'DECIMAL' => array(10, '⑽'), - 'DUODECIMAL' => array(12, '⑿'), - 'HEXADECIMAL' => array(16, '⒃'), - 'ROMAN' => array(99, ''), + protected $_units = [ + 'BINARY' => [2, '⑵'], + 'TERNARY' => [3, '⑶'], + 'QUATERNARY' => [4, '⑷'], + 'QUINARY' => [5, '⑸'], + 'SENARY' => [6, '⑹'], + 'SEPTENARY' => [7, '⑺'], + 'OCTAL' => [8, '⑻'], + 'NONARY' => [9, '⑼'], + 'DECIMAL' => [10, '⑽'], + 'DUODECIMAL' => [12, '⑿'], + 'HEXADECIMAL' => [16, '⒃'], + 'ROMAN' => [99, ''], 'STANDARD' => 'DECIMAL' - ); + ]; /** * Definition of all roman signs * * @var array $_roman */ - private static $_roman = array( + private static $_roman = [ 'I' => 1, 'A' => 4, 'V' => 5, @@ -105,14 +105,14 @@ class Zend_Measure_Number extends Zend_Measure_Abstract 'T' => 500000, 'Z' => 900000, 'U' => 1000000 - ); + ]; /** * Convertion table for roman signs * * @var array $_romanconvert */ - private static $_romanconvert = array( + private static $_romanconvert = [ '/_V/' => '/P/', '/_X/' => '/Q/', '/_L/' => '/R/', @@ -131,7 +131,7 @@ class Zend_Measure_Number extends Zend_Measure_Abstract '/QS/' => '/W/', '/ST/' => '/Y/', '/SU/' => '/Z/' - ); + ]; /** * Zend_Measure_Abstract is an abstract class for the different measurement types @@ -253,7 +253,7 @@ public function setValue($value, $type = null, $locale = null) default: try { - $value = Zend_Locale_Format::getInteger($value, array('locale' => $locale)); + $value = Zend_Locale_Format::getInteger($value, ['locale' => $locale]); } catch (Exception $e) { require_once 'Zend/Measure/Exception.php'; throw new Zend_Measure_Exception($e->getMessage(), $e->getCode(), $e); diff --git a/library/Zend/Measure/Power.php b/library/Zend/Measure/Power.php index 1bff001d6b..cb040189c7 100644 --- a/library/Zend/Measure/Power.php +++ b/library/Zend/Measure/Power.php @@ -113,76 +113,76 @@ class Zend_Measure_Power extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ATTOWATT' => array('1.0e-18', 'aW'), - 'BTU_PER_HOUR' => array('0.29307197', 'BTU/h'), - 'BTU_PER_MINUTE' => array('17.5843182', 'BTU/m'), - 'BTU_PER_SECOND' => array('1055.059092', 'BTU/s'), - 'CALORIE_PER_HOUR' => array(array('' => '11630', '*' => '1.0e-7'), 'cal/h'), - 'CALORIE_PER_MINUTE' => array(array('' => '697800', '*' => '1.0e-7'), 'cal/m'), - 'CALORIE_PER_SECOND' => array(array('' => '41868000', '*' => '1.0e-7'), 'cal/s'), - 'CENTIWATT' => array('0.01', 'cW'), - 'CHEVAL_VAPEUR' => array('735.49875', 'cv'), - 'CLUSEC' => array('0.0000013332237', 'clusec'), - 'DECIWATT' => array('0.1', 'dW'), - 'DEKAWATT' => array('10', 'daW'), - 'DYNE_CENTIMETER_PER_HOUR' => array(array('' => '1.0e-7','/' => '3600'), 'dyn cm/h'), - 'DYNE_CENTIMETER_PER_MINUTE' => array(array('' => '1.0e-7','/' => '60'), 'dyn cm/m'), - 'DYNE_CENTIMETER_PER_SECOND' => array('1.0e-7', 'dyn cm/s'), - 'ERG_PER_HOUR' => array(array('' => '1.0e-7','/' => '3600'), 'erg/h'), - 'ERG_PER_MINUTE' => array(array('' => '1.0e-7','/' => '60'), 'erg/m'), - 'ERG_PER_SECOND' => array('1.0e-7', 'erg/s'), - 'EXAWATT' => array('1.0e+18', 'EW'), - 'FEMTOWATT' => array('1.0e-15', 'fW'), - 'FOOT_POUND_FORCE_PER_HOUR' => array(array('' => '1.3558179', '/' => '3600'), 'ft lb/h'), - 'FOOT_POUND_FORCE_PER_MINUTE' => array(array('' => '1.3558179', '/' => '60'), 'ft lb/m'), - 'FOOT_POUND_FORCE_PER_SECOND' => array('1.3558179', 'ft lb/s'), - 'FOOT_POUNDAL_PER_HOUR' => array(array('' => '0.04214011','/' => '3600'), 'ft pdl/h'), - 'FOOT_POUNDAL_PER_MINUTE' => array(array('' => '0.04214011', '/' => '60'), 'ft pdl/m'), - 'FOOT_POUNDAL_PER_SECOND' => array('0.04214011', 'ft pdl/s'), - 'GIGAWATT' => array('1.0e+9', 'GW'), - 'GRAM_FORCE_CENTIMETER_PER_HOUR' => array(array('' => '0.0000980665','/' => '3600'), 'gf cm/h'), - 'GRAM_FORCE_CENTIMETER_PER_MINUTE' => array(array('' => '0.0000980665','/' => '60'), 'gf cm/m'), - 'GRAM_FORCE_CENTIMETER_PER_SECOND' => array('0.0000980665', 'gf cm/s'), - 'HECTOWATT' => array('100', 'hW'), - 'HORSEPOWER_INTERNATIONAL' => array('745.69987', 'hp'), - 'HORSEPOWER_ELECTRIC' => array('746', 'hp'), - 'HORSEPOWER' => array('735.49875', 'hp'), - 'HORSEPOWER_WATER' => array('746.043', 'hp'), - 'INCH_OUNCH_FORCE_REVOLUTION_PER_MINUTE' => array('0.00073948398', 'in ocf/m'), - 'JOULE_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'J/h'), - 'JOULE_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'J/m'), - 'JOULE_PER_SECOND' => array('1', 'J/s'), - 'KILOCALORIE_PER_HOUR' => array('1.163', 'kcal/h'), - 'KILOCALORIE_PER_MINUTE' => array('69.78', 'kcal/m'), - 'KILOCALORIE_PER_SECOND' => array('4186.8', 'kcal/s'), - 'KILOGRAM_FORCE_METER_PER_HOUR' => array(array('' => '9.80665', '/' => '3600'), 'kgf m/h'), - 'KILOGRAM_FORCE_METER_PER_MINUTE' => array(array('' => '9.80665', '/' => '60'), 'kfg m/m'), - 'KILOGRAM_FORCE_METER_PER_SECOND' => array('9.80665', 'kfg m/s'), - 'KILOPOND_METER_PER_HOUR' => array(array('' => '9.80665', '/' => '3600'), 'kp/h'), - 'KILOPOND_METER_PER_MINUTE' => array(array('' => '9.80665', '/' => '60'), 'kp/m'), - 'KILOPOND_METER_PER_SECOND' => array('9.80665', 'kp/s'), - 'KILOWATT' => array('1000', 'kW'), - 'MEGAWATT' => array('1000000', 'MW'), - 'MICROWATT' => array('0.000001', 'µW'), - 'MILLION_BTU_PER_HOUR' => array('293071.07', 'mio BTU/h'), - 'MILLIWATT' => array('0.001', 'mM'), - 'NANOWATT' => array('1.0e-9', 'nN'), - 'NEWTON_METER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'Nm/h'), - 'NEWTON_METER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'Nm/m'), - 'NEWTON_METER_PER_SECOND' => array('1', 'Nm/s'), - 'PETAWATT' => array('1.0e+15', 'PW'), - 'PFERDESTAERKE' => array('735.49875', 'PS'), - 'PICOWATT' => array('1.0e-12', 'pW'), - 'PONCELET' => array('980.665', 'p'), - 'POUND_SQUARE_FOOT_PER_CUBIC_SECOND' => array('0.04214011', 'lb ft²/s³'), - 'TERAWATT' => array('1.0e+12', 'TW'), - 'TON_OF_REFRIGERATION' => array('3516.85284', 'RT'), - 'WATT' => array('1', 'W'), - 'YOCTOWATT' => array('1.0e-24', 'yW'), - 'YOTTAWATT' => array('1.0e+24', 'YW'), - 'ZEPTOWATT' => array('1.0e-21', 'zW'), - 'ZETTAWATT' => array('1.0e+21', 'ZW'), + protected $_units = [ + 'ATTOWATT' => ['1.0e-18', 'aW'], + 'BTU_PER_HOUR' => ['0.29307197', 'BTU/h'], + 'BTU_PER_MINUTE' => ['17.5843182', 'BTU/m'], + 'BTU_PER_SECOND' => ['1055.059092', 'BTU/s'], + 'CALORIE_PER_HOUR' => [['' => '11630', '*' => '1.0e-7'], 'cal/h'], + 'CALORIE_PER_MINUTE' => [['' => '697800', '*' => '1.0e-7'], 'cal/m'], + 'CALORIE_PER_SECOND' => [['' => '41868000', '*' => '1.0e-7'], 'cal/s'], + 'CENTIWATT' => ['0.01', 'cW'], + 'CHEVAL_VAPEUR' => ['735.49875', 'cv'], + 'CLUSEC' => ['0.0000013332237', 'clusec'], + 'DECIWATT' => ['0.1', 'dW'], + 'DEKAWATT' => ['10', 'daW'], + 'DYNE_CENTIMETER_PER_HOUR' => [['' => '1.0e-7','/' => '3600'], 'dyn cm/h'], + 'DYNE_CENTIMETER_PER_MINUTE' => [['' => '1.0e-7','/' => '60'], 'dyn cm/m'], + 'DYNE_CENTIMETER_PER_SECOND' => ['1.0e-7', 'dyn cm/s'], + 'ERG_PER_HOUR' => [['' => '1.0e-7','/' => '3600'], 'erg/h'], + 'ERG_PER_MINUTE' => [['' => '1.0e-7','/' => '60'], 'erg/m'], + 'ERG_PER_SECOND' => ['1.0e-7', 'erg/s'], + 'EXAWATT' => ['1.0e+18', 'EW'], + 'FEMTOWATT' => ['1.0e-15', 'fW'], + 'FOOT_POUND_FORCE_PER_HOUR' => [['' => '1.3558179', '/' => '3600'], 'ft lb/h'], + 'FOOT_POUND_FORCE_PER_MINUTE' => [['' => '1.3558179', '/' => '60'], 'ft lb/m'], + 'FOOT_POUND_FORCE_PER_SECOND' => ['1.3558179', 'ft lb/s'], + 'FOOT_POUNDAL_PER_HOUR' => [['' => '0.04214011','/' => '3600'], 'ft pdl/h'], + 'FOOT_POUNDAL_PER_MINUTE' => [['' => '0.04214011', '/' => '60'], 'ft pdl/m'], + 'FOOT_POUNDAL_PER_SECOND' => ['0.04214011', 'ft pdl/s'], + 'GIGAWATT' => ['1.0e+9', 'GW'], + 'GRAM_FORCE_CENTIMETER_PER_HOUR' => [['' => '0.0000980665','/' => '3600'], 'gf cm/h'], + 'GRAM_FORCE_CENTIMETER_PER_MINUTE' => [['' => '0.0000980665','/' => '60'], 'gf cm/m'], + 'GRAM_FORCE_CENTIMETER_PER_SECOND' => ['0.0000980665', 'gf cm/s'], + 'HECTOWATT' => ['100', 'hW'], + 'HORSEPOWER_INTERNATIONAL' => ['745.69987', 'hp'], + 'HORSEPOWER_ELECTRIC' => ['746', 'hp'], + 'HORSEPOWER' => ['735.49875', 'hp'], + 'HORSEPOWER_WATER' => ['746.043', 'hp'], + 'INCH_OUNCH_FORCE_REVOLUTION_PER_MINUTE' => ['0.00073948398', 'in ocf/m'], + 'JOULE_PER_HOUR' => [['' => '1', '/' => '3600'], 'J/h'], + 'JOULE_PER_MINUTE' => [['' => '1', '/' => '60'], 'J/m'], + 'JOULE_PER_SECOND' => ['1', 'J/s'], + 'KILOCALORIE_PER_HOUR' => ['1.163', 'kcal/h'], + 'KILOCALORIE_PER_MINUTE' => ['69.78', 'kcal/m'], + 'KILOCALORIE_PER_SECOND' => ['4186.8', 'kcal/s'], + 'KILOGRAM_FORCE_METER_PER_HOUR' => [['' => '9.80665', '/' => '3600'], 'kgf m/h'], + 'KILOGRAM_FORCE_METER_PER_MINUTE' => [['' => '9.80665', '/' => '60'], 'kfg m/m'], + 'KILOGRAM_FORCE_METER_PER_SECOND' => ['9.80665', 'kfg m/s'], + 'KILOPOND_METER_PER_HOUR' => [['' => '9.80665', '/' => '3600'], 'kp/h'], + 'KILOPOND_METER_PER_MINUTE' => [['' => '9.80665', '/' => '60'], 'kp/m'], + 'KILOPOND_METER_PER_SECOND' => ['9.80665', 'kp/s'], + 'KILOWATT' => ['1000', 'kW'], + 'MEGAWATT' => ['1000000', 'MW'], + 'MICROWATT' => ['0.000001', 'µW'], + 'MILLION_BTU_PER_HOUR' => ['293071.07', 'mio BTU/h'], + 'MILLIWATT' => ['0.001', 'mM'], + 'NANOWATT' => ['1.0e-9', 'nN'], + 'NEWTON_METER_PER_HOUR' => [['' => '1', '/' => '3600'], 'Nm/h'], + 'NEWTON_METER_PER_MINUTE' => [['' => '1', '/' => '60'], 'Nm/m'], + 'NEWTON_METER_PER_SECOND' => ['1', 'Nm/s'], + 'PETAWATT' => ['1.0e+15', 'PW'], + 'PFERDESTAERKE' => ['735.49875', 'PS'], + 'PICOWATT' => ['1.0e-12', 'pW'], + 'PONCELET' => ['980.665', 'p'], + 'POUND_SQUARE_FOOT_PER_CUBIC_SECOND' => ['0.04214011', 'lb ft²/s³'], + 'TERAWATT' => ['1.0e+12', 'TW'], + 'TON_OF_REFRIGERATION' => ['3516.85284', 'RT'], + 'WATT' => ['1', 'W'], + 'YOCTOWATT' => ['1.0e-24', 'yW'], + 'YOTTAWATT' => ['1.0e+24', 'YW'], + 'ZEPTOWATT' => ['1.0e-21', 'zW'], + 'ZETTAWATT' => ['1.0e+21', 'ZW'], 'STANDARD' => 'WATT' - ); + ]; } diff --git a/library/Zend/Measure/Pressure.php b/library/Zend/Measure/Pressure.php index 0bbf3c7f62..36152682b7 100644 --- a/library/Zend/Measure/Pressure.php +++ b/library/Zend/Measure/Pressure.php @@ -144,107 +144,107 @@ class Zend_Measure_Pressure extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ATMOSPHERE' => array('101325.01', 'atm'), - 'ATMOSPHERE_TECHNICAL' => array('98066.5', 'atm'), - 'ATTOBAR' => array('1.0e-13', 'ab'), - 'ATTOPASCAL' => array('1.0e-18', 'aPa'), - 'BAR' => array('100000', 'b'), - 'BARAD' => array('0.1', 'barad'), - 'BARYE' => array('0.1', 'ba'), - 'CENTIBAR' => array('1000', 'cb'), - 'CENTIHG' => array('1333.2239', 'cHg'), - 'CENTIMETER_MERCURY_0C' => array('1333.2239', 'cm mercury (0°C)'), - 'CENTIMETER_WATER_4C' => array('98.0665', 'cm water (4°C)'), - 'CENTIPASCAL' => array('0.01', 'cPa'), - 'CENTITORR' => array('1.3332237', 'cTorr'), - 'DECIBAR' => array('10000', 'db'), - 'DECIPASCAL' => array('0.1', 'dPa'), - 'DECITORR' => array('13.332237', 'dTorr'), - 'DEKABAR' => array('1000000', 'dab'), - 'DEKAPASCAL' => array('10', 'daPa'), - 'DYNE_PER_SQUARE_CENTIMETER' => array('0.1', 'dyn/cm²'), - 'EXABAR' => array('1.0e+23', 'Eb'), - 'EXAPASCAL' => array('1.0e+18', 'EPa'), - 'FEMTOBAR' => array('1.0e-10', 'fb'), - 'FEMTOPASCAL' => array('1.0e-15', 'fPa'), - 'FOOT_AIR_0C' => array('3.8640888', 'ft air (0°C)'), - 'FOOT_AIR_15C' => array('3.6622931', 'ft air (15°C)'), - 'FOOT_HEAD' => array('2989.0669', 'ft head'), - 'FOOT_MERCURY_0C' => array('40636.664', 'ft mercury (0°C)'), - 'FOOT_WATER_4C' => array('2989.0669', 'ft water (4°C)'), - 'GIGABAR' => array('1.0e+14', 'Gb'), - 'GIGAPASCAL' => array('1.0e+9', 'GPa'), - 'GRAM_FORCE_SQUARE_CENTIMETER' => array('98.0665', 'gf'), - 'HECTOBAR' => array('1.0e+7', 'hb'), - 'HECTOPASCAL' => array('100', 'hPa'), - 'INCH_AIR_0C' => array(array('' => '3.8640888', '/' => '12'), 'in air (0°C)'), - 'INCH_AIR_15C' => array(array('' => '3.6622931', '/' => '12'), 'in air (15°C)'), - 'INCH_MERCURY_0C' => array(array('' => '40636.664', '/' => '12'), 'in mercury (0°C)'), - 'INCH_WATER_4C' => array(array('' => '2989.0669', '/' => '12'), 'in water (4°C)'), - 'KILOBAR' => array('1.0e+8', 'kb'), - 'KILOGRAM_FORCE_PER_SQUARE_CENTIMETER' => array('98066.5', 'kgf/cm²'), - 'KILOGRAM_FORCE_PER_SQUARE_METER' => array('9.80665', 'kgf/m²'), - 'KILOGRAM_FORCE_PER_SQUARE_MILLIMETER' => array('9806650', 'kgf/mm²'), - 'KILONEWTON_PER_SQUARE_METER' => array('1000', 'kN/m²'), - 'KILOPASCAL' => array('1000', 'kPa'), - 'KILOPOND_PER_SQUARE_CENTIMETER' => array('98066.5', 'kp/cm²'), - 'KILOPOND_PER_SQUARE_METER' => array('9.80665', 'kp/m²'), - 'KILOPOND_PER_SQUARE_MILLIMETER' => array('9806650', 'kp/mm²'), - 'KIP_PER_SQUARE_FOOT' => array(array('' => '430.92233', '/' => '0.009'), 'kip/ft²'), - 'KIP_PER_SQUARE_INCH' => array(array('' => '62052.81552', '/' => '0.009'), 'kip/in²'), - 'MEGABAR' => array('1.0e+11', 'Mb'), - 'MEGANEWTON_PER_SQUARE_METER' => array('1000000', 'MN/m²'), - 'MEGAPASCAL' => array('1000000', 'MPa'), - 'METER_AIR_0C' => array('12.677457', 'm air (0°C)'), - 'METER_AIR_15C' => array('12.015397', 'm air (15°C)'), - 'METER_HEAD' => array('9804.139432', 'm head'), - 'MICROBAR' => array('0.1', 'µb'), - 'MICROMETER_MERCURY_0C' => array('0.13332239', 'µm mercury (0°C)'), - 'MICROMETER_WATER_4C' => array('0.00980665', 'µm water (4°C)'), - 'MICRON_MERCURY_0C' => array('0.13332239', 'µ mercury (0°C)'), - 'MICROPASCAL' => array('0.000001', 'µPa'), - 'MILLIBAR' => array('100', 'mb'), - 'MILLIHG' => array('133.32239', 'mHg'), - 'MILLIMETER_MERCURY_0C' => array('133.32239', 'mm mercury (0°C)'), - 'MILLIMETER_WATER_4C' => array('9.80665', 'mm water (0°C)'), - 'MILLIPASCAL' => array('0.001', 'mPa'), - 'MILLITORR' => array('0.13332237', 'mTorr'), - 'NANOBAR' => array('0.0001', 'nb'), - 'NANOPASCAL' => array('1.0e-9', 'nPa'), - 'NEWTON_PER_SQUARE_METER' => array('1', 'N/m²'), - 'NEWTON_PER_SQUARE_MILLIMETER' => array('1000000', 'N/mm²'), - 'OUNCE_PER_SQUARE_INCH' => array('430.92233', 'oz/in²'), - 'PASCAL' => array('1', 'Pa'), - 'PETABAR' => array('1.0e+20', 'Pb'), - 'PETAPASCAL' => array('1.0e+15', 'PPa'), - 'PICOBAR' => array('0.0000001', 'pb'), - 'PICOPASCAL' => array('1.0e-12', 'pPa'), - 'PIEZE' => array('1000', 'pz'), - 'POUND_PER_SQUARE_FOOT' => array(array('' => '430.92233', '/' => '9'), 'lb/ft²'), - 'POUND_PER_SQUARE_INCH' => array('6894.75728', 'lb/in²'), - 'POUNDAL_PER_SQUARE_FOOT' => array('1.4881639', 'pdl/ft²'), - 'STHENE_PER_SQUARE_METER' => array('1000', 'sn/m²'), - 'TECHNICAL_ATMOSPHERE' => array('98066.5', 'at'), - 'TERABAR' => array('1.0e+17', 'Tb'), - 'TERAPASCAL' => array('1.0e+12', 'TPa'), - 'TON_PER_SQUARE_FOOT' => array(array('' => '120658.2524', '/' => '1.125'), 't/ft²'), - 'TON_PER_SQUARE_FOOT_SHORT' => array(array('' => '430.92233', '/' => '0.0045'), 't/ft²'), - 'TON_PER_SQUARE_INCH' => array(array('' => '17374788.3456', '/' => '1.125'), 't/in²'), - 'TON_PER_SQUARE_INCH_SHORT' => array(array('' => '62052.81552', '/' => '0.0045'), 't/in²'), - 'TON_PER_SQUARE_METER' => array('9806.65', 't/m²'), - 'TORR' => array('133.32237', 'Torr'), - 'WATER_COLUMN_CENTIMETER' => array('98.0665', 'WC (cm)'), - 'WATER_COLUMN_INCH' => array(array('' => '2989.0669', '/' => '12'), 'WC (in)'), - 'WATER_COLUMN_MILLIMETER' => array('9.80665', 'WC (mm)'), - 'YOCTOBAR' => array('1.0e-19', 'yb'), - 'YOCTOPASCAL' => array('1.0e-24', 'yPa'), - 'YOTTABAR' => array('1.0e+29', 'Yb'), - 'YOTTAPASCAL' => array('1.0e+24', 'YPa'), - 'ZEPTOBAR' => array('1.0e-16', 'zb'), - 'ZEPTOPASCAL' => array('1.0e-21', 'zPa'), - 'ZETTABAR' => array('1.0e+26', 'Zb'), - 'ZETTAPASCAL' => array('1.0e+21', 'ZPa'), + protected $_units = [ + 'ATMOSPHERE' => ['101325.01', 'atm'], + 'ATMOSPHERE_TECHNICAL' => ['98066.5', 'atm'], + 'ATTOBAR' => ['1.0e-13', 'ab'], + 'ATTOPASCAL' => ['1.0e-18', 'aPa'], + 'BAR' => ['100000', 'b'], + 'BARAD' => ['0.1', 'barad'], + 'BARYE' => ['0.1', 'ba'], + 'CENTIBAR' => ['1000', 'cb'], + 'CENTIHG' => ['1333.2239', 'cHg'], + 'CENTIMETER_MERCURY_0C' => ['1333.2239', 'cm mercury (0°C)'], + 'CENTIMETER_WATER_4C' => ['98.0665', 'cm water (4°C)'], + 'CENTIPASCAL' => ['0.01', 'cPa'], + 'CENTITORR' => ['1.3332237', 'cTorr'], + 'DECIBAR' => ['10000', 'db'], + 'DECIPASCAL' => ['0.1', 'dPa'], + 'DECITORR' => ['13.332237', 'dTorr'], + 'DEKABAR' => ['1000000', 'dab'], + 'DEKAPASCAL' => ['10', 'daPa'], + 'DYNE_PER_SQUARE_CENTIMETER' => ['0.1', 'dyn/cm²'], + 'EXABAR' => ['1.0e+23', 'Eb'], + 'EXAPASCAL' => ['1.0e+18', 'EPa'], + 'FEMTOBAR' => ['1.0e-10', 'fb'], + 'FEMTOPASCAL' => ['1.0e-15', 'fPa'], + 'FOOT_AIR_0C' => ['3.8640888', 'ft air (0°C)'], + 'FOOT_AIR_15C' => ['3.6622931', 'ft air (15°C)'], + 'FOOT_HEAD' => ['2989.0669', 'ft head'], + 'FOOT_MERCURY_0C' => ['40636.664', 'ft mercury (0°C)'], + 'FOOT_WATER_4C' => ['2989.0669', 'ft water (4°C)'], + 'GIGABAR' => ['1.0e+14', 'Gb'], + 'GIGAPASCAL' => ['1.0e+9', 'GPa'], + 'GRAM_FORCE_SQUARE_CENTIMETER' => ['98.0665', 'gf'], + 'HECTOBAR' => ['1.0e+7', 'hb'], + 'HECTOPASCAL' => ['100', 'hPa'], + 'INCH_AIR_0C' => [['' => '3.8640888', '/' => '12'], 'in air (0°C)'], + 'INCH_AIR_15C' => [['' => '3.6622931', '/' => '12'], 'in air (15°C)'], + 'INCH_MERCURY_0C' => [['' => '40636.664', '/' => '12'], 'in mercury (0°C)'], + 'INCH_WATER_4C' => [['' => '2989.0669', '/' => '12'], 'in water (4°C)'], + 'KILOBAR' => ['1.0e+8', 'kb'], + 'KILOGRAM_FORCE_PER_SQUARE_CENTIMETER' => ['98066.5', 'kgf/cm²'], + 'KILOGRAM_FORCE_PER_SQUARE_METER' => ['9.80665', 'kgf/m²'], + 'KILOGRAM_FORCE_PER_SQUARE_MILLIMETER' => ['9806650', 'kgf/mm²'], + 'KILONEWTON_PER_SQUARE_METER' => ['1000', 'kN/m²'], + 'KILOPASCAL' => ['1000', 'kPa'], + 'KILOPOND_PER_SQUARE_CENTIMETER' => ['98066.5', 'kp/cm²'], + 'KILOPOND_PER_SQUARE_METER' => ['9.80665', 'kp/m²'], + 'KILOPOND_PER_SQUARE_MILLIMETER' => ['9806650', 'kp/mm²'], + 'KIP_PER_SQUARE_FOOT' => [['' => '430.92233', '/' => '0.009'], 'kip/ft²'], + 'KIP_PER_SQUARE_INCH' => [['' => '62052.81552', '/' => '0.009'], 'kip/in²'], + 'MEGABAR' => ['1.0e+11', 'Mb'], + 'MEGANEWTON_PER_SQUARE_METER' => ['1000000', 'MN/m²'], + 'MEGAPASCAL' => ['1000000', 'MPa'], + 'METER_AIR_0C' => ['12.677457', 'm air (0°C)'], + 'METER_AIR_15C' => ['12.015397', 'm air (15°C)'], + 'METER_HEAD' => ['9804.139432', 'm head'], + 'MICROBAR' => ['0.1', 'µb'], + 'MICROMETER_MERCURY_0C' => ['0.13332239', 'µm mercury (0°C)'], + 'MICROMETER_WATER_4C' => ['0.00980665', 'µm water (4°C)'], + 'MICRON_MERCURY_0C' => ['0.13332239', 'µ mercury (0°C)'], + 'MICROPASCAL' => ['0.000001', 'µPa'], + 'MILLIBAR' => ['100', 'mb'], + 'MILLIHG' => ['133.32239', 'mHg'], + 'MILLIMETER_MERCURY_0C' => ['133.32239', 'mm mercury (0°C)'], + 'MILLIMETER_WATER_4C' => ['9.80665', 'mm water (0°C)'], + 'MILLIPASCAL' => ['0.001', 'mPa'], + 'MILLITORR' => ['0.13332237', 'mTorr'], + 'NANOBAR' => ['0.0001', 'nb'], + 'NANOPASCAL' => ['1.0e-9', 'nPa'], + 'NEWTON_PER_SQUARE_METER' => ['1', 'N/m²'], + 'NEWTON_PER_SQUARE_MILLIMETER' => ['1000000', 'N/mm²'], + 'OUNCE_PER_SQUARE_INCH' => ['430.92233', 'oz/in²'], + 'PASCAL' => ['1', 'Pa'], + 'PETABAR' => ['1.0e+20', 'Pb'], + 'PETAPASCAL' => ['1.0e+15', 'PPa'], + 'PICOBAR' => ['0.0000001', 'pb'], + 'PICOPASCAL' => ['1.0e-12', 'pPa'], + 'PIEZE' => ['1000', 'pz'], + 'POUND_PER_SQUARE_FOOT' => [['' => '430.92233', '/' => '9'], 'lb/ft²'], + 'POUND_PER_SQUARE_INCH' => ['6894.75728', 'lb/in²'], + 'POUNDAL_PER_SQUARE_FOOT' => ['1.4881639', 'pdl/ft²'], + 'STHENE_PER_SQUARE_METER' => ['1000', 'sn/m²'], + 'TECHNICAL_ATMOSPHERE' => ['98066.5', 'at'], + 'TERABAR' => ['1.0e+17', 'Tb'], + 'TERAPASCAL' => ['1.0e+12', 'TPa'], + 'TON_PER_SQUARE_FOOT' => [['' => '120658.2524', '/' => '1.125'], 't/ft²'], + 'TON_PER_SQUARE_FOOT_SHORT' => [['' => '430.92233', '/' => '0.0045'], 't/ft²'], + 'TON_PER_SQUARE_INCH' => [['' => '17374788.3456', '/' => '1.125'], 't/in²'], + 'TON_PER_SQUARE_INCH_SHORT' => [['' => '62052.81552', '/' => '0.0045'], 't/in²'], + 'TON_PER_SQUARE_METER' => ['9806.65', 't/m²'], + 'TORR' => ['133.32237', 'Torr'], + 'WATER_COLUMN_CENTIMETER' => ['98.0665', 'WC (cm)'], + 'WATER_COLUMN_INCH' => [['' => '2989.0669', '/' => '12'], 'WC (in)'], + 'WATER_COLUMN_MILLIMETER' => ['9.80665', 'WC (mm)'], + 'YOCTOBAR' => ['1.0e-19', 'yb'], + 'YOCTOPASCAL' => ['1.0e-24', 'yPa'], + 'YOTTABAR' => ['1.0e+29', 'Yb'], + 'YOTTAPASCAL' => ['1.0e+24', 'YPa'], + 'ZEPTOBAR' => ['1.0e-16', 'zb'], + 'ZEPTOPASCAL' => ['1.0e-21', 'zPa'], + 'ZETTABAR' => ['1.0e+26', 'Zb'], + 'ZETTAPASCAL' => ['1.0e+21', 'ZPa'], 'STANDARD' => 'NEWTON_PER_SQUARE_METER' - ); + ]; } diff --git a/library/Zend/Measure/Speed.php b/library/Zend/Measure/Speed.php index 74376a0889..22a199b086 100644 --- a/library/Zend/Measure/Speed.php +++ b/library/Zend/Measure/Speed.php @@ -114,77 +114,77 @@ class Zend_Measure_Speed extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'BENZ' => array('1', 'Bz'), - 'CENTIMETER_PER_DAY' => array(array('' => '0.01', '/' => '86400'), 'cm/day'), - 'CENTIMETER_PER_HOUR' => array(array('' => '0.01', '/' => '3600'), 'cm/h'), - 'CENTIMETER_PER_MINUTE' => array(array('' => '0.01', '/' => '60'), 'cm/m'), - 'CENTIMETER_PER_SECOND' => array('0.01', 'cd/s'), - 'DEKAMETER_PER_DAY' => array(array('' => '10', '/' => '86400'), 'dam/day'), - 'DEKAMETER_PER_HOUR' => array(array('' => '10', '/' => '3600'), 'dam/h'), - 'DEKAMETER_PER_MINUTE' => array(array('' => '10', '/' => '60'), 'dam/m'), - 'DEKAMETER_PER_SECOND' => array('10', 'dam/s'), - 'FOOT_PER_DAY' => array(array('' => '0.3048', '/' => '86400'), 'ft/day'), - 'FOOT_PER_HOUR' => array(array('' => '0.3048', '/' => '3600'), 'ft/h'), - 'FOOT_PER_MINUTE' => array(array('' => '0.3048', '/' => '60'), 'ft/m'), - 'FOOT_PER_SECOND' => array('0.3048', 'ft/s'), - 'FURLONG_PER_DAY' => array(array('' => '201.1684', '/' => '86400'), 'fur/day'), - 'FURLONG_PER_FORTNIGHT' => array(array('' => '201.1684', '/' => '1209600'), 'fur/fortnight'), - 'FURLONG_PER_HOUR' => array(array('' => '201.1684', '/' => '3600'), 'fur/h'), - 'FURLONG_PER_MINUTE' => array(array('' => '201.1684', '/' => '60'), 'fur/m'), - 'FURLONG_PER_SECOND' => array('201.1684', 'fur/s'), - 'HECTOMETER_PER_DAY' => array(array('' => '100', '/' => '86400'), 'hm/day'), - 'HECTOMETER_PER_HOUR' => array(array('' => '100', '/' => '3600'), 'hm/h'), - 'HECTOMETER_PER_MINUTE' => array(array('' => '100', '/' => '60'), 'hm/m'), - 'HECTOMETER_PER_SECOND' => array('100', 'hm/s'), - 'INCH_PER_DAY' => array(array('' => '0.0254', '/' => '86400'), 'in/day'), - 'INCH_PER_HOUR' => array(array('' => '0.0254', '/' => '3600'), 'in/h'), - 'INCH_PER_MINUTE' => array(array('' => '0.0254', '/' => '60'), 'in/m'), - 'INCH_PER_SECOND' => array('0.0254', 'in/s'), - 'KILOMETER_PER_DAY' => array(array('' => '1000', '/' => '86400'), 'km/day'), - 'KILOMETER_PER_HOUR' => array(array('' => '1000', '/' => '3600'), 'km/h'), - 'KILOMETER_PER_MINUTE' => array(array('' => '1000', '/' => '60'), 'km/m'), - 'KILOMETER_PER_SECOND' => array('1000', 'km/s'), - 'KNOT' => array(array('' => '1852', '/' => '3600'), 'kn'), - 'LEAGUE_PER_DAY' => array(array('' => '4828.0417', '/' => '86400'), 'league/day'), - 'LEAGUE_PER_HOUR' => array(array('' => '4828.0417', '/' => '3600'), 'league/h'), - 'LEAGUE_PER_MINUTE' => array(array('' => '4828.0417', '/' => '60'), 'league/m'), - 'LEAGUE_PER_SECOND' => array('4828.0417', 'league/s'), - 'MACH' => array('340.29', 'M'), - 'MEGAMETER_PER_DAY' => array(array('' => '1000000', '/' => '86400'), 'Mm/day'), - 'MEGAMETER_PER_HOUR' => array(array('' => '1000000', '/' => '3600'), 'Mm/h'), - 'MEGAMETER_PER_MINUTE' => array(array('' => '1000000', '/' => '60'), 'Mm/m'), - 'MEGAMETER_PER_SECOND' => array('1000000', 'Mm/s'), - 'METER_PER_DAY' => array(array('' => '1', '/' => '86400'), 'm/day'), - 'METER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'm/h'), - 'METER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'm/m'), - 'METER_PER_SECOND' => array('1', 'm/s'), - 'MILE_PER_DAY' => array(array('' => '1609.344', '/' => '86400'), 'mi/day'), - 'MILE_PER_HOUR' => array(array('' => '1609.344', '/' => '3600'), 'mi/h'), - 'MILE_PER_MINUTE' => array(array('' => '1609.344', '/' => '60'), 'mi/m'), - 'MILE_PER_SECOND' => array('1609.344', 'mi/s'), - 'MILLIMETER_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'mm/day'), - 'MILLIMETER_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'mm/h'), - 'MILLIMETER_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'mm/m'), - 'MILLIMETER_PER_SECOND' => array('0.001', 'mm/s'), - 'MILLIMETER_PER_MICROSECOND' => array('1000', 'mm/µs'), - 'MILLIMETER_PER_100_MICROSECOND' => array('10', 'mm/100µs'), - 'NAUTIC_MILE_PER_DAY' => array(array('' => '1852', '/' => '86400'), 'nmi/day'), - 'NAUTIC_MILE_PER_HOUR' => array(array('' => '1852', '/' => '3600'), 'nmi/h'), - 'NAUTIC_MILE_PER_MINUTE' => array(array('' => '1852', '/' => '60'), 'nmi/m'), - 'NAUTIC_MILE_PER_SECOND' => array('1852', 'nmi/s'), - 'LIGHTSPEED_AIR' => array('299702547', 'speed of light (air)'), - 'LIGHTSPEED_GLASS' => array('199861638', 'speed of light (glass)'), - 'LIGHTSPEED_ICE' => array('228849204', 'speed of light (ice)'), - 'LIGHTSPEED_VACUUM' => array('299792458', 'speed of light (vacuum)'), - 'LIGHTSPEED_WATER' => array('225407863', 'speed of light (water)'), - 'SOUNDSPEED_AIT' => array('340.29', 'speed of sound (air)'), - 'SOUNDSPEED_METAL' => array('5000', 'speed of sound (metal)'), - 'SOUNDSPEED_WATER' => array('1500', 'speed of sound (water)'), - 'YARD_PER_DAY' => array(array('' => '0.9144', '/' => '86400'), 'yd/day'), - 'YARD_PER_HOUR' => array(array('' => '0.9144', '/' => '3600'), 'yd/h'), - 'YARD_PER_MINUTE' => array(array('' => '0.9144', '/' => '60'), 'yd/m'), - 'YARD_PER_SECOND' => array('0.9144', 'yd/s'), + protected $_units = [ + 'BENZ' => ['1', 'Bz'], + 'CENTIMETER_PER_DAY' => [['' => '0.01', '/' => '86400'], 'cm/day'], + 'CENTIMETER_PER_HOUR' => [['' => '0.01', '/' => '3600'], 'cm/h'], + 'CENTIMETER_PER_MINUTE' => [['' => '0.01', '/' => '60'], 'cm/m'], + 'CENTIMETER_PER_SECOND' => ['0.01', 'cd/s'], + 'DEKAMETER_PER_DAY' => [['' => '10', '/' => '86400'], 'dam/day'], + 'DEKAMETER_PER_HOUR' => [['' => '10', '/' => '3600'], 'dam/h'], + 'DEKAMETER_PER_MINUTE' => [['' => '10', '/' => '60'], 'dam/m'], + 'DEKAMETER_PER_SECOND' => ['10', 'dam/s'], + 'FOOT_PER_DAY' => [['' => '0.3048', '/' => '86400'], 'ft/day'], + 'FOOT_PER_HOUR' => [['' => '0.3048', '/' => '3600'], 'ft/h'], + 'FOOT_PER_MINUTE' => [['' => '0.3048', '/' => '60'], 'ft/m'], + 'FOOT_PER_SECOND' => ['0.3048', 'ft/s'], + 'FURLONG_PER_DAY' => [['' => '201.1684', '/' => '86400'], 'fur/day'], + 'FURLONG_PER_FORTNIGHT' => [['' => '201.1684', '/' => '1209600'], 'fur/fortnight'], + 'FURLONG_PER_HOUR' => [['' => '201.1684', '/' => '3600'], 'fur/h'], + 'FURLONG_PER_MINUTE' => [['' => '201.1684', '/' => '60'], 'fur/m'], + 'FURLONG_PER_SECOND' => ['201.1684', 'fur/s'], + 'HECTOMETER_PER_DAY' => [['' => '100', '/' => '86400'], 'hm/day'], + 'HECTOMETER_PER_HOUR' => [['' => '100', '/' => '3600'], 'hm/h'], + 'HECTOMETER_PER_MINUTE' => [['' => '100', '/' => '60'], 'hm/m'], + 'HECTOMETER_PER_SECOND' => ['100', 'hm/s'], + 'INCH_PER_DAY' => [['' => '0.0254', '/' => '86400'], 'in/day'], + 'INCH_PER_HOUR' => [['' => '0.0254', '/' => '3600'], 'in/h'], + 'INCH_PER_MINUTE' => [['' => '0.0254', '/' => '60'], 'in/m'], + 'INCH_PER_SECOND' => ['0.0254', 'in/s'], + 'KILOMETER_PER_DAY' => [['' => '1000', '/' => '86400'], 'km/day'], + 'KILOMETER_PER_HOUR' => [['' => '1000', '/' => '3600'], 'km/h'], + 'KILOMETER_PER_MINUTE' => [['' => '1000', '/' => '60'], 'km/m'], + 'KILOMETER_PER_SECOND' => ['1000', 'km/s'], + 'KNOT' => [['' => '1852', '/' => '3600'], 'kn'], + 'LEAGUE_PER_DAY' => [['' => '4828.0417', '/' => '86400'], 'league/day'], + 'LEAGUE_PER_HOUR' => [['' => '4828.0417', '/' => '3600'], 'league/h'], + 'LEAGUE_PER_MINUTE' => [['' => '4828.0417', '/' => '60'], 'league/m'], + 'LEAGUE_PER_SECOND' => ['4828.0417', 'league/s'], + 'MACH' => ['340.29', 'M'], + 'MEGAMETER_PER_DAY' => [['' => '1000000', '/' => '86400'], 'Mm/day'], + 'MEGAMETER_PER_HOUR' => [['' => '1000000', '/' => '3600'], 'Mm/h'], + 'MEGAMETER_PER_MINUTE' => [['' => '1000000', '/' => '60'], 'Mm/m'], + 'MEGAMETER_PER_SECOND' => ['1000000', 'Mm/s'], + 'METER_PER_DAY' => [['' => '1', '/' => '86400'], 'm/day'], + 'METER_PER_HOUR' => [['' => '1', '/' => '3600'], 'm/h'], + 'METER_PER_MINUTE' => [['' => '1', '/' => '60'], 'm/m'], + 'METER_PER_SECOND' => ['1', 'm/s'], + 'MILE_PER_DAY' => [['' => '1609.344', '/' => '86400'], 'mi/day'], + 'MILE_PER_HOUR' => [['' => '1609.344', '/' => '3600'], 'mi/h'], + 'MILE_PER_MINUTE' => [['' => '1609.344', '/' => '60'], 'mi/m'], + 'MILE_PER_SECOND' => ['1609.344', 'mi/s'], + 'MILLIMETER_PER_DAY' => [['' => '0.001', '/' => '86400'], 'mm/day'], + 'MILLIMETER_PER_HOUR' => [['' => '0.001', '/' => '3600'], 'mm/h'], + 'MILLIMETER_PER_MINUTE' => [['' => '0.001', '/' => '60'], 'mm/m'], + 'MILLIMETER_PER_SECOND' => ['0.001', 'mm/s'], + 'MILLIMETER_PER_MICROSECOND' => ['1000', 'mm/µs'], + 'MILLIMETER_PER_100_MICROSECOND' => ['10', 'mm/100µs'], + 'NAUTIC_MILE_PER_DAY' => [['' => '1852', '/' => '86400'], 'nmi/day'], + 'NAUTIC_MILE_PER_HOUR' => [['' => '1852', '/' => '3600'], 'nmi/h'], + 'NAUTIC_MILE_PER_MINUTE' => [['' => '1852', '/' => '60'], 'nmi/m'], + 'NAUTIC_MILE_PER_SECOND' => ['1852', 'nmi/s'], + 'LIGHTSPEED_AIR' => ['299702547', 'speed of light (air)'], + 'LIGHTSPEED_GLASS' => ['199861638', 'speed of light (glass)'], + 'LIGHTSPEED_ICE' => ['228849204', 'speed of light (ice)'], + 'LIGHTSPEED_VACUUM' => ['299792458', 'speed of light (vacuum)'], + 'LIGHTSPEED_WATER' => ['225407863', 'speed of light (water)'], + 'SOUNDSPEED_AIT' => ['340.29', 'speed of sound (air)'], + 'SOUNDSPEED_METAL' => ['5000', 'speed of sound (metal)'], + 'SOUNDSPEED_WATER' => ['1500', 'speed of sound (water)'], + 'YARD_PER_DAY' => [['' => '0.9144', '/' => '86400'], 'yd/day'], + 'YARD_PER_HOUR' => [['' => '0.9144', '/' => '3600'], 'yd/h'], + 'YARD_PER_MINUTE' => [['' => '0.9144', '/' => '60'], 'yd/m'], + 'YARD_PER_SECOND' => ['0.9144', 'yd/s'], 'STANDARD' => 'METER_PER_SECOND' - ); + ]; } diff --git a/library/Zend/Measure/Temperature.php b/library/Zend/Measure/Temperature.php index e40c86ca20..859849798e 100644 --- a/library/Zend/Measure/Temperature.php +++ b/library/Zend/Measure/Temperature.php @@ -49,12 +49,12 @@ class Zend_Measure_Temperature extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'CELSIUS' => array(array('' => '1', '+' => '273.15'),'°C'), - 'FAHRENHEIT' => array(array('' => '1', '-' => '32', '/' => '1.8', '+' => '273.15'),'°F'), - 'RANKINE' => array(array('' => '1', '/' => '1.8'),'°R'), - 'REAUMUR' => array(array('' => '1', '*' => '1.25', '+' => '273.15'),'°r'), - 'KELVIN' => array(1,'°K'), + protected $_units = [ + 'CELSIUS' => [['' => '1', '+' => '273.15'],'°C'], + 'FAHRENHEIT' => [['' => '1', '-' => '32', '/' => '1.8', '+' => '273.15'],'°F'], + 'RANKINE' => [['' => '1', '/' => '1.8'],'°R'], + 'REAUMUR' => [['' => '1', '*' => '1.25', '+' => '273.15'],'°r'], + 'KELVIN' => [1,'°K'], 'STANDARD' => 'KELVIN' - ); + ]; } diff --git a/library/Zend/Measure/Time.php b/library/Zend/Measure/Time.php index 3ecdcf8273..e081b1f708 100644 --- a/library/Zend/Measure/Time.php +++ b/library/Zend/Measure/Time.php @@ -77,41 +77,41 @@ class Zend_Measure_Time extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ANOMALISTIC_YEAR' => array('31558432', 'anomalistic year'), - 'ATTOSECOND' => array('1.0e-18', 'as'), - 'CENTURY' => array('3153600000', 'century'), - 'DAY' => array('86400', 'day'), - 'DECADE' => array('315360000', 'decade'), - 'DRACONIC_YEAR' => array('29947974', 'draconic year'), - 'EXASECOND' => array('1.0e+18', 'Es'), - 'FEMTOSECOND' => array('1.0e-15', 'fs'), - 'FORTNIGHT' => array('1209600', 'fortnight'), - 'GAUSSIAN_YEAR' => array('31558196', 'gaussian year'), - 'GIGASECOND' => array('1.0e+9', 'Gs'), - 'GREAT_YEAR' => array(array('*' => '31536000', '*' => '25700'), 'great year'), - 'GREGORIAN_YEAR' => array('31536000', 'year'), - 'HOUR' => array('3600', 'h'), - 'JULIAN_YEAR' => array('31557600', 'a'), - 'KILOSECOND' => array('1000', 'ks'), - 'LEAPYEAR' => array('31622400', 'year'), - 'MEGASECOND' => array('1000000', 'Ms'), - 'MICROSECOND' => array('0.000001', 'µs'), - 'MILLENIUM' => array('31536000000', 'millenium'), - 'MILLISECOND' => array('0.001', 'ms'), - 'MINUTE' => array('60', 'min'), - 'MONTH' => array('2628600', 'month'), - 'NANOSECOND' => array('1.0e-9', 'ns'), - 'PETASECOND' => array('1.0e+15', 'Ps'), - 'PICOSECOND' => array('1.0e-12', 'ps'), - 'QUARTER' => array('7884000', 'quarter'), - 'SECOND' => array('1', 's'), - 'SHAKE' => array('1.0e-9', 'shake'), - 'SIDEREAL_YEAR' => array('31558149.7676', 'sidereal year'), - 'TERASECOND' => array('1.0e+12', 'Ts'), - 'TROPICAL_YEAR' => array('31556925', 'tropical year'), - 'WEEK' => array('604800', 'week'), - 'YEAR' => array('31536000', 'year'), + protected $_units = [ + 'ANOMALISTIC_YEAR' => ['31558432', 'anomalistic year'], + 'ATTOSECOND' => ['1.0e-18', 'as'], + 'CENTURY' => ['3153600000', 'century'], + 'DAY' => ['86400', 'day'], + 'DECADE' => ['315360000', 'decade'], + 'DRACONIC_YEAR' => ['29947974', 'draconic year'], + 'EXASECOND' => ['1.0e+18', 'Es'], + 'FEMTOSECOND' => ['1.0e-15', 'fs'], + 'FORTNIGHT' => ['1209600', 'fortnight'], + 'GAUSSIAN_YEAR' => ['31558196', 'gaussian year'], + 'GIGASECOND' => ['1.0e+9', 'Gs'], + 'GREAT_YEAR' => [['*' => '31536000', '*' => '25700'], 'great year'], + 'GREGORIAN_YEAR' => ['31536000', 'year'], + 'HOUR' => ['3600', 'h'], + 'JULIAN_YEAR' => ['31557600', 'a'], + 'KILOSECOND' => ['1000', 'ks'], + 'LEAPYEAR' => ['31622400', 'year'], + 'MEGASECOND' => ['1000000', 'Ms'], + 'MICROSECOND' => ['0.000001', 'µs'], + 'MILLENIUM' => ['31536000000', 'millenium'], + 'MILLISECOND' => ['0.001', 'ms'], + 'MINUTE' => ['60', 'min'], + 'MONTH' => ['2628600', 'month'], + 'NANOSECOND' => ['1.0e-9', 'ns'], + 'PETASECOND' => ['1.0e+15', 'Ps'], + 'PICOSECOND' => ['1.0e-12', 'ps'], + 'QUARTER' => ['7884000', 'quarter'], + 'SECOND' => ['1', 's'], + 'SHAKE' => ['1.0e-9', 'shake'], + 'SIDEREAL_YEAR' => ['31558149.7676', 'sidereal year'], + 'TERASECOND' => ['1.0e+12', 'Ts'], + 'TROPICAL_YEAR' => ['31556925', 'tropical year'], + 'WEEK' => ['604800', 'week'], + 'YEAR' => ['31536000', 'year'], 'STANDARD' => 'SECOND' - ); + ]; } diff --git a/library/Zend/Measure/Torque.php b/library/Zend/Measure/Torque.php index ce2684c2cf..ac41a6f386 100644 --- a/library/Zend/Measure/Torque.php +++ b/library/Zend/Measure/Torque.php @@ -60,23 +60,23 @@ class Zend_Measure_Torque extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'DYNE_CENTIMETER' => array('0.0000001', 'dyncm'), - 'GRAM_CENTIMETER' => array('0.0000980665', 'gcm'), - 'KILOGRAM_CENTIMETER' => array('0.0980665', 'kgcm'), - 'KILOGRAM_METER' => array('9.80665', 'kgm'), - 'KILONEWTON_METER' => array('1000', 'kNm'), - 'KILOPOND_METER' => array('9.80665', 'kpm'), - 'MEGANEWTON_METER' => array('1000000', 'MNm'), - 'MICRONEWTON_METER' => array('0.000001', 'µNm'), - 'MILLINEWTON_METER' => array('0.001', 'mNm'), - 'NEWTON_CENTIMETER' => array('0.01', 'Ncm'), - 'NEWTON_METER' => array('1', 'Nm'), - 'OUNCE_FOOT' => array('0.084738622', 'ozft'), - 'OUNCE_INCH' => array(array('' => '0.084738622', '/' => '12'), 'ozin'), - 'POUND_FOOT' => array(array('' => '0.084738622', '*' => '16'), 'lbft'), - 'POUNDAL_FOOT' => array('0.0421401099752144', 'plft'), - 'POUND_INCH' => array(array('' => '0.084738622', '/' => '12', '*' => '16'), 'lbin'), + protected $_units = [ + 'DYNE_CENTIMETER' => ['0.0000001', 'dyncm'], + 'GRAM_CENTIMETER' => ['0.0000980665', 'gcm'], + 'KILOGRAM_CENTIMETER' => ['0.0980665', 'kgcm'], + 'KILOGRAM_METER' => ['9.80665', 'kgm'], + 'KILONEWTON_METER' => ['1000', 'kNm'], + 'KILOPOND_METER' => ['9.80665', 'kpm'], + 'MEGANEWTON_METER' => ['1000000', 'MNm'], + 'MICRONEWTON_METER' => ['0.000001', 'µNm'], + 'MILLINEWTON_METER' => ['0.001', 'mNm'], + 'NEWTON_CENTIMETER' => ['0.01', 'Ncm'], + 'NEWTON_METER' => ['1', 'Nm'], + 'OUNCE_FOOT' => ['0.084738622', 'ozft'], + 'OUNCE_INCH' => [['' => '0.084738622', '/' => '12'], 'ozin'], + 'POUND_FOOT' => [['' => '0.084738622', '*' => '16'], 'lbft'], + 'POUNDAL_FOOT' => ['0.0421401099752144', 'plft'], + 'POUND_INCH' => [['' => '0.084738622', '/' => '12', '*' => '16'], 'lbin'], 'STANDARD' => 'NEWTON_METER' - ); + ]; } diff --git a/library/Zend/Measure/Viscosity/Dynamic.php b/library/Zend/Measure/Viscosity/Dynamic.php index 8e9e29471c..aa7fad30a8 100644 --- a/library/Zend/Measure/Viscosity/Dynamic.php +++ b/library/Zend/Measure/Viscosity/Dynamic.php @@ -80,41 +80,41 @@ class Zend_Measure_Viscosity_Dynamic extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'CENTIPOISE' => array('0.001', 'cP'), - 'DECIPOISE' => array('0.01', 'dP'), - 'DYNE_SECOND_PER_SQUARE_CENTIMETER' => array('0.1', 'dyn s/cm²'), - 'GRAM_FORCE_SECOND_PER_SQUARE_CENTIMETER' => array('98.0665', 'gf s/cm²'), - 'GRAM_PER_CENTIMETER_SECOND' => array('0.1', 'g/cm s'), - 'KILOGRAM_FORCE_SECOND_PER_SQUARE_METER' => array('9.80665', 'kgf s/m²'), - 'KILOGRAM_PER_METER_HOUR' => array(array('' => '1', '/' => '3600'), 'kg/m h'), - 'KILOGRAM_PER_METER_SECOND' => array('1', 'kg/ms'), - 'MILLIPASCAL_SECOND' => array('0.001', 'mPa s'), - 'MILLIPOISE' => array('0.0001', 'mP'), - 'NEWTON_SECOND_PER_SQUARE_METER' => array('1', 'N s/m²'), - 'PASCAL_SECOND' => array('1', 'Pa s'), - 'POISE' => array('0.1', 'P'), - 'POISEUILLE' => array('1', 'Pl'), - 'POUND_FORCE_SECOND_PER_SQUARE_FEET' => array('47.880259', 'lbf s/ft²'), - 'POUND_FORCE_SECOND_PER_SQUARE_INCH' => array('6894.75729', 'lbf s/in²'), - 'POUND_PER_FOOT_HOUR' => array('0.00041337887', 'lb/ft h'), - 'POUND_PER_FOOT_SECOND' => array('1.4881639', 'lb/ft s'), - 'POUNDAL_HOUR_PER_SQUARE_FOOT' => array('0.00041337887', 'pdl h/ft²'), - 'POUNDAL_SECOND_PER_SQUARE_FOOT' => array('1.4881639', 'pdl s/ft²'), - 'REYN' => array('6894.75729', 'reyn'), - 'SLUG_PER_FOOT_SECOND'=> array('47.880259', 'slug/ft s'), - 'WATER_20C' => array('0.001', 'water (20°)'), - 'WATER_40C' => array('0.00065', 'water (40°)'), - 'HEAVY_OIL_20C' => array('0.45', 'oil (20°)'), - 'HEAVY_OIL_40C' => array('0.11', 'oil (40°)'), - 'GLYCERIN_20C' => array('1.41', 'glycerin (20°)'), - 'GLYCERIN_40C' => array('0.284', 'glycerin (40°)'), - 'SAE_5W_MINUS18C' => array('1.2', 'SAE 5W (-18°)'), - 'SAE_10W_MINUS18C' => array('2.4', 'SAE 10W (-18°)'), - 'SAE_20W_MINUS18C' => array('9.6', 'SAE 20W (-18°)'), - 'SAE_5W_99C' => array('0.0039', 'SAE 5W (99°)'), - 'SAE_10W_99C' => array('0.0042', 'SAE 10W (99°)'), - 'SAE_20W_99C' => array('0.0057', 'SAE 20W (99°)'), + protected $_units = [ + 'CENTIPOISE' => ['0.001', 'cP'], + 'DECIPOISE' => ['0.01', 'dP'], + 'DYNE_SECOND_PER_SQUARE_CENTIMETER' => ['0.1', 'dyn s/cm²'], + 'GRAM_FORCE_SECOND_PER_SQUARE_CENTIMETER' => ['98.0665', 'gf s/cm²'], + 'GRAM_PER_CENTIMETER_SECOND' => ['0.1', 'g/cm s'], + 'KILOGRAM_FORCE_SECOND_PER_SQUARE_METER' => ['9.80665', 'kgf s/m²'], + 'KILOGRAM_PER_METER_HOUR' => [['' => '1', '/' => '3600'], 'kg/m h'], + 'KILOGRAM_PER_METER_SECOND' => ['1', 'kg/ms'], + 'MILLIPASCAL_SECOND' => ['0.001', 'mPa s'], + 'MILLIPOISE' => ['0.0001', 'mP'], + 'NEWTON_SECOND_PER_SQUARE_METER' => ['1', 'N s/m²'], + 'PASCAL_SECOND' => ['1', 'Pa s'], + 'POISE' => ['0.1', 'P'], + 'POISEUILLE' => ['1', 'Pl'], + 'POUND_FORCE_SECOND_PER_SQUARE_FEET' => ['47.880259', 'lbf s/ft²'], + 'POUND_FORCE_SECOND_PER_SQUARE_INCH' => ['6894.75729', 'lbf s/in²'], + 'POUND_PER_FOOT_HOUR' => ['0.00041337887', 'lb/ft h'], + 'POUND_PER_FOOT_SECOND' => ['1.4881639', 'lb/ft s'], + 'POUNDAL_HOUR_PER_SQUARE_FOOT' => ['0.00041337887', 'pdl h/ft²'], + 'POUNDAL_SECOND_PER_SQUARE_FOOT' => ['1.4881639', 'pdl s/ft²'], + 'REYN' => ['6894.75729', 'reyn'], + 'SLUG_PER_FOOT_SECOND'=> ['47.880259', 'slug/ft s'], + 'WATER_20C' => ['0.001', 'water (20°)'], + 'WATER_40C' => ['0.00065', 'water (40°)'], + 'HEAVY_OIL_20C' => ['0.45', 'oil (20°)'], + 'HEAVY_OIL_40C' => ['0.11', 'oil (40°)'], + 'GLYCERIN_20C' => ['1.41', 'glycerin (20°)'], + 'GLYCERIN_40C' => ['0.284', 'glycerin (40°)'], + 'SAE_5W_MINUS18C' => ['1.2', 'SAE 5W (-18°)'], + 'SAE_10W_MINUS18C' => ['2.4', 'SAE 10W (-18°)'], + 'SAE_20W_MINUS18C' => ['9.6', 'SAE 20W (-18°)'], + 'SAE_5W_99C' => ['0.0039', 'SAE 5W (99°)'], + 'SAE_10W_99C' => ['0.0042', 'SAE 10W (99°)'], + 'SAE_20W_99C' => ['0.0057', 'SAE 20W (99°)'], 'STANDARD' => 'KILOGRAM_PER_METER_SECOND' - ); + ]; } diff --git a/library/Zend/Measure/Viscosity/Kinematic.php b/library/Zend/Measure/Viscosity/Kinematic.php index 9da9d8e855..d17a9cd1e4 100644 --- a/library/Zend/Measure/Viscosity/Kinematic.php +++ b/library/Zend/Measure/Viscosity/Kinematic.php @@ -72,35 +72,35 @@ class Zend_Measure_Viscosity_Kinematic extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'CENTISTOKES' => array('0.000001', 'cSt'), - 'LENTOR' => array('0.0001', 'lentor'), - 'LITER_PER_CENTIMETER_DAY' => array(array('' => '1', '/' => '864000'), 'l/cm day'), - 'LITER_PER_CENTIMETER_HOUR' => array(array('' => '1', '/' => '36000'), 'l/cm h'), - 'LITER_PER_CENTIMETER_MINUTE' => array(array('' => '1', '/' => '600'), 'l/cm m'), - 'LITER_PER_CENTIMETER_SECOND' => array('0.1', 'l/cm s'), - 'POISE_CUBIC_CENTIMETER_PER_GRAM' => array('0.0001', 'P cm³/g'), - 'SQUARE_CENTIMETER_PER_DAY' => array(array('' => '1', '/' => '864000000'),'cm²/day'), - 'SQUARE_CENTIMETER_PER_HOUR' => array(array('' => '1', '/' => '36000000'),'cm²/h'), - 'SQUARE_CENTIMETER_PER_MINUTE' => array(array('' => '1', '/' => '600000'),'cm²/m'), - 'SQUARE_CENTIMETER_PER_SECOND' => array('0.0001', 'cm²/s'), - 'SQUARE_FOOT_PER_DAY' => array('0.0000010752667', 'ft²/day'), - 'SQUARE_FOOT_PER_HOUR' => array('0.0000258064', 'ft²/h'), - 'SQUARE_FOOT_PER_MINUTE' => array('0.001548384048', 'ft²/m'), - 'SQUARE_FOOT_PER_SECOND' => array('0.09290304', 'ft²/s'), - 'SQUARE_INCH_PER_DAY' => array('7.4671296e-9', 'in²/day'), - 'SQUARE_INCH_PER_HOUR' => array('0.00000017921111', 'in²/h'), - 'SQUARE_INCH_PER_MINUTE' => array('0.000010752667', 'in²/m'), - 'SQUARE_INCH_PER_SECOND' => array('0.00064516', 'in²/s'), - 'SQUARE_METER_PER_DAY' => array(array('' => '1', '/' => '86400'), 'm²/day'), - 'SQUARE_METER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'm²/h'), - 'SQUARE_METER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'm²/m'), - 'SQUARE_METER_PER_SECOND' => array('1', 'm²/s'), - 'SQUARE_MILLIMETER_PER_DAY' => array(array('' => '1', '/' => '86400000000'), 'mm²/day'), - 'SQUARE_MILLIMETER_PER_HOUR' => array(array('' => '1', '/' => '3600000000'), 'mm²/h'), - 'SQUARE_MILLIMETER_PER_MINUTE' => array(array('' => '1', '/' => '60000000'), 'mm²/m'), - 'SQUARE_MILLIMETER_PER_SECOND' => array('0.000001', 'mm²/s'), - 'STOKES' => array('0.0001', 'St'), + protected $_units = [ + 'CENTISTOKES' => ['0.000001', 'cSt'], + 'LENTOR' => ['0.0001', 'lentor'], + 'LITER_PER_CENTIMETER_DAY' => [['' => '1', '/' => '864000'], 'l/cm day'], + 'LITER_PER_CENTIMETER_HOUR' => [['' => '1', '/' => '36000'], 'l/cm h'], + 'LITER_PER_CENTIMETER_MINUTE' => [['' => '1', '/' => '600'], 'l/cm m'], + 'LITER_PER_CENTIMETER_SECOND' => ['0.1', 'l/cm s'], + 'POISE_CUBIC_CENTIMETER_PER_GRAM' => ['0.0001', 'P cm³/g'], + 'SQUARE_CENTIMETER_PER_DAY' => [['' => '1', '/' => '864000000'],'cm²/day'], + 'SQUARE_CENTIMETER_PER_HOUR' => [['' => '1', '/' => '36000000'],'cm²/h'], + 'SQUARE_CENTIMETER_PER_MINUTE' => [['' => '1', '/' => '600000'],'cm²/m'], + 'SQUARE_CENTIMETER_PER_SECOND' => ['0.0001', 'cm²/s'], + 'SQUARE_FOOT_PER_DAY' => ['0.0000010752667', 'ft²/day'], + 'SQUARE_FOOT_PER_HOUR' => ['0.0000258064', 'ft²/h'], + 'SQUARE_FOOT_PER_MINUTE' => ['0.001548384048', 'ft²/m'], + 'SQUARE_FOOT_PER_SECOND' => ['0.09290304', 'ft²/s'], + 'SQUARE_INCH_PER_DAY' => ['7.4671296e-9', 'in²/day'], + 'SQUARE_INCH_PER_HOUR' => ['0.00000017921111', 'in²/h'], + 'SQUARE_INCH_PER_MINUTE' => ['0.000010752667', 'in²/m'], + 'SQUARE_INCH_PER_SECOND' => ['0.00064516', 'in²/s'], + 'SQUARE_METER_PER_DAY' => [['' => '1', '/' => '86400'], 'm²/day'], + 'SQUARE_METER_PER_HOUR' => [['' => '1', '/' => '3600'], 'm²/h'], + 'SQUARE_METER_PER_MINUTE' => [['' => '1', '/' => '60'], 'm²/m'], + 'SQUARE_METER_PER_SECOND' => ['1', 'm²/s'], + 'SQUARE_MILLIMETER_PER_DAY' => [['' => '1', '/' => '86400000000'], 'mm²/day'], + 'SQUARE_MILLIMETER_PER_HOUR' => [['' => '1', '/' => '3600000000'], 'mm²/h'], + 'SQUARE_MILLIMETER_PER_MINUTE' => [['' => '1', '/' => '60000000'], 'mm²/m'], + 'SQUARE_MILLIMETER_PER_SECOND' => ['0.000001', 'mm²/s'], + 'STOKES' => ['0.0001', 'St'], 'STANDARD' => 'SQUARE_METER_PER_SECOND' - ); + ]; } diff --git a/library/Zend/Measure/Volume.php b/library/Zend/Measure/Volume.php index 6fe63b6331..25e56a9fc9 100644 --- a/library/Zend/Measure/Volume.php +++ b/library/Zend/Measure/Volume.php @@ -125,89 +125,89 @@ class Zend_Measure_Volume extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ACRE_FOOT' => array('1233.48185532', 'ac ft'), - 'ACRE_FOOT_SURVEY' => array('1233.489', 'ac ft'), - 'ACRE_INCH' => array('102.79015461', 'ac in'), - 'BARREL_WINE' => array('0.143201835', 'bbl'), - 'BARREL' => array('0.16365924', 'bbl'), - 'BARREL_US_DRY' => array(array('' => '26.7098656608', '/' => '231'), 'bbl'), - 'BARREL_US_FEDERAL' => array('0.1173477658', 'bbl'), - 'BARREL_US' => array('0.1192404717', 'bbl'), - 'BARREL_US_PETROLEUM' => array('0.1589872956', 'bbl'), - 'BOARD_FOOT' => array(array('' => '6.5411915904', '/' => '2772'), 'board foot'), - 'BUCKET' => array('0.01818436', 'bucket'), - 'BUCKET_US' => array('0.018927059', 'bucket'), - 'BUSHEL' => array('0.03636872', 'bu'), - 'BUSHEL_US' => array('0.03523907', 'bu'), - 'CENTILITER' => array('0.00001', 'cl'), - 'CORD' => array('3.624556416', 'cd'), - 'CORD_FOOT' => array('0.453069552', 'cd ft'), - 'CUBIC_CENTIMETER' => array('0.000001', 'cm³'), - 'CUBIC_CUBIT' => array('0.144', 'cubit³'), - 'CUBIC_DECIMETER' => array('0.001', 'dm³'), - 'CUBIC_DEKAMETER' => array('1000', 'dam³'), - 'CUBIC_FOOT' => array(array('' => '6.54119159', '/' => '231'), 'ft³'), - 'CUBIC_INCH' => array(array('' => '0.0037854118', '/' => '231'), 'in³'), - 'CUBIC_KILOMETER' => array('1.0e+9', 'km³'), - 'CUBIC_METER' => array('1', 'm³'), - 'CUBIC_MILE' => array(array('' => '0.0037854118', '/' => '231', '*' => '75271680', '*' => '3379200'), - 'mi³'), - 'CUBIC_MICROMETER' => array('1.0e-18', 'µm³'), - 'CUBIC_MILLIMETER' => array('1.0e-9', 'mm³'), - 'CUBIC_YARD' => array(array('' => '0.0037854118', '/' => '231', '*' => '46656'), 'yd³'), - 'CUP_CANADA' => array('0.0002273045', 'c'), - 'CUP' => array('0.00025', 'c'), - 'CUP_US' => array(array('' => '0.0037854118', '/' => '16'), 'c'), - 'DECILITER' => array('0.0001', 'dl'), - 'DEKALITER' => array('0.001', 'dal'), - 'DRAM' => array(array('' => '0.0037854118', '/' => '1024'), 'dr'), - 'DRUM_US' => array('0.208197649', 'drum'), - 'DRUM' => array('0.2', 'drum'), - 'FIFTH' => array('0.00075708236', 'fifth'), - 'GALLON' => array('0.00454609', 'gal'), - 'GALLON_US_DRY' => array('0.0044048838', 'gal'), - 'GALLON_US' => array('0.0037854118', 'gal'), - 'GILL' => array(array('' => '0.00454609', '/' => '32'), 'gi'), - 'GILL_US' => array(array('' => '0.0037854118', '/' => '32'), 'gi'), - 'HECTARE_METER' => array('10000', 'ha m'), - 'HECTOLITER' => array('0.1', 'hl'), - 'HOGSHEAD' => array('0.28640367', 'hhd'), - 'HOGSHEAD_US' => array('0.2384809434', 'hhd'), - 'JIGGER' => array(array('' => '0.0037854118', '/' => '128', '*' => '1.5'), 'jigger'), - 'KILOLITER' => array('1', 'kl'), - 'LITER' => array('0.001', 'l'), - 'MEASURE' => array('0.0077', 'measure'), - 'MEGALITER' => array('1000', 'Ml'), - 'MICROLITER' => array('1.0e-9', 'µl'), - 'MILLILITER' => array('0.000001', 'ml'), - 'MINIM' => array(array('' => '0.00454609', '/' => '76800'), 'min'), - 'MINIM_US' => array(array('' => '0.0037854118','/' => '61440'), 'min'), - 'OUNCE' => array(array('' => '0.00454609', '/' => '160'), 'oz'), - 'OUNCE_US' => array(array('' => '0.0037854118', '/' => '128'), 'oz'), - 'PECK' => array('0.00909218', 'pk'), - 'PECK_US' => array('0.0088097676', 'pk'), - 'PINT' => array(array('' => '0.00454609', '/' => '8'), 'pt'), - 'PINT_US_DRY' => array(array('' => '0.0044048838', '/' => '8'), 'pt'), - 'PINT_US' => array(array('' => '0.0037854118', '/' => '8'), 'pt'), - 'PIPE' => array('0.49097772', 'pipe'), - 'PIPE_US' => array('0.4769618868', 'pipe'), - 'PONY' => array(array('' => '0.0037854118', '/' => '128'), 'pony'), - 'QUART_GERMANY' => array('0.00114504', 'qt'), - 'QUART_ANCIENT' => array('0.00108', 'qt'), - 'QUART' => array(array('' => '0.00454609', '/' => '4'), 'qt'), - 'QUART_US_DRY' => array(array('' => '0.0044048838', '/' => '4'), 'qt'), - 'QUART_US' => array(array('' => '0.0037854118', '/' => '4'), 'qt'), - 'QUART_UK' => array('0.29094976', 'qt'), - 'SHOT' => array(array('' => '0.0037854118', '/' => '128'), 'shot'), - 'STERE' => array('1', 'st'), - 'TABLESPOON' => array('0.000015', 'tbsp'), - 'TABLESPOON_UK' => array(array('' => '0.00454609', '/' => '320'), 'tbsp'), - 'TABLESPOON_US' => array(array('' => '0.0037854118', '/' => '256'), 'tbsp'), - 'TEASPOON' => array('0.000005', 'tsp'), - 'TEASPOON_UK' => array(array('' => '0.00454609', '/' => '1280'), 'tsp'), - 'TEASPOON_US' => array(array('' => '0.0037854118', '/' => '768'), 'tsp'), - 'YARD' => array(array('' => '176.6121729408', '/' => '231'), 'yd'), + protected $_units = [ + 'ACRE_FOOT' => ['1233.48185532', 'ac ft'], + 'ACRE_FOOT_SURVEY' => ['1233.489', 'ac ft'], + 'ACRE_INCH' => ['102.79015461', 'ac in'], + 'BARREL_WINE' => ['0.143201835', 'bbl'], + 'BARREL' => ['0.16365924', 'bbl'], + 'BARREL_US_DRY' => [['' => '26.7098656608', '/' => '231'], 'bbl'], + 'BARREL_US_FEDERAL' => ['0.1173477658', 'bbl'], + 'BARREL_US' => ['0.1192404717', 'bbl'], + 'BARREL_US_PETROLEUM' => ['0.1589872956', 'bbl'], + 'BOARD_FOOT' => [['' => '6.5411915904', '/' => '2772'], 'board foot'], + 'BUCKET' => ['0.01818436', 'bucket'], + 'BUCKET_US' => ['0.018927059', 'bucket'], + 'BUSHEL' => ['0.03636872', 'bu'], + 'BUSHEL_US' => ['0.03523907', 'bu'], + 'CENTILITER' => ['0.00001', 'cl'], + 'CORD' => ['3.624556416', 'cd'], + 'CORD_FOOT' => ['0.453069552', 'cd ft'], + 'CUBIC_CENTIMETER' => ['0.000001', 'cm³'], + 'CUBIC_CUBIT' => ['0.144', 'cubit³'], + 'CUBIC_DECIMETER' => ['0.001', 'dm³'], + 'CUBIC_DEKAMETER' => ['1000', 'dam³'], + 'CUBIC_FOOT' => [['' => '6.54119159', '/' => '231'], 'ft³'], + 'CUBIC_INCH' => [['' => '0.0037854118', '/' => '231'], 'in³'], + 'CUBIC_KILOMETER' => ['1.0e+9', 'km³'], + 'CUBIC_METER' => ['1', 'm³'], + 'CUBIC_MILE' => [['' => '0.0037854118', '/' => '231', '*' => '75271680', '*' => '3379200'], + 'mi³'], + 'CUBIC_MICROMETER' => ['1.0e-18', 'µm³'], + 'CUBIC_MILLIMETER' => ['1.0e-9', 'mm³'], + 'CUBIC_YARD' => [['' => '0.0037854118', '/' => '231', '*' => '46656'], 'yd³'], + 'CUP_CANADA' => ['0.0002273045', 'c'], + 'CUP' => ['0.00025', 'c'], + 'CUP_US' => [['' => '0.0037854118', '/' => '16'], 'c'], + 'DECILITER' => ['0.0001', 'dl'], + 'DEKALITER' => ['0.001', 'dal'], + 'DRAM' => [['' => '0.0037854118', '/' => '1024'], 'dr'], + 'DRUM_US' => ['0.208197649', 'drum'], + 'DRUM' => ['0.2', 'drum'], + 'FIFTH' => ['0.00075708236', 'fifth'], + 'GALLON' => ['0.00454609', 'gal'], + 'GALLON_US_DRY' => ['0.0044048838', 'gal'], + 'GALLON_US' => ['0.0037854118', 'gal'], + 'GILL' => [['' => '0.00454609', '/' => '32'], 'gi'], + 'GILL_US' => [['' => '0.0037854118', '/' => '32'], 'gi'], + 'HECTARE_METER' => ['10000', 'ha m'], + 'HECTOLITER' => ['0.1', 'hl'], + 'HOGSHEAD' => ['0.28640367', 'hhd'], + 'HOGSHEAD_US' => ['0.2384809434', 'hhd'], + 'JIGGER' => [['' => '0.0037854118', '/' => '128', '*' => '1.5'], 'jigger'], + 'KILOLITER' => ['1', 'kl'], + 'LITER' => ['0.001', 'l'], + 'MEASURE' => ['0.0077', 'measure'], + 'MEGALITER' => ['1000', 'Ml'], + 'MICROLITER' => ['1.0e-9', 'µl'], + 'MILLILITER' => ['0.000001', 'ml'], + 'MINIM' => [['' => '0.00454609', '/' => '76800'], 'min'], + 'MINIM_US' => [['' => '0.0037854118','/' => '61440'], 'min'], + 'OUNCE' => [['' => '0.00454609', '/' => '160'], 'oz'], + 'OUNCE_US' => [['' => '0.0037854118', '/' => '128'], 'oz'], + 'PECK' => ['0.00909218', 'pk'], + 'PECK_US' => ['0.0088097676', 'pk'], + 'PINT' => [['' => '0.00454609', '/' => '8'], 'pt'], + 'PINT_US_DRY' => [['' => '0.0044048838', '/' => '8'], 'pt'], + 'PINT_US' => [['' => '0.0037854118', '/' => '8'], 'pt'], + 'PIPE' => ['0.49097772', 'pipe'], + 'PIPE_US' => ['0.4769618868', 'pipe'], + 'PONY' => [['' => '0.0037854118', '/' => '128'], 'pony'], + 'QUART_GERMANY' => ['0.00114504', 'qt'], + 'QUART_ANCIENT' => ['0.00108', 'qt'], + 'QUART' => [['' => '0.00454609', '/' => '4'], 'qt'], + 'QUART_US_DRY' => [['' => '0.0044048838', '/' => '4'], 'qt'], + 'QUART_US' => [['' => '0.0037854118', '/' => '4'], 'qt'], + 'QUART_UK' => ['0.29094976', 'qt'], + 'SHOT' => [['' => '0.0037854118', '/' => '128'], 'shot'], + 'STERE' => ['1', 'st'], + 'TABLESPOON' => ['0.000015', 'tbsp'], + 'TABLESPOON_UK' => [['' => '0.00454609', '/' => '320'], 'tbsp'], + 'TABLESPOON_US' => [['' => '0.0037854118', '/' => '256'], 'tbsp'], + 'TEASPOON' => ['0.000005', 'tsp'], + 'TEASPOON_UK' => [['' => '0.00454609', '/' => '1280'], 'tsp'], + 'TEASPOON_US' => [['' => '0.0037854118', '/' => '768'], 'tsp'], + 'YARD' => [['' => '176.6121729408', '/' => '231'], 'yd'], 'STANDARD' => 'CUBIC_METER' - ); + ]; } diff --git a/library/Zend/Measure/Weight.php b/library/Zend/Measure/Weight.php index 685e40477d..15aa784bb2 100644 --- a/library/Zend/Measure/Weight.php +++ b/library/Zend/Measure/Weight.php @@ -259,222 +259,222 @@ class Zend_Measure_Weight extends Zend_Measure_Abstract * * @var array */ - protected $_units = array( - 'ARRATEL' => array('0.5', 'arratel'), - 'ARTEL' => array('0.5', 'artel'), - 'ARROBA_PORTUGUESE' => array('14.69', 'arroba'), - 'ARROBA' => array('11.502', '@'), - 'AS_' => array('0.000052', 'as'), - 'ASS' => array('0.000052', 'ass'), - 'ATOMIC_MASS_UNIT_1960' => array('1.6603145e-27', 'amu'), - 'ATOMIC_MASS_UNIT_1973' => array('1.6605655e-27', 'amu'), - 'ATOMIC_MASS_UNIT_1986' => array('1.6605402e-27', 'amu'), - 'ATOMIC_MASS_UNIT' => array('1.66053873e-27', 'amu'), - 'AVOGRAM' => array('1.6605402e-27', 'avogram'), - 'BAG' => array('42.63768278', 'bag'), - 'BAHT' => array('0.015', 'baht'), - 'BALE' => array('326.5865064', 'bl'), - 'BALE_US' => array('217.7243376', 'bl'), - 'BISMAR_POUND' => array('5.993', 'bismar pound'), - 'CANDY' => array('254', 'candy'), - 'CARAT_INTERNATIONAL' => array('0.0002', 'ct'), - 'CARAT' => array('0.0002', 'ct'), - 'CARAT_UK' => array('0.00025919564', 'ct'), - 'CARAT_US_1913' => array('0.0002053', 'ct'), - 'CARGA' => array('140', 'carga'), - 'CATTI' => array('0.604875', 'catti'), - 'CATTI_JAPANESE' => array('0.594', 'catti'), - 'CATTY' => array('0.5', 'catty'), - 'CATTY_JAPANESE' => array('0.6', 'catty'), - 'CATTY_THAI' => array('0.6', 'catty'), - 'CENTAL' => array('45.359237', 'cH'), - 'CENTIGRAM' => array('0.00001', 'cg'), - 'CENTNER' => array('50', 'centner'), - 'CENTNER_RUSSIAN' => array('100', 'centner'), - 'CHALDER' => array('2692.52', 'chd'), - 'CHALDRON' => array('2692.52', 'chd'), - 'CHIN' => array('0.5', 'chin'), - 'CHIN_JAPANESE' => array('0.6', 'chin'), - 'CLOVE' => array('3.175', 'clove'), - 'CRITH' => array('0.000089885', 'crith'), - 'DALTON' => array('1.6605402e-27', 'D'), - 'DAN' => array('50', 'dan'), - 'DAN_JAPANESE' => array('60', 'dan'), - 'DECIGRAM' => array('0.0001', 'dg'), - 'DECITONNE' => array('100', 'dt'), - 'DEKAGRAM' => array('0.01', 'dag'), - 'DEKATONNE' => array('10000', 'dat'), - 'DENARO' => array('0.0011', 'denaro'), - 'DENIER' => array('0.001275', 'denier'), - 'DRACHME' => array('0.0038', 'drachme'), - 'DRAM' => array(array('' => '0.45359237', '/' => '256'), 'dr'), - 'DRAM_APOTHECARIES' => array('0.0038879346', 'dr'), - 'DYNE' => array('1.0197162e-6', 'dyn'), - 'ELECTRON' => array('9.109382e-31', 'e−'), - 'ELECTRONVOLT' => array('1.782662e-36', 'eV'), - 'ETTO' => array('0.1', 'hg'), - 'EXAGRAM' => array('1.0e+15', 'Eg'), - 'FEMTOGRAM' => array('1.0e-18', 'fg'), - 'FIRKIN' => array('25.40117272', 'fir'), - 'FLASK' => array('34.7', 'flask'), - 'FOTHER' => array('979.7595192', 'fother'), - 'FOTMAL' => array('32.65865064', 'fotmal'), - 'FUNT' => array('0.4095', 'funt'), - 'FUNTE' => array('0.4095', 'funte'), - 'GAMMA' => array('0.000000001', 'gamma'), - 'GIGAELECTRONVOLT' => array('1.782662e-27', 'GeV'), - 'GIGAGRAM' => array('1000000', 'Gg'), - 'GIGATONNE' => array('1.0e+12', 'Gt'), - 'GIN' => array('0.6', 'gin'), - 'GIN_JAPANESE' => array('0.594', 'gin'), - 'GRAIN' => array('0.00006479891', 'gr'), - 'GRAM' => array('0.001', 'g'), - 'GRAN' => array('0.00082', 'gran'), - 'GRANO' => array('0.00004905', 'grano'), - 'GRANI' => array('0.00004905', 'grani'), - 'GROS' => array('0.003824', 'gros'), - 'HECTOGRAM' => array('0.1', 'hg'), - 'HUNDRETWEIGHT' => array('50.80234544', 'cwt'), - 'HUNDRETWEIGHT_US' => array('45.359237', 'cwt'), - 'HYL' => array('9.80665', 'hyl'), - 'JIN' => array('0.5', 'jin'), - 'JUPITER' => array('1.899e+27', 'jupiter'), - 'KATI' => array('0.5', 'kati'), - 'KATI_JAPANESE' => array('0.6', 'kati'), - 'KEEL' => array('21540.19446656', 'keel'), - 'KEG' => array('45.359237', 'keg'), - 'KILODALTON' => array('1.6605402e-24', 'kD'), - 'KILOGRAM' => array('1', 'kg'), - 'KILOGRAM_FORCE' => array('1', 'kgf'), - 'KILOTON' => array('1016046.9088', 'kt'), - 'KILOTON_US' => array('907184.74', 'kt'), - 'KILOTONNE' => array('1000000', 'kt'), - 'KIN' => array('0.6', 'kin'), - 'KIP' => array('453.59237', 'kip'), - 'KOYAN' => array('2419', 'koyan'), - 'KWAN' => array('3.75', 'kwan'), - 'LAST_GERMANY' => array('2000', 'last'), - 'LAST' => array('1814.36948', 'last'), - 'LAST_WOOL' => array('1981.29147216', 'last'), - 'LB' => array('0.45359237', 'lb'), - 'LBS' => array('0.45359237', 'lbs'), - 'LIANG' => array('0.05', 'liang'), - 'LIBRE_ITALIAN' => array('0.339', 'lb'), - 'LIBRA_SPANISH' => array('0.459', 'lb'), - 'LIBRA_PORTUGUESE' => array('0.459', 'lb'), - 'LIBRA_ANCIENT' => array('0.323', 'lb'), - 'LIBRA' => array('1', 'lb'), - 'LIVRE' => array('0.4895', 'livre'), - 'LONG_TON' => array('1016.0469088', 't'), - 'LOT' => array('0.015', 'lot'), - 'MACE' => array('0.003778', 'mace'), - 'MAHND' => array('0.9253284348', 'mahnd'), - 'MARC' => array('0.24475', 'marc'), - 'MARCO' => array('0.23', 'marco'), - 'MARK' => array('0.2268', 'mark'), - 'MARK_GERMANY' => array('0.2805', 'mark'), - 'MAUND' => array('37.3242', 'maund'), - 'MAUND_PAKISTAN' => array('40', 'maund'), - 'MEGADALTON' => array('1.6605402e-21', 'MD'), - 'MEGAGRAM' => array('1000', 'Mg'), - 'MEGATONNE' => array('1.0e+9', 'Mt'), - 'MERCANTILE_POUND' => array('0.46655', 'lb merc'), - 'METRIC_TON' => array('1000', 't'), - 'MIC' => array('1.0e-9', 'mic'), - 'MICROGRAM' => array('1.0e-9', '�g'), - 'MILLIDALTON' => array('1.6605402e-30', 'mD'), - 'MILLIER' => array('1000', 'millier'), - 'MILLIGRAM' => array('0.000001', 'mg'), - 'MILLIMASS_UNIT' => array('1.6605402e-30', 'mmu'), - 'MINA' => array('0.499', 'mina'), - 'MOMME' => array('0.00375', 'momme'), - 'MYRIAGRAM' => array('10', 'myg'), - 'NANOGRAM' => array('1.0e-12', 'ng'), - 'NEWTON' => array('0.101971621', 'N'), - 'OBOL' => array('0.0001', 'obol'), - 'OBOLOS' => array('0.0001', 'obolos'), - 'OBOLUS' => array('0.0001', 'obolus'), - 'OBOLOS_ANCIENT' => array('0.0005', 'obolos'), - 'OBOLUS_ANCIENT' => array('0.00057', 'obolos'), - 'OKA' => array('1.28', 'oka'), - 'ONCA' => array('0.02869', 'onca'), - 'ONCE' => array('0.03059', 'once'), - 'ONCIA' => array('0.0273', 'oncia'), - 'ONZA' => array('0.02869', 'onza'), - 'ONS' => array('0.1', 'ons'), - 'OUNCE' => array(array('' => '0.45359237', '/' => '16'), 'oz'), - 'OUNCE_FORCE' => array(array('' => '0.45359237', '/' => '16'), 'ozf'), - 'OUNCE_TROY' => array(array('' => '65.31730128', '/' => '2100'), 'oz'), - 'PACKEN' => array('490.79', 'packen'), - 'PENNYWEIGHT' => array(array('' => '65.31730128', '/' => '42000'), 'dwt'), - 'PETAGRAM' => array('1.0e+12', 'Pg'), - 'PFUND' => array('0.5', 'pfd'), - 'PICOGRAM' => array('1.0e-15', 'pg'), - 'POINT' => array('0.000002', 'pt'), - 'POND' => array('0.5', 'pond'), - 'POUND' => array('0.45359237', 'lb'), - 'POUND_FORCE' => array('0.4535237', 'lbf'), - 'POUND_METRIC' => array('0.5', 'lb'), - 'POUND_TROY' => array(array('' => '65.31730128', '/' => '175'), 'lb'), - 'PUD' => array('16.3', 'pud'), - 'POOD' => array('16.3', 'pood'), - 'PUND' => array('0.5', 'pund'), - 'QIAN' => array('0.005', 'qian'), - 'QINTAR' => array('50', 'qintar'), - 'QUARTER' => array('12.70058636', 'qtr'), - 'QUARTER_US' => array('11.33980925', 'qtr'), - 'QUARTER_TON' => array('226.796185', 'qtr'), - 'QUARTERN' => array('1.587573295', 'quartern'), - 'QUARTERN_LOAF' => array('1.81436948', 'quartern-loaf'), - 'QUINTAL_FRENCH' => array('48.95', 'q'), - 'QUINTAL' => array('100', 'q'), - 'QUINTAL_PORTUGUESE' => array('58.752', 'q'), - 'QUINTAL_SPAIN' => array('45.9', 'q'), - 'REBAH' => array('0.2855', 'rebah'), - 'ROTL' => array('0.5', 'rotl'), - 'ROTEL' => array('0.5', 'rotel'), - 'ROTTLE' => array('0.5', 'rottle'), - 'RATEL' => array('0.5', 'ratel'), - 'SACK' => array('165.10762268', 'sack'), - 'SCRUPLE' => array(array('' => '65.31730128', '/' => '50400'), 's'), - 'SEER' => array('0.933105', 'seer'), - 'SEER_PAKISTAN' => array('1', 'seer'), - 'SHEKEL' => array('0.01142', 'shekel'), - 'SHORT_TON' => array('907.18474', 'st'), - 'SLINCH' => array('175.126908', 'slinch'), - 'SLUG' => array('14.593903', 'slug'), - 'STONE' => array('6.35029318', 'st'), - 'TAEL' => array('0.03751', 'tael'), - 'TAHIL_JAPANESE' => array('0.03751', 'tahil'), - 'TAHIL' => array('0.05', 'tahil'), - 'TALENT' => array('30', 'talent'), - 'TAN' => array('50', 'tan'), - 'TECHNISCHE_MASS_EINHEIT' => array('9.80665', 'TME'), - 'TERAGRAM' => array('1.0e+9', 'Tg'), - 'TETRADRACHM' => array('0.014', 'tetradrachm'), - 'TICAL' => array('0.0164', 'tical'), - 'TOD' => array('12.70058636', 'tod'), - 'TOLA' => array('0.0116638125', 'tola'), - 'TOLA_PAKISTAN' => array('0.0125', 'tola'), - 'TON_UK' => array('1016.0469088', 't'), - 'TON' => array('1000', 't'), - 'TON_US' => array('907.18474', 't'), - 'TONELADA_PORTUGUESE' => array('793.15', 'tonelada'), - 'TONELADA' => array('919.9', 'tonelada'), - 'TONNE' => array('1000', 't'), - 'TONNEAU' => array('979', 'tonneau'), - 'TOVAR' => array('128.8', 'tovar'), - 'TROY_OUNCE' => array(array('' => '65.31730128', '/' => '2100'), 'troy oz'), - 'TROY_POUND' => array(array('' => '65.31730128', '/' => '175'), 'troy lb'), - 'TRUSS' => array('25.40117272', 'truss'), - 'UNCIA' => array('0.0272875', 'uncia'), - 'UNZE' => array('0.03125', 'unze'), - 'VAGON' => array('10000', 'vagon'), - 'YOCTOGRAM' => array('1.0e-27', 'yg'), - 'YOTTAGRAM' => array('1.0e+21', 'Yg'), - 'ZENTNER' => array('50', 'Ztr'), - 'ZEPTOGRAM' => array('1.0e-24', 'zg'), - 'ZETTAGRAM' => array('1.0e+18', 'Zg'), + protected $_units = [ + 'ARRATEL' => ['0.5', 'arratel'], + 'ARTEL' => ['0.5', 'artel'], + 'ARROBA_PORTUGUESE' => ['14.69', 'arroba'], + 'ARROBA' => ['11.502', '@'], + 'AS_' => ['0.000052', 'as'], + 'ASS' => ['0.000052', 'ass'], + 'ATOMIC_MASS_UNIT_1960' => ['1.6603145e-27', 'amu'], + 'ATOMIC_MASS_UNIT_1973' => ['1.6605655e-27', 'amu'], + 'ATOMIC_MASS_UNIT_1986' => ['1.6605402e-27', 'amu'], + 'ATOMIC_MASS_UNIT' => ['1.66053873e-27', 'amu'], + 'AVOGRAM' => ['1.6605402e-27', 'avogram'], + 'BAG' => ['42.63768278', 'bag'], + 'BAHT' => ['0.015', 'baht'], + 'BALE' => ['326.5865064', 'bl'], + 'BALE_US' => ['217.7243376', 'bl'], + 'BISMAR_POUND' => ['5.993', 'bismar pound'], + 'CANDY' => ['254', 'candy'], + 'CARAT_INTERNATIONAL' => ['0.0002', 'ct'], + 'CARAT' => ['0.0002', 'ct'], + 'CARAT_UK' => ['0.00025919564', 'ct'], + 'CARAT_US_1913' => ['0.0002053', 'ct'], + 'CARGA' => ['140', 'carga'], + 'CATTI' => ['0.604875', 'catti'], + 'CATTI_JAPANESE' => ['0.594', 'catti'], + 'CATTY' => ['0.5', 'catty'], + 'CATTY_JAPANESE' => ['0.6', 'catty'], + 'CATTY_THAI' => ['0.6', 'catty'], + 'CENTAL' => ['45.359237', 'cH'], + 'CENTIGRAM' => ['0.00001', 'cg'], + 'CENTNER' => ['50', 'centner'], + 'CENTNER_RUSSIAN' => ['100', 'centner'], + 'CHALDER' => ['2692.52', 'chd'], + 'CHALDRON' => ['2692.52', 'chd'], + 'CHIN' => ['0.5', 'chin'], + 'CHIN_JAPANESE' => ['0.6', 'chin'], + 'CLOVE' => ['3.175', 'clove'], + 'CRITH' => ['0.000089885', 'crith'], + 'DALTON' => ['1.6605402e-27', 'D'], + 'DAN' => ['50', 'dan'], + 'DAN_JAPANESE' => ['60', 'dan'], + 'DECIGRAM' => ['0.0001', 'dg'], + 'DECITONNE' => ['100', 'dt'], + 'DEKAGRAM' => ['0.01', 'dag'], + 'DEKATONNE' => ['10000', 'dat'], + 'DENARO' => ['0.0011', 'denaro'], + 'DENIER' => ['0.001275', 'denier'], + 'DRACHME' => ['0.0038', 'drachme'], + 'DRAM' => [['' => '0.45359237', '/' => '256'], 'dr'], + 'DRAM_APOTHECARIES' => ['0.0038879346', 'dr'], + 'DYNE' => ['1.0197162e-6', 'dyn'], + 'ELECTRON' => ['9.109382e-31', 'e−'], + 'ELECTRONVOLT' => ['1.782662e-36', 'eV'], + 'ETTO' => ['0.1', 'hg'], + 'EXAGRAM' => ['1.0e+15', 'Eg'], + 'FEMTOGRAM' => ['1.0e-18', 'fg'], + 'FIRKIN' => ['25.40117272', 'fir'], + 'FLASK' => ['34.7', 'flask'], + 'FOTHER' => ['979.7595192', 'fother'], + 'FOTMAL' => ['32.65865064', 'fotmal'], + 'FUNT' => ['0.4095', 'funt'], + 'FUNTE' => ['0.4095', 'funte'], + 'GAMMA' => ['0.000000001', 'gamma'], + 'GIGAELECTRONVOLT' => ['1.782662e-27', 'GeV'], + 'GIGAGRAM' => ['1000000', 'Gg'], + 'GIGATONNE' => ['1.0e+12', 'Gt'], + 'GIN' => ['0.6', 'gin'], + 'GIN_JAPANESE' => ['0.594', 'gin'], + 'GRAIN' => ['0.00006479891', 'gr'], + 'GRAM' => ['0.001', 'g'], + 'GRAN' => ['0.00082', 'gran'], + 'GRANO' => ['0.00004905', 'grano'], + 'GRANI' => ['0.00004905', 'grani'], + 'GROS' => ['0.003824', 'gros'], + 'HECTOGRAM' => ['0.1', 'hg'], + 'HUNDRETWEIGHT' => ['50.80234544', 'cwt'], + 'HUNDRETWEIGHT_US' => ['45.359237', 'cwt'], + 'HYL' => ['9.80665', 'hyl'], + 'JIN' => ['0.5', 'jin'], + 'JUPITER' => ['1.899e+27', 'jupiter'], + 'KATI' => ['0.5', 'kati'], + 'KATI_JAPANESE' => ['0.6', 'kati'], + 'KEEL' => ['21540.19446656', 'keel'], + 'KEG' => ['45.359237', 'keg'], + 'KILODALTON' => ['1.6605402e-24', 'kD'], + 'KILOGRAM' => ['1', 'kg'], + 'KILOGRAM_FORCE' => ['1', 'kgf'], + 'KILOTON' => ['1016046.9088', 'kt'], + 'KILOTON_US' => ['907184.74', 'kt'], + 'KILOTONNE' => ['1000000', 'kt'], + 'KIN' => ['0.6', 'kin'], + 'KIP' => ['453.59237', 'kip'], + 'KOYAN' => ['2419', 'koyan'], + 'KWAN' => ['3.75', 'kwan'], + 'LAST_GERMANY' => ['2000', 'last'], + 'LAST' => ['1814.36948', 'last'], + 'LAST_WOOL' => ['1981.29147216', 'last'], + 'LB' => ['0.45359237', 'lb'], + 'LBS' => ['0.45359237', 'lbs'], + 'LIANG' => ['0.05', 'liang'], + 'LIBRE_ITALIAN' => ['0.339', 'lb'], + 'LIBRA_SPANISH' => ['0.459', 'lb'], + 'LIBRA_PORTUGUESE' => ['0.459', 'lb'], + 'LIBRA_ANCIENT' => ['0.323', 'lb'], + 'LIBRA' => ['1', 'lb'], + 'LIVRE' => ['0.4895', 'livre'], + 'LONG_TON' => ['1016.0469088', 't'], + 'LOT' => ['0.015', 'lot'], + 'MACE' => ['0.003778', 'mace'], + 'MAHND' => ['0.9253284348', 'mahnd'], + 'MARC' => ['0.24475', 'marc'], + 'MARCO' => ['0.23', 'marco'], + 'MARK' => ['0.2268', 'mark'], + 'MARK_GERMANY' => ['0.2805', 'mark'], + 'MAUND' => ['37.3242', 'maund'], + 'MAUND_PAKISTAN' => ['40', 'maund'], + 'MEGADALTON' => ['1.6605402e-21', 'MD'], + 'MEGAGRAM' => ['1000', 'Mg'], + 'MEGATONNE' => ['1.0e+9', 'Mt'], + 'MERCANTILE_POUND' => ['0.46655', 'lb merc'], + 'METRIC_TON' => ['1000', 't'], + 'MIC' => ['1.0e-9', 'mic'], + 'MICROGRAM' => ['1.0e-9', '�g'], + 'MILLIDALTON' => ['1.6605402e-30', 'mD'], + 'MILLIER' => ['1000', 'millier'], + 'MILLIGRAM' => ['0.000001', 'mg'], + 'MILLIMASS_UNIT' => ['1.6605402e-30', 'mmu'], + 'MINA' => ['0.499', 'mina'], + 'MOMME' => ['0.00375', 'momme'], + 'MYRIAGRAM' => ['10', 'myg'], + 'NANOGRAM' => ['1.0e-12', 'ng'], + 'NEWTON' => ['0.101971621', 'N'], + 'OBOL' => ['0.0001', 'obol'], + 'OBOLOS' => ['0.0001', 'obolos'], + 'OBOLUS' => ['0.0001', 'obolus'], + 'OBOLOS_ANCIENT' => ['0.0005', 'obolos'], + 'OBOLUS_ANCIENT' => ['0.00057', 'obolos'], + 'OKA' => ['1.28', 'oka'], + 'ONCA' => ['0.02869', 'onca'], + 'ONCE' => ['0.03059', 'once'], + 'ONCIA' => ['0.0273', 'oncia'], + 'ONZA' => ['0.02869', 'onza'], + 'ONS' => ['0.1', 'ons'], + 'OUNCE' => [['' => '0.45359237', '/' => '16'], 'oz'], + 'OUNCE_FORCE' => [['' => '0.45359237', '/' => '16'], 'ozf'], + 'OUNCE_TROY' => [['' => '65.31730128', '/' => '2100'], 'oz'], + 'PACKEN' => ['490.79', 'packen'], + 'PENNYWEIGHT' => [['' => '65.31730128', '/' => '42000'], 'dwt'], + 'PETAGRAM' => ['1.0e+12', 'Pg'], + 'PFUND' => ['0.5', 'pfd'], + 'PICOGRAM' => ['1.0e-15', 'pg'], + 'POINT' => ['0.000002', 'pt'], + 'POND' => ['0.5', 'pond'], + 'POUND' => ['0.45359237', 'lb'], + 'POUND_FORCE' => ['0.4535237', 'lbf'], + 'POUND_METRIC' => ['0.5', 'lb'], + 'POUND_TROY' => [['' => '65.31730128', '/' => '175'], 'lb'], + 'PUD' => ['16.3', 'pud'], + 'POOD' => ['16.3', 'pood'], + 'PUND' => ['0.5', 'pund'], + 'QIAN' => ['0.005', 'qian'], + 'QINTAR' => ['50', 'qintar'], + 'QUARTER' => ['12.70058636', 'qtr'], + 'QUARTER_US' => ['11.33980925', 'qtr'], + 'QUARTER_TON' => ['226.796185', 'qtr'], + 'QUARTERN' => ['1.587573295', 'quartern'], + 'QUARTERN_LOAF' => ['1.81436948', 'quartern-loaf'], + 'QUINTAL_FRENCH' => ['48.95', 'q'], + 'QUINTAL' => ['100', 'q'], + 'QUINTAL_PORTUGUESE' => ['58.752', 'q'], + 'QUINTAL_SPAIN' => ['45.9', 'q'], + 'REBAH' => ['0.2855', 'rebah'], + 'ROTL' => ['0.5', 'rotl'], + 'ROTEL' => ['0.5', 'rotel'], + 'ROTTLE' => ['0.5', 'rottle'], + 'RATEL' => ['0.5', 'ratel'], + 'SACK' => ['165.10762268', 'sack'], + 'SCRUPLE' => [['' => '65.31730128', '/' => '50400'], 's'], + 'SEER' => ['0.933105', 'seer'], + 'SEER_PAKISTAN' => ['1', 'seer'], + 'SHEKEL' => ['0.01142', 'shekel'], + 'SHORT_TON' => ['907.18474', 'st'], + 'SLINCH' => ['175.126908', 'slinch'], + 'SLUG' => ['14.593903', 'slug'], + 'STONE' => ['6.35029318', 'st'], + 'TAEL' => ['0.03751', 'tael'], + 'TAHIL_JAPANESE' => ['0.03751', 'tahil'], + 'TAHIL' => ['0.05', 'tahil'], + 'TALENT' => ['30', 'talent'], + 'TAN' => ['50', 'tan'], + 'TECHNISCHE_MASS_EINHEIT' => ['9.80665', 'TME'], + 'TERAGRAM' => ['1.0e+9', 'Tg'], + 'TETRADRACHM' => ['0.014', 'tetradrachm'], + 'TICAL' => ['0.0164', 'tical'], + 'TOD' => ['12.70058636', 'tod'], + 'TOLA' => ['0.0116638125', 'tola'], + 'TOLA_PAKISTAN' => ['0.0125', 'tola'], + 'TON_UK' => ['1016.0469088', 't'], + 'TON' => ['1000', 't'], + 'TON_US' => ['907.18474', 't'], + 'TONELADA_PORTUGUESE' => ['793.15', 'tonelada'], + 'TONELADA' => ['919.9', 'tonelada'], + 'TONNE' => ['1000', 't'], + 'TONNEAU' => ['979', 'tonneau'], + 'TOVAR' => ['128.8', 'tovar'], + 'TROY_OUNCE' => [['' => '65.31730128', '/' => '2100'], 'troy oz'], + 'TROY_POUND' => [['' => '65.31730128', '/' => '175'], 'troy lb'], + 'TRUSS' => ['25.40117272', 'truss'], + 'UNCIA' => ['0.0272875', 'uncia'], + 'UNZE' => ['0.03125', 'unze'], + 'VAGON' => ['10000', 'vagon'], + 'YOCTOGRAM' => ['1.0e-27', 'yg'], + 'YOTTAGRAM' => ['1.0e+21', 'Yg'], + 'ZENTNER' => ['50', 'Ztr'], + 'ZEPTOGRAM' => ['1.0e-24', 'zg'], + 'ZETTAGRAM' => ['1.0e+18', 'Zg'], 'STANDARD' => 'KILOGRAM' - ); + ]; } diff --git a/library/Zend/Memory.php b/library/Zend/Memory.php index 39c1e10ac3..2e1b25ddea 100644 --- a/library/Zend/Memory.php +++ b/library/Zend/Memory.php @@ -47,7 +47,7 @@ class Zend_Memory * @return Zend_Memory_Manager * @throws Zend_Memory_Exception */ - public static function factory($backend, $backendOptions = array()) + public static function factory($backend, $backendOptions = []) { if (strcasecmp($backend, 'none') == 0) { return new Zend_Memory_Manager(); diff --git a/library/Zend/Memory/Manager.php b/library/Zend/Memory/Manager.php index ece4380a0a..87185cdc06 100644 --- a/library/Zend/Memory/Manager.php +++ b/library/Zend/Memory/Manager.php @@ -94,7 +94,7 @@ class Zend_Memory_Manager * * @var array */ - private $_unloadCandidates = array(); + private $_unloadCandidates = []; /** * List of object sizes. @@ -105,7 +105,7 @@ class Zend_Memory_Manager * * @var array */ - private $_sizes = array(); + private $_sizes = []; /** * Last modified object @@ -145,7 +145,7 @@ private function _generateMemManagerId() * (Ex. backend interface should be extended to provide this functionality) */ $this->_managerId = uniqid('ZendMemManager', true); - $this->_tags = array($this->_managerId); + $this->_tags = [$this->_managerId]; $this->_managerId .= '_'; } diff --git a/library/Zend/Mime.php b/library/Zend/Mime.php index 5530b6cb59..99014a2c72 100644 --- a/library/Zend/Mime.php +++ b/library/Zend/Mime.php @@ -61,7 +61,7 @@ class Zend_Mime * * @var array */ - public static $qpKeys = array( + public static $qpKeys = [ "\x00", "\x01", "\x02", @@ -223,12 +223,12 @@ class Zend_Mime "\xFD", "\xFE", "\xFF" - ); + ]; /** * @var array */ - public static $qpReplaceValues = array( + public static $qpReplaceValues = [ "=00", "=01", "=02", @@ -390,7 +390,7 @@ class Zend_Mime "=FD", "=FE", "=FF" - ); + ]; /** * @var string @@ -497,11 +497,11 @@ public static function encodeQuotedPrintableHeader( // Mail-Header required chars have to be encoded also: $str = str_replace( - array('?', ' ', '_', ','), array('=3F', '=20', '=5F', '=2C'), $str + ['?', ' ', '_', ','], ['=3F', '=20', '=5F', '=2C'], $str ); // initialize first line, we need it anyways - $lines = array(0 => ""); + $lines = [0 => ""]; // Split encoded text into separate lines $tmp = ""; diff --git a/library/Zend/Mime/Decode.php b/library/Zend/Mime/Decode.php index caf03e1e16..9632e53ac8 100644 --- a/library/Zend/Mime/Decode.php +++ b/library/Zend/Mime/Decode.php @@ -48,14 +48,14 @@ public static function splitMime($body, $boundary) $body = str_replace("\r", '', $body); $start = 0; - $res = array(); + $res = []; // find every mime part limiter and cut out the // string before it. // the part before the first boundary string is discarded: $p = strpos($body, '--' . $boundary . "\n", $start); if ($p === false) { // no parts found! - return array(); + return []; } // position after first boundary line @@ -96,13 +96,13 @@ public static function splitMessageStruct( if (count($parts) <= 0) { return null; } - $result = array(); + $result = []; foreach ($parts as $part) { self::splitMessage($part, $headers, $body, $EOL); - $result[] = array( + $result[] = [ 'header' => $headers, 'body' => $body - ); + ]; } return $result; @@ -127,16 +127,16 @@ public static function splitMessage( // check for valid header at first line $firstline = strtok($message, "\n"); if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) { - $headers = array(); + $headers = []; // TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r? $body = str_replace( - array( + [ "\r", "\n" - ), array( + ], [ '', $EOL - ), $message + ], $message ); return; @@ -186,10 +186,10 @@ public static function splitMessage( $headers[$lower][] = $header; continue; } - $headers[$lower] = array( + $headers[$lower] = [ $headers[$lower], $header - ); + ]; } } @@ -248,7 +248,7 @@ public static function splitHeaderField( return null; } - $split = array(); + $split = []; foreach ($matches[1] as $key => $name) { $name = strtolower($name); if ($matches[2][$key][0] == '"') { diff --git a/library/Zend/Mime/Message.php b/library/Zend/Mime/Message.php index 71e383c266..5870158e4f 100644 --- a/library/Zend/Mime/Message.php +++ b/library/Zend/Mime/Message.php @@ -42,7 +42,7 @@ class Zend_Mime_Message * * @var array */ - protected $_parts = array(); + protected $_parts = []; /** * The Zend_Mime object for the message @@ -213,14 +213,14 @@ public function getPartContent($partnum, $EOL = Zend_Mime::LINEEND) protected static function _disassembleMime($body, $boundary) { $start = 0; - $res = array(); + $res = []; // find every mime part limiter and cut out the // string before it. // the part before the first boundary string is discarded: $p = strpos($body, '--' . $boundary . "\n", $start); if ($p === false) { // no parts found! - return array(); + return []; } // position after first boundary line diff --git a/library/Zend/Mime/Part.php b/library/Zend/Mime/Part.php index c28e95cf44..0d5fa51dd9 100644 --- a/library/Zend/Mime/Part.php +++ b/library/Zend/Mime/Part.php @@ -174,10 +174,10 @@ public function getEncodedStream() $this->_content, 'convert.quoted-printable-encode', STREAM_FILTER_READ, - array( + [ 'line-length' => 76, 'line-break-chars' => Zend_Mime::LINEEND - ) + ] ); if (!is_resource($filter)) { require_once 'Zend/Mime/Exception.php'; @@ -192,10 +192,10 @@ public function getEncodedStream() $this->_content, 'convert.base64-encode', STREAM_FILTER_READ, - array( + [ 'line-length' => 76, 'line-break-chars' => Zend_Mime::LINEEND - ) + ] ); if (!is_resource($filter)) { require_once 'Zend/Mime/Exception.php'; @@ -249,7 +249,7 @@ public function getRawContent() */ public function getHeadersArray($EOL = Zend_Mime::LINEEND) { - $headers = array(); + $headers = []; $contentType = $this->type; if ($this->charset) { @@ -261,23 +261,23 @@ public function getHeadersArray($EOL = Zend_Mime::LINEEND) . " boundary=\"" . $this->boundary . '"'; } - $headers[] = array( + $headers[] = [ 'Content-Type', $contentType - ); + ]; if ($this->encoding) { - $headers[] = array( + $headers[] = [ 'Content-Transfer-Encoding', $this->encoding - ); + ]; } if ($this->id) { - $headers[] = array( + $headers[] = [ 'Content-ID', '<' . $this->id . '>' - ); + ]; } if ($this->disposition) { @@ -285,31 +285,31 @@ public function getHeadersArray($EOL = Zend_Mime::LINEEND) if ($this->filename) { $disposition .= '; filename="' . $this->filename . '"'; } - $headers[] = array( + $headers[] = [ 'Content-Disposition', $disposition - ); + ]; } if ($this->description) { - $headers[] = array( + $headers[] = [ 'Content-Description', $this->description - ); + ]; } if ($this->location) { - $headers[] = array( + $headers[] = [ 'Content-Location', $this->location - ); + ]; } if ($this->language) { - $headers[] = array( + $headers[] = [ 'Content-Language', $this->language - ); + ]; } return $headers; diff --git a/library/Zend/Mobile/Push/Apns.php b/library/Zend/Mobile/Push/Apns.php index 28a5c69972..86f1850fa0 100644 --- a/library/Zend/Mobile/Push/Apns.php +++ b/library/Zend/Mobile/Push/Apns.php @@ -52,12 +52,12 @@ class Zend_Mobile_Push_Apns extends Zend_Mobile_Push_Abstract * * @var array */ - protected $_serverUriList = array( + protected $_serverUriList = [ 'ssl://gateway.sandbox.push.apple.com:2195', 'ssl://gateway.push.apple.com:2195', 'ssl://feedback.sandbox.push.apple.com:2196', 'ssl://feedback.push.apple.com:2196' - ); + ]; /** * Current Environment @@ -151,9 +151,9 @@ public function setCertificatePassphrase($passphrase) */ protected function _connect($uri) { - $ssl = array( + $ssl = [ 'local_cert' => $this->_certificate, - ); + ]; if ($this->_certificatePassphrase) { $ssl['passphrase'] = $this->_certificatePassphrase; } @@ -163,9 +163,9 @@ protected function _connect($uri) $errstr, ini_get('default_socket_timeout'), STREAM_CLIENT_CONNECT, - stream_context_create(array( + stream_context_create([ 'ssl' => $ssl, - )) + ]) ); if (!is_resource($this->_socket)) { @@ -251,11 +251,11 @@ public function feedback() { if (!$this->_isConnected || !in_array($this->_currentEnv, - array(self::SERVER_FEEDBACK_SANDBOX_URI, self::SERVER_FEEDBACK_PRODUCTION_URI))) { + [self::SERVER_FEEDBACK_SANDBOX_URI, self::SERVER_FEEDBACK_PRODUCTION_URI])) { $this->connect(self::SERVER_FEEDBACK_PRODUCTION_URI); } - $tokens = array(); + $tokens = []; while ($token = $this->_read(38)) { if (strlen($token) < 38) { continue; @@ -285,13 +285,13 @@ public function send(Zend_Mobile_Push_Message_Abstract $message) throw new Zend_Mobile_Push_Exception('The message is not valid.'); } - if (!$this->_isConnected || !in_array($this->_currentEnv, array( + if (!$this->_isConnected || !in_array($this->_currentEnv, [ self::SERVER_SANDBOX_URI, - self::SERVER_PRODUCTION_URI))) { + self::SERVER_PRODUCTION_URI])) { $this->connect(self::SERVER_PRODUCTION_URI); } - $payload = array('aps' => array()); + $payload = ['aps' => []]; $alert = $message->getAlert(); foreach ($alert as $k => $v) { diff --git a/library/Zend/Mobile/Push/Gcm.php b/library/Zend/Mobile/Push/Gcm.php index bd3e5f58a1..51cb304797 100644 --- a/library/Zend/Mobile/Push/Gcm.php +++ b/library/Zend/Mobile/Push/Gcm.php @@ -99,9 +99,9 @@ public function getHttpClient() { if (!$this->_httpClient) { $this->_httpClient = new Zend_Http_Client(); - $this->_httpClient->setConfig(array( + $this->_httpClient->setConfig([ 'strictredirects' => true, - )); + ]); } return $this->_httpClient; } diff --git a/library/Zend/Mobile/Push/Message/Apns.php b/library/Zend/Mobile/Push/Message/Apns.php index 1dd637e10f..5193e530de 100644 --- a/library/Zend/Mobile/Push/Message/Apns.php +++ b/library/Zend/Mobile/Push/Message/Apns.php @@ -47,7 +47,7 @@ class Zend_Mobile_Push_Message_Apns extends Zend_Mobile_Push_Message_Abstract * * @var array */ - protected $_alert = array(); + protected $_alert = []; /** * Expiration @@ -68,7 +68,7 @@ class Zend_Mobile_Push_Message_Apns extends Zend_Mobile_Push_Message_Abstract * * @var array */ - protected $_custom = array(); + protected $_custom = []; /** * Get Alert @@ -121,13 +121,13 @@ public function setAlert($text, $actionLocKey=null, $locKey=null, $locArgs=null, throw new Zend_Mobile_Push_Message_Exception('$launchImage must be a string'); } - $this->_alert = array( + $this->_alert = [ 'body' => $text, 'action-loc-key' => $actionLocKey, 'loc-key' => $locKey, 'loc-args' => $locArgs, 'launch-image' => $launchImage, - ); + ]; return $this; } @@ -237,7 +237,7 @@ public function addCustomData($key, $value) */ public function clearCustomData() { - $this->_custom = array(); + $this->_custom = []; return $this; } @@ -250,7 +250,7 @@ public function clearCustomData() */ public function setCustomData($array) { - $this->_custom = array(); + $this->_custom = []; foreach ($array as $k => $v) { $this->addCustomData($k, $v); } diff --git a/library/Zend/Mobile/Push/Message/Gcm.php b/library/Zend/Mobile/Push/Message/Gcm.php index 8a4dae7ee9..4db7f91025 100644 --- a/library/Zend/Mobile/Push/Message/Gcm.php +++ b/library/Zend/Mobile/Push/Message/Gcm.php @@ -42,14 +42,14 @@ class Zend_Mobile_Push_Message_Gcm extends Zend_Mobile_Push_Message_Abstract * * @var array */ - protected $_token = array(); + protected $_token = []; /** * Data key value pairs * * @var array */ - protected $_data = array(); + protected $_data = []; /** * Delay while idle @@ -110,7 +110,7 @@ public function setToken($token) */ public function clearToken() { - $this->_token = array(); + $this->_token = []; return $this; } @@ -158,7 +158,7 @@ public function setData(array $data) */ public function clearData() { - $this->_data = array(); + $this->_data = []; return $this; } @@ -252,7 +252,7 @@ public function validate() */ public function toJson() { - $json = array(); + $json = []; if ($this->_token) { $json['registration_ids'] = $this->_token; } diff --git a/library/Zend/Mobile/Push/Message/Mpns/Raw.php b/library/Zend/Mobile/Push/Message/Mpns/Raw.php index 99d87802bc..020d62583a 100644 --- a/library/Zend/Mobile/Push/Message/Mpns/Raw.php +++ b/library/Zend/Mobile/Push/Message/Mpns/Raw.php @@ -74,11 +74,11 @@ public function getDelay() */ public function setDelay($delay) { - if (!in_array($delay, array( + if (!in_array($delay, [ self::DELAY_IMMEDIATE, self::DELAY_450S, self::DELAY_900S - ))) { + ])) { throw new Zend_Mobile_Push_Message_Exception('$delay must be one of the DELAY_* constants'); } $this->_delay = $delay; diff --git a/library/Zend/Mobile/Push/Message/Mpns/Tile.php b/library/Zend/Mobile/Push/Message/Mpns/Tile.php index 965412452d..9e8faccf0b 100644 --- a/library/Zend/Mobile/Push/Message/Mpns/Tile.php +++ b/library/Zend/Mobile/Push/Message/Mpns/Tile.php @@ -294,11 +294,11 @@ public function getDelay() */ public function setDelay($delay) { - if (!in_array($delay, array( + if (!in_array($delay, [ self::DELAY_IMMEDIATE, self::DELAY_450S, self::DELAY_900S - ))) { + ])) { throw new Zend_Mobile_Push_Message_Exception('$delay must be one of the DELAY_* constants'); } $this->_delay = $delay; diff --git a/library/Zend/Mobile/Push/Message/Mpns/Toast.php b/library/Zend/Mobile/Push/Message/Mpns/Toast.php index 14381c1a77..9d05ffa019 100644 --- a/library/Zend/Mobile/Push/Message/Mpns/Toast.php +++ b/library/Zend/Mobile/Push/Message/Mpns/Toast.php @@ -163,11 +163,11 @@ public function getDelay() */ public function setDelay($delay) { - if (!in_array($delay, array( + if (!in_array($delay, [ self::DELAY_IMMEDIATE, self::DELAY_450S, self::DELAY_900S - ))) { + ])) { throw new Zend_Mobile_Push_Message_Exception('$delay must be one of the DELAY_* constants'); } $this->_delay = $delay; diff --git a/library/Zend/Mobile/Push/Mpns.php b/library/Zend/Mobile/Push/Mpns.php index 01e84c2f86..ecf88cf60c 100644 --- a/library/Zend/Mobile/Push/Mpns.php +++ b/library/Zend/Mobile/Push/Mpns.php @@ -57,9 +57,9 @@ public function getHttpClient() { if (!$this->_httpClient) { $this->_httpClient = new Zend_Http_Client(); - $this->_httpClient->setConfig(array( + $this->_httpClient->setConfig([ 'strictredirects' => true, - )); + ]); } return $this->_httpClient; } @@ -98,11 +98,11 @@ public function send(Zend_Mobile_Push_Message_Abstract $message) $client = $this->getHttpClient(); $client->setUri($message->getToken()); - $client->setHeaders(array( + $client->setHeaders([ 'Context-Type' => 'text/xml', 'Accept' => 'application/*', 'X-NotificationClass' => $message->getDelay() - )); + ]); if ($message->getId()) { $client->setHeaders('X-MessageID', $message->getId()); } diff --git a/library/Zend/Mobile/Push/Response/Gcm.php b/library/Zend/Mobile/Push/Response/Gcm.php index 6222e6dce5..491931124e 100644 --- a/library/Zend/Mobile/Push/Response/Gcm.php +++ b/library/Zend/Mobile/Push/Response/Gcm.php @@ -215,7 +215,7 @@ public function getResults() */ public function getResult($flag) { - $ret = array(); + $ret = []; foreach ($this->_correlate() as $k => $v) { if (isset($v[$flag])) { $ret[$k] = $v[$flag]; diff --git a/library/Zend/Navigation/Container.php b/library/Zend/Navigation/Container.php index 8a05075f07..a5ba11677e 100644 --- a/library/Zend/Navigation/Container.php +++ b/library/Zend/Navigation/Container.php @@ -36,14 +36,14 @@ abstract class Zend_Navigation_Container implements RecursiveIterator, Countable * * @var Zend_Navigation_Page[] */ - protected $_pages = array(); + protected $_pages = []; /** * An index that contains the order in which to iterate pages * * @var array */ - protected $_index = array(); + protected $_index = []; /** * Whether index is dirty and needs to be re-arranged @@ -62,7 +62,7 @@ abstract class Zend_Navigation_Container implements RecursiveIterator, Countable protected function _sort() { if ($this->_dirtyIndex) { - $newIndex = array(); + $newIndex = []; $index = 0; foreach ($this->_pages as $hash => $page) { @@ -245,8 +245,8 @@ public function removePage($page, $recursive = false) */ public function removePages() { - $this->_pages = array(); - $this->_index = array(); + $this->_pages = []; + $this->_index = []; return $this; } @@ -364,7 +364,7 @@ public function findOneBy($property, $value, $useRegex = false) */ public function findAllBy($property, $value, $useRegex = false) { - $found = array(); + $found = []; $iterator = new RecursiveIteratorIterator( $this, @@ -488,7 +488,7 @@ public function __call($method, $arguments) */ public function toArray() { - $pages = array(); + $pages = []; $this->_dirtyIndex = true; $this->_sort(); diff --git a/library/Zend/Navigation/Page.php b/library/Zend/Navigation/Page.php index c3a799800f..b67fdeca24 100644 --- a/library/Zend/Navigation/Page.php +++ b/library/Zend/Navigation/Page.php @@ -102,7 +102,7 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container * * @var array */ - protected $_rel = array(); + protected $_rel = []; /** * Reverse links to other pages @@ -111,7 +111,7 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container * * @var array */ - protected $_rev = array(); + protected $_rev = []; /** * Page order used by parent container @@ -160,14 +160,14 @@ abstract class Zend_Navigation_Page extends Zend_Navigation_Container * * @var array */ - protected $_properties = array(); + protected $_properties = []; /** * Custom HTML attributes * * @var array */ - protected $_customHtmlAttribs = array(); + protected $_customHtmlAttribs = []; /** * The type of page to use when it wasn't set @@ -566,7 +566,7 @@ public function getAccesskey() */ public function setRel($relations = null) { - $this->_rel = array(); + $this->_rel = []; if (null !== $relations) { if ($relations instanceof Zend_Config) { @@ -629,7 +629,7 @@ public function getRel($relation = null) */ public function setRev($relations = null) { - $this->_rev = array(); + $this->_rev = []; if (null !== $relations) { if ($relations instanceof Zend_Config) { @@ -786,7 +786,7 @@ public function removeCustomHtmlAttrib($name) */ public function clearCustomHtmlAttribs() { - $this->_customHtmlAttribs = array(); + $this->_customHtmlAttribs = []; return $this; } @@ -1307,7 +1307,7 @@ public function toArray() { return array_merge( $this->getCustomProperties(), - array( + [ 'label' => $this->getlabel(), 'fragment' => $this->getFragment(), 'id' => $this->getId(), @@ -1325,7 +1325,7 @@ public function toArray() 'visible' => $this->isVisible(), 'type' => get_class($this), 'pages' => parent::toArray() - ) + ] ); } diff --git a/library/Zend/Navigation/Page/Mvc.php b/library/Zend/Navigation/Page/Mvc.php index 4c55f378c0..ee330fb6ae 100644 --- a/library/Zend/Navigation/Page/Mvc.php +++ b/library/Zend/Navigation/Page/Mvc.php @@ -76,7 +76,7 @@ class Zend_Navigation_Page_Mvc extends Zend_Navigation_Page * @see getHref() * @var array */ - protected $_params = array(); + protected $_params = []; /** * Route name to use when assembling URL @@ -162,7 +162,7 @@ public function isActive($recursive = false) if (null === $this->_active) { $front = Zend_Controller_Front::getInstance(); $request = $front->getRequest(); - $reqParams = array(); + $reqParams = []; if ($request) { $reqParams = $request->getParams(); if (!array_key_exists('module', $reqParams)) { @@ -480,7 +480,7 @@ public function removeParam($name) */ public function clearParams() { - $this->_params = array(); + $this->_params = []; $this->_hrefCache = null; return $this; @@ -681,7 +681,7 @@ public function toArray() { return array_merge( parent::toArray(), - array( + [ 'action' => $this->getAction(), 'controller' => $this->getController(), 'module' => $this->getModule(), @@ -690,7 +690,7 @@ public function toArray() 'reset_params' => $this->getResetParams(), 'encodeUrl' => $this->getEncodeUrl(), 'scheme' => $this->getScheme(), - ) + ] ); } } diff --git a/library/Zend/Navigation/Page/Uri.php b/library/Zend/Navigation/Page/Uri.php index 130b0d4d1a..3851a56ac2 100644 --- a/library/Zend/Navigation/Page/Uri.php +++ b/library/Zend/Navigation/Page/Uri.php @@ -104,8 +104,8 @@ public function toArray() { return array_merge( parent::toArray(), - array( + [ 'uri' => $this->getUri() - )); + ]); } } diff --git a/library/Zend/Oauth/Client.php b/library/Zend/Oauth/Client.php index 03b794dc84..7d260eca4a 100644 --- a/library/Zend/Oauth/Client.php +++ b/library/Zend/Oauth/Client.php @@ -261,7 +261,7 @@ public function prepareOauth() $this->_getSignableParametersAsQueryString() ); $this->setRawData($raw, 'application/x-www-form-urlencoded'); - $this->paramsPost = array(); + $this->paramsPost = []; } elseif ($requestScheme == Zend_Oauth::REQUEST_SCHEME_QUERYSTRING) { $params = $this->paramsGet; $query = $this->getUri()->getQuery(); @@ -283,7 +283,7 @@ public function prepareOauth() $this->getUri(true), $this->_config, $params ); $this->getUri()->setQuery($query); - $this->paramsGet = array(); + $this->paramsGet = []; } else { require_once 'Zend/Oauth/Exception.php'; throw new Zend_Oauth_Exception('Invalid request scheme: ' . $requestScheme); @@ -298,7 +298,7 @@ public function prepareOauth() */ protected function _getSignableParametersAsQueryString() { - $params = array(); + $params = []; if (!empty($this->paramsGet)) { $params = array_merge($params, $this->paramsGet); } @@ -324,6 +324,6 @@ public function __call($method, array $args) require_once 'Zend/Oauth/Exception.php'; throw new Zend_Oauth_Exception('Method does not exist: ' . $method); } - return call_user_func_array(array($this->_config,$method), $args); + return call_user_func_array([$this->_config,$method], $args); } } diff --git a/library/Zend/Oauth/Config.php b/library/Zend/Oauth/Config.php index 61ab53cf56..2f5812999b 100644 --- a/library/Zend/Oauth/Config.php +++ b/library/Zend/Oauth/Config.php @@ -293,9 +293,9 @@ public function getConsumerSecret() public function setSignatureMethod($method) { $method = strtoupper($method); - if (!in_array($method, array( + if (!in_array($method, [ 'HMAC-SHA1', 'HMAC-SHA256', 'RSA-SHA1', 'PLAINTEXT' - )) + ]) ) { require_once 'Zend/Oauth/Exception.php'; throw new Zend_Oauth_Exception('Unsupported signature method: ' @@ -326,11 +326,11 @@ public function getSignatureMethod() public function setRequestScheme($scheme) { $scheme = strtolower($scheme); - if (!in_array($scheme, array( + if (!in_array($scheme, [ Zend_Oauth::REQUEST_SCHEME_HEADER, Zend_Oauth::REQUEST_SCHEME_POSTBODY, Zend_Oauth::REQUEST_SCHEME_QUERYSTRING, - )) + ]) ) { require_once 'Zend/Oauth/Exception.php'; throw new Zend_Oauth_Exception( @@ -576,13 +576,13 @@ public function getAuthorizeUrl() public function setRequestMethod($method) { $method = strtoupper($method); - if (!in_array($method, array( + if (!in_array($method, [ Zend_Oauth::GET, Zend_Oauth::POST, Zend_Oauth::PUT, Zend_Oauth::DELETE, Zend_Oauth::OPTIONS, - )) + ]) ) { require_once 'Zend/Oauth/Exception.php'; throw new Zend_Oauth_Exception('Invalid method: ' . $method); diff --git a/library/Zend/Oauth/Consumer.php b/library/Zend/Oauth/Consumer.php index 5f5f32ffb4..785187056d 100644 --- a/library/Zend/Oauth/Consumer.php +++ b/library/Zend/Oauth/Consumer.php @@ -199,9 +199,9 @@ public function getAccessToken( // OAuth 1.0a Verifier if ($authorizedToken->getParam('oauth_verifier') !== null) { - $params = array_merge($request->getParameters(), array( + $params = array_merge($request->getParameters(), [ 'oauth_verifier' => $authorizedToken->getParam('oauth_verifier') - )); + ]); $request->setParameters($params); } if ($httpMethod !== null) { @@ -274,6 +274,6 @@ public function __call($method, array $args) require_once 'Zend/Oauth/Exception.php'; throw new Zend_Oauth_Exception('Method does not exist: '.$method); } - return call_user_func_array(array($this->_config,$method), $args); + return call_user_func_array([$this->_config,$method], $args); } } diff --git a/library/Zend/Oauth/Http.php b/library/Zend/Oauth/Http.php index 6cf79ac4f1..9d7a5a4769 100644 --- a/library/Zend/Oauth/Http.php +++ b/library/Zend/Oauth/Http.php @@ -39,7 +39,7 @@ class Zend_Oauth_Http * * @var array */ - protected $_parameters = array(); + protected $_parameters = []; /** * Reference to the Zend_Oauth_Consumer instance in use. @@ -104,7 +104,7 @@ public function __construct( */ public function setMethod($method) { - if (!in_array($method, array(Zend_Oauth::POST, Zend_Oauth::GET))) { + if (!in_array($method, [Zend_Oauth::POST, Zend_Oauth::GET])) { require_once 'Zend/Oauth/Exception.php'; throw new Zend_Oauth_Exception('invalid HTTP method: ' . $method); } @@ -250,7 +250,7 @@ protected function _assessRequestAttempt(Zend_Http_Response $response = null) */ protected function _toAuthorizationHeader(array $params, $realm = null) { - $headerValue = array(); + $headerValue = []; $headerValue[] = 'OAuth realm="' . $realm . '"'; foreach ($params as $key => $value) { if (!preg_match("/^oauth_/", $key)) { diff --git a/library/Zend/Oauth/Http/AccessToken.php b/library/Zend/Oauth/Http/AccessToken.php index 8efd0f16b1..095b577935 100644 --- a/library/Zend/Oauth/Http/AccessToken.php +++ b/library/Zend/Oauth/Http/AccessToken.php @@ -60,14 +60,14 @@ public function execute() */ public function assembleParams() { - $params = array( + $params = [ 'oauth_consumer_key' => $this->_consumer->getConsumerKey(), 'oauth_nonce' => $this->_httpUtility->generateNonce(), 'oauth_signature_method' => $this->_consumer->getSignatureMethod(), 'oauth_timestamp' => $this->_httpUtility->generateTimestamp(), 'oauth_token' => $this->_consumer->getLastRequestToken()->getToken(), 'oauth_version' => $this->_consumer->getVersion(), - ); + ]; if (!empty($this->_parameters)) { $params = array_merge($params, $this->_parameters); diff --git a/library/Zend/Oauth/Http/RequestToken.php b/library/Zend/Oauth/Http/RequestToken.php index 44ae2da7a1..6625cd5c0d 100644 --- a/library/Zend/Oauth/Http/RequestToken.php +++ b/library/Zend/Oauth/Http/RequestToken.php @@ -60,13 +60,13 @@ public function execute() */ public function assembleParams() { - $params = array( + $params = [ 'oauth_consumer_key' => $this->_consumer->getConsumerKey(), 'oauth_nonce' => $this->_httpUtility->generateNonce(), 'oauth_timestamp' => $this->_httpUtility->generateTimestamp(), 'oauth_signature_method' => $this->_consumer->getSignatureMethod(), 'oauth_version' => $this->_consumer->getVersion(), - ); + ]; // indicates we support 1.0a if ($this->_consumer->getCallbackUrl()) { diff --git a/library/Zend/Oauth/Http/UserAuthorization.php b/library/Zend/Oauth/Http/UserAuthorization.php index 8582bac056..d24486d430 100644 --- a/library/Zend/Oauth/Http/UserAuthorization.php +++ b/library/Zend/Oauth/Http/UserAuthorization.php @@ -58,9 +58,9 @@ public function getUrl() */ public function assembleParams() { - $params = array( + $params = [ 'oauth_token' => $this->_consumer->getLastRequestToken()->getToken(), - ); + ]; if (!Zend_Oauth_Client::$supportsRevisionA) { $callback = $this->_consumer->getCallbackUrl(); diff --git a/library/Zend/Oauth/Http/Utility.php b/library/Zend/Oauth/Http/Utility.php index 3c063744b7..8442bd7287 100644 --- a/library/Zend/Oauth/Http/Utility.php +++ b/library/Zend/Oauth/Http/Utility.php @@ -47,13 +47,13 @@ public function assembleParams( Zend_Oauth_Config_ConfigInterface $config, array $serviceProviderParams = null ) { - $params = array( + $params = [ 'oauth_consumer_key' => $config->getConsumerKey(), 'oauth_nonce' => $this->generateNonce(), 'oauth_signature_method' => $config->getSignatureMethod(), 'oauth_timestamp' => $this->generateTimestamp(), 'oauth_version' => $config->getVersion(), - ); + ]; if ($config->getToken()->getToken() != null) { $params['oauth_token'] = $config->getToken()->getToken(); @@ -94,7 +94,7 @@ public function toEncodedQueryString(array $params, $customParamsOnly = false) } } } - $encodedParams = array(); + $encodedParams = []; foreach ($params as $key => $value) { $encodedParams[] = self::urlEncode($key) . '=' @@ -113,9 +113,9 @@ public function toEncodedQueryString(array $params, $customParamsOnly = false) */ public function toAuthorizationHeader(array $params, $realm = null, $excludeCustomParams = true) { - $headerValue = array( + $headerValue = [ 'OAuth realm="' . $realm . '"', - ); + ]; foreach ($params as $key => $value) { if ($excludeCustomParams) { @@ -167,9 +167,9 @@ public function sign( */ public function parseQueryString($query) { - $params = array(); + $params = []; if (empty($query)) { - return array(); + return []; } // Not remotely perfect but beats parse_str() which converts diff --git a/library/Zend/Oauth/Signature/Plaintext.php b/library/Zend/Oauth/Signature/Plaintext.php index e39b676770..00b289e084 100644 --- a/library/Zend/Oauth/Signature/Plaintext.php +++ b/library/Zend/Oauth/Signature/Plaintext.php @@ -43,7 +43,7 @@ public function sign(array $params, $method = null, $url = null) if ($this->_tokenSecret === null) { return $this->_consumerSecret . '&'; } - $return = implode('&', array($this->_consumerSecret, $this->_tokenSecret)); + $return = implode('&', [$this->_consumerSecret, $this->_tokenSecret]); return $return; } } diff --git a/library/Zend/Oauth/Signature/SignatureAbstract.php b/library/Zend/Oauth/Signature/SignatureAbstract.php index 688f4606ce..1ec1275f45 100644 --- a/library/Zend/Oauth/Signature/SignatureAbstract.php +++ b/library/Zend/Oauth/Signature/SignatureAbstract.php @@ -114,7 +114,7 @@ public function normaliseBaseSignatureUrl($url) */ protected function _assembleKey() { - $parts = array($this->_consumerSecret); + $parts = [$this->_consumerSecret]; if ($this->_tokenSecret !== null) { $parts[] = $this->_tokenSecret; } @@ -134,12 +134,12 @@ protected function _assembleKey() */ protected function _getBaseSignatureString(array $params, $method = null, $url = null) { - $encodedParams = array(); + $encodedParams = []; foreach ($params as $key => $value) { $encodedParams[Zend_Oauth_Http_Utility::urlEncode($key)] = Zend_Oauth_Http_Utility::urlEncode($value); } - $baseStrings = array(); + $baseStrings = []; if (isset($method)) { $baseStrings[] = strtoupper($method); } @@ -166,7 +166,7 @@ protected function _getBaseSignatureString(array $params, $method = null, $url = */ protected function _toByteValueOrderedQueryString(array $params) { - $return = array(); + $return = []; uksort($params, 'strnatcmp'); foreach ($params as $key => $value) { if (is_array($value)) { diff --git a/library/Zend/Oauth/Token.php b/library/Zend/Oauth/Token.php index 08f23e5c12..aa5de270e5 100644 --- a/library/Zend/Oauth/Token.php +++ b/library/Zend/Oauth/Token.php @@ -43,7 +43,7 @@ abstract class Zend_Oauth_Token * * @var array */ - protected $_params = array(); + protected $_params = []; /** * OAuth response object @@ -250,7 +250,7 @@ public function __toString() */ protected function _parseParameters(Zend_Http_Response $response) { - $params = array(); + $params = []; $body = $response->getBody(); if (empty($body)) { return; @@ -270,7 +270,7 @@ protected function _parseParameters(Zend_Http_Response $response) */ public function __sleep() { - return array('_params'); + return ['_params']; } /** diff --git a/library/Zend/Oauth/Token/AuthorizedRequest.php b/library/Zend/Oauth/Token/AuthorizedRequest.php index 9ae2bbb032..549a681c5a 100644 --- a/library/Zend/Oauth/Token/AuthorizedRequest.php +++ b/library/Zend/Oauth/Token/AuthorizedRequest.php @@ -33,7 +33,7 @@ class Zend_Oauth_Token_AuthorizedRequest extends Zend_Oauth_Token /** * @var array */ - protected $_data = array(); + protected $_data = []; /** * Constructor @@ -90,7 +90,7 @@ public function isValid() */ protected function _parseData() { - $params = array(); + $params = []; if (empty($this->_data)) { return; } diff --git a/library/Zend/OpenId.php b/library/Zend/OpenId.php index 2e6e57c788..53077114dc 100644 --- a/library/Zend/OpenId.php +++ b/library/Zend/OpenId.php @@ -627,14 +627,14 @@ static protected function bigNumToBin($bn) static public function createDhKey($p, $g, $priv_key = null) { if (function_exists('openssl_dh_compute_key')) { - $dh_details = array( + $dh_details = [ 'p' => $p, 'g' => $g - ); + ]; if ($priv_key !== null) { $dh_details['priv_key'] = $priv_key; } - return openssl_pkey_new(array('dh'=>$dh_details)); + return openssl_pkey_new(['dh'=>$dh_details]); } else { $bn_p = self::binToBigNum($p); $bn_g = self::binToBigNum($g); @@ -649,16 +649,16 @@ static public function createDhKey($p, $g, $priv_key = null) } $pub_key = self::bigNumToBin($bn_pub_key); - return array( + return [ 'p' => $bn_p, 'g' => $bn_g, 'priv_key' => $bn_priv_key, 'pub_key' => $bn_pub_key, - 'details' => array( + 'details' => [ 'p' => $p, 'g' => $g, 'priv_key' => $priv_key, - 'pub_key' => $pub_key)); + 'pub_key' => $pub_key]]; } } diff --git a/library/Zend/OpenId/Consumer.php b/library/Zend/OpenId/Consumer.php index f9d11f56ca..c30a3711e2 100644 --- a/library/Zend/OpenId/Consumer.php +++ b/library/Zend/OpenId/Consumer.php @@ -56,7 +56,7 @@ class Zend_OpenId_Consumer /** * Parameters required for signature */ - protected $_signParams = array('op_endpoint', 'return_to', 'response_nonce', 'assoc_handle'); + protected $_signParams = ['op_endpoint', 'return_to', 'response_nonce', 'assoc_handle']; /** * Reference to an implementation of storage object @@ -78,7 +78,7 @@ class Zend_OpenId_Consumer * * @var array $_cache */ - protected $_cache = array(); + protected $_cache = []; /** * HTTP client to make HTTP requests @@ -306,7 +306,7 @@ public function verify($params, &$identity = "", $extensions = null) // @see https://openid.net/specs/openid-authentication-2_0.html#positive_assertions $toCheck = $this->_signParams; if (isset($params['openid_claimed_id']) && isset($params['openid_identity'])) { - $toCheck = array_merge($toCheck, array('claimed_id', 'identity')); + $toCheck = array_merge($toCheck, ['claimed_id', 'identity']); } foreach ($toCheck as $param) { if (!in_array($param, $signed, true)) { @@ -379,7 +379,7 @@ public function verify($params, &$identity = "", $extensions = null) return false; } - $params2 = array(); + $params2 = []; foreach ($params as $key => $val) { if (strpos($key, 'openid_ns_') === 0) { $key = 'openid.ns.' . substr($key, strlen('openid_ns_')); @@ -396,7 +396,7 @@ public function verify($params, &$identity = "", $extensions = null) $this->_setError("'Dumb' signature verification HTTP request failed"); return false; } - $r = array(); + $r = []; if (is_string($ret)) { foreach(explode("\n", $ret) as $line) { $line = trim($line); @@ -444,7 +444,7 @@ public function verify($params, &$identity = "", $extensions = null) */ protected function _addAssociation($url, $handle, $macFunc, $secret, $expires) { - $this->_cache[$url] = array($handle, $macFunc, $secret, $expires); + $this->_cache[$url] = [$handle, $macFunc, $secret, $expires]; return $this->_storage->addAssociation( $url, $handle, @@ -479,7 +479,7 @@ protected function _getAssociation($url, &$handle, &$macFunc, &$secret, &$expire $macFunc, $secret, $expires)) { - $this->_cache[$url] = array($handle, $macFunc, $secret, $expires); + $this->_cache[$url] = [$handle, $macFunc, $secret, $expires]; return true; } return false; @@ -497,17 +497,17 @@ protected function _getAssociation($url, &$handle, &$macFunc, &$secret, &$expire * request * @return mixed */ - protected function _httpRequest($url, $method = 'GET', array $params = array(), &$status = null) + protected function _httpRequest($url, $method = 'GET', array $params = [], &$status = null) { $client = $this->_httpClient; if ($client === null) { $client = new Zend_Http_Client( $url, - array( + [ 'maxredirects' => 4, 'timeout' => 15, 'useragent' => 'Zend_OpenId' - ) + ] ); } else { $client->setUri($url); @@ -566,21 +566,21 @@ protected function _associate($url, $version, $priv_key=null) return true; } - $params = array(); + $params = []; if ($version >= 2.0) { - $params = array( + $params = [ 'openid.ns' => Zend_OpenId::NS_2_0, 'openid.mode' => 'associate', 'openid.assoc_type' => 'HMAC-SHA256', 'openid.session_type' => 'DH-SHA256', - ); + ]; } else { - $params = array( + $params = [ 'openid.mode' => 'associate', 'openid.assoc_type' => 'HMAC-SHA1', 'openid.session_type' => 'DH-SHA1', - ); + ]; } $dh = Zend_OpenId::createDhKey(pack('H*', Zend_OpenId::DH_P), @@ -602,7 +602,7 @@ protected function _associate($url, $version, $priv_key=null) return false; } - $r = array(); + $r = []; $bad_response = false; foreach(explode("\n", $ret) as $line) { $line = trim($line); @@ -751,7 +751,7 @@ protected function _discovery(&$id, &$server, &$version) return true; } - $response = $this->_httpRequest($id, 'GET', array(), $status); + $response = $this->_httpRequest($id, 'GET', [], $status); if ($status != 200 || !is_string($response)) { return false; } @@ -885,7 +885,7 @@ protected function _checkId($immediate, $id, $returnTo=null, $root=null, unset($expires); } - $params = array(); + $params = []; if ($version >= 2.0) { $params['openid.ns'] = Zend_OpenId::NS_2_0; } @@ -902,9 +902,9 @@ protected function _checkId($immediate, $id, $returnTo=null, $root=null, $this->_session->identity = $id; $this->_session->claimed_id = $claimedId; } else if (defined('SID')) { - $_SESSION["zend_openid"] = array( + $_SESSION["zend_openid"] = [ "identity" => $id, - "claimed_id" => $claimedId); + "claimed_id" => $claimedId]; } else { require_once "Zend/Session/Namespace.php"; $this->_session = new Zend_Session_Namespace("zend_openid"); diff --git a/library/Zend/OpenId/Consumer/Storage/File.php b/library/Zend/OpenId/Consumer/Storage/File.php index a1a96b8540..0ca45e37c3 100644 --- a/library/Zend/OpenId/Consumer/Storage/File.php +++ b/library/Zend/OpenId/Consumer/Storage/File.php @@ -139,7 +139,7 @@ public function addAssociation($url, $handle, $macFunc, $secret, $expires) fclose($lock); return false; } - $data = serialize(array($url, $handle, $macFunc, $secret, $expires)); + $data = serialize([$url, $handle, $macFunc, $secret, $expires]); fwrite($f, $data); if (function_exists('symlink')) { @unlink($name2); @@ -344,7 +344,7 @@ public function addDiscoveryInfo($id, $realId, $server, $version, $expires) fclose($lock); return false; } - $data = serialize(array($id, $realId, $server, $version, $expires)); + $data = serialize([$id, $realId, $server, $version, $expires]); fwrite($f, $data); fclose($f); fclose($lock); diff --git a/library/Zend/OpenId/Extension/Sreg.php b/library/Zend/OpenId/Extension/Sreg.php index 2abfbca5e9..9a4acbb3f6 100644 --- a/library/Zend/OpenId/Extension/Sreg.php +++ b/library/Zend/OpenId/Extension/Sreg.php @@ -69,7 +69,7 @@ public function getProperties() { if (is_array($this->_props)) { return $this->_props; } else { - return array(); + return []; } } @@ -98,7 +98,7 @@ public function getVersion() { */ public static function getSregProperties() { - return array( + return [ "nickname", "email", "fullname", @@ -108,7 +108,7 @@ public static function getSregProperties() "country", "language", "timezone" - ); + ]; } /** @@ -173,7 +173,7 @@ public function parseRequest($params) } else { $this->_policy_url = null; } - $props = array(); + $props = []; if (!empty($params['openid_sreg_optional'])) { foreach (explode(',', $params['openid_sreg_optional']) as $prop) { $prop = trim($prop); @@ -186,7 +186,7 @@ public function parseRequest($params) $props[$prop] = true; } } - $props2 = array(); + $props2 = []; foreach (self::getSregProperties() as $prop) { if (isset($props[$prop])) { $props2[$prop] = $props[$prop]; @@ -233,7 +233,7 @@ public function parseResponse($params) } else { $this->_version= 1.0; } - $props = array(); + $props = []; foreach (self::getSregProperties() as $prop) { if (!empty($params['openid_sreg_' . $prop])) { $props[$prop] = $params['openid_sreg_' . $prop]; @@ -276,14 +276,14 @@ public function getTrustData(&$data) public function checkTrustData($data) { if (is_array($this->_props) && count($this->_props) > 0) { - $props = array(); + $props = []; $name = get_class(); if (isset($data[$name])) { $props = $data[$name]; } else { - $props = array(); + $props = []; } - $props2 = array(); + $props2 = []; foreach ($this->_props as $prop => $req) { if (empty($props[$prop])) { if ($req) { diff --git a/library/Zend/OpenId/Provider.php b/library/Zend/OpenId/Provider.php index 3971944d0c..1fb94daefe 100644 --- a/library/Zend/OpenId/Provider.php +++ b/library/Zend/OpenId/Provider.php @@ -262,7 +262,7 @@ public function allowSite($root, $extensions=null) return false; } if ($extensions !== null) { - $data = array(); + $data = []; Zend_OpenId_Extension::forAll($extensions, 'getTrustData', $data); } else { $data = true; @@ -414,7 +414,7 @@ protected function _genSecret($func) */ protected function _associate($version, $params) { - $ret = array(); + $ret = []; if ($version >= 2.0) { $ret['ns'] = Zend_OpenId::NS_2_0; @@ -514,7 +514,7 @@ protected function _associate($version, $params) protected function _checkId($version, $params, $immediate, $extensions=null, Zend_Controller_Response_Abstract $response = null) { - $ret = array(); + $ret = []; if ($version >= 2.0) { $ret['openid.ns'] = Zend_OpenId::NS_2_0; @@ -533,7 +533,7 @@ protected function _checkId($version, $params, $immediate, $extensions=null, /* Check if user already logged in into the server */ if (!isset($params['openid_identity']) || $this->_user->getLoggedInUser() !== $params['openid_identity']) { - $params2 = array(); + $params2 = []; foreach ($params as $key => $val) { if (strpos($key, 'openid_ns_') === 0) { $key = 'openid.ns.' . substr($key, strlen('openid_ns_')); @@ -605,7 +605,7 @@ protected function _checkId($version, $params, $immediate, $extensions=null, return $ret; } else if ($trusted === null) { /* Redirect to Server Trust Screen */ - $params2 = array(); + $params2 = []; foreach ($params as $key => $val) { if (strpos($key, 'openid_ns_') === 0) { $key = 'openid.ns.' . substr($key, strlen('openid_ns_')); @@ -650,7 +650,7 @@ public function respondToConsumer($params, $extensions=null, $params['openid_ns'] == Zend_OpenId::NS_2_0) { $version = 2.0; } - $ret = array(); + $ret = []; if ($version >= 2.0) { $ret['openid.ns'] = Zend_OpenId::NS_2_0; } @@ -745,7 +745,7 @@ protected function _respond($version, $ret, $params, $extensions=null) */ protected function _checkAuthentication($version, $params) { - $ret = array(); + $ret = []; if ($version >= 2.0) { $ret['ns'] = Zend_OpenId::NS_2_0; } diff --git a/library/Zend/OpenId/Provider/Storage/File.php b/library/Zend/OpenId/Provider/Storage/File.php index eff62cc321..f1e2259af9 100644 --- a/library/Zend/OpenId/Provider/Storage/File.php +++ b/library/Zend/OpenId/Provider/Storage/File.php @@ -115,7 +115,7 @@ public function addAssociation($handle, $macFunc, $secret, $expires) fclose($lock); return false; } - $data = serialize(array($handle, $macFunc, $secret, $expires)); + $data = serialize([$handle, $macFunc, $secret, $expires]); fwrite($f, $data); fclose($f); fclose($lock); @@ -229,7 +229,7 @@ public function addUser($id, $password) fclose($lock); return false; } - $data = serialize(array($id, $password, array())); + $data = serialize([$id, $password, []]); fwrite($f, $data); fclose($f); fclose($lock); @@ -426,7 +426,7 @@ public function addSite($id, $site, $trusted) } rewind($f); ftruncate($f, 0); - $data = serialize(array($id, $storedPassword, $sites)); + $data = serialize([$id, $storedPassword, $sites]); fwrite($f, $data); $ret = true; } diff --git a/library/Zend/Paginator.php b/library/Zend/Paginator.php index 2ffff97378..fa57030609 100644 --- a/library/Zend/Paginator.php +++ b/library/Zend/Paginator.php @@ -319,7 +319,7 @@ public static function getAdapterLoader() { if (self::$_adapterLoader === null) { self::$_adapterLoader = new Zend_Loader_PluginLoader( - array('Zend_Paginator_Adapter' => 'Zend/Paginator/Adapter') + ['Zend_Paginator_Adapter' => 'Zend/Paginator/Adapter'] ); } @@ -434,7 +434,7 @@ public static function getScrollingStyleLoader() { if (self::$_scrollingStyleLoader === null) { self::$_scrollingStyleLoader = new Zend_Loader_PluginLoader( - array('Zend_Paginator_ScrollingStyle' => 'Zend/Paginator/ScrollingStyle') + ['Zend_Paginator_ScrollingStyle' => 'Zend/Paginator/ScrollingStyle'] ); } @@ -467,7 +467,7 @@ public function __construct($adapter) $config = self::$_config; if ($config != null) { - $setupMethods = array('ItemCountPerPage', 'PageRange'); + $setupMethods = ['ItemCountPerPage', 'PageRange']; foreach ($setupMethods as $setupMethod) { $value = $config->get(strtolower($setupMethod)); @@ -539,7 +539,7 @@ public function getTotalItemCount() if ($itemCount === false) { $itemCount = count($this->getAdapter()); - self::$_cache->save($itemCount, $cacheId, array($this->_getCacheInternalId())); + self::$_cache->save($itemCount, $cacheId, [$this->_getCacheInternalId()]); } return $itemCount; @@ -559,7 +559,7 @@ public function clearPageItemCache($pageNumber = null) } if (null === $pageNumber) { - foreach (self::$_cache->getIdsMatchingTags(array($this->_getCacheInternalId())) as $id) { + foreach (self::$_cache->getIdsMatchingTags([$this->_getCacheInternalId()]) as $id) { if (preg_match('|'.self::CACHE_TAG_PREFIX."(\d+)_.*|", $id, $page)) { self::$_cache->remove($this->_getCacheId($page[1])); } @@ -807,7 +807,7 @@ public function getItemsByPage($pageNumber) } if ($this->_cacheEnabled()) { - self::$_cache->save($items, $this->_getCacheId($pageNumber), array($this->_getCacheInternalId())); + self::$_cache->save($items, $this->_getCacheId($pageNumber), [$this->_getCacheInternalId()]); } return $items; @@ -877,7 +877,7 @@ public function getPagesInRange($lowerBound, $upperBound) $lowerBound = $this->normalizePageNumber($lowerBound); $upperBound = $this->normalizePageNumber($upperBound); - $pages = array(); + $pages = []; for ($pageNumber = $lowerBound; $pageNumber <= $upperBound; $pageNumber++) { $pages[$pageNumber] = $pageNumber; @@ -893,9 +893,9 @@ public function getPagesInRange($lowerBound, $upperBound) */ public function getPageItemCache() { - $data = array(); + $data = []; if ($this->_cacheEnabled()) { - foreach (self::$_cache->getIdsMatchingTags(array($this->_getCacheInternalId())) as $id) { + foreach (self::$_cache->getIdsMatchingTags([$this->_getCacheInternalId()]) as $id) { if (preg_match('|'.self::CACHE_TAG_PREFIX."(\d+)_.*|", $id, $page)) { $data[$page[1]] = self::$_cache->load($this->_getCacheId($page[1])); } @@ -1060,14 +1060,14 @@ protected function _getCacheInternalId() $adapter = $this->getAdapter(); if (method_exists($adapter, 'getCacheIdentifier')) { - return md5(serialize(array( + return md5(serialize([ $adapter->getCacheIdentifier(), $this->getItemCountPerPage() - ))); + ])); } else { - return md5(serialize(array( + return md5(serialize([ $adapter, $this->getItemCountPerPage() - ))); + ])); } } diff --git a/library/Zend/Paginator/Adapter/Iterator.php b/library/Zend/Paginator/Adapter/Iterator.php index 305f8ad585..d498ad896f 100644 --- a/library/Zend/Paginator/Adapter/Iterator.php +++ b/library/Zend/Paginator/Adapter/Iterator.php @@ -82,7 +82,7 @@ public function __construct(Iterator $iterator) public function getItems($offset, $itemCountPerPage) { if ($this->_count == 0) { - return array(); + return []; } // @link http://bugs.php.net/bug.php?id=49906 | ZF-8084 diff --git a/library/Zend/Paginator/Adapter/Null.php b/library/Zend/Paginator/Adapter/Null.php index 12ed9f2a94..8f35d29c20 100644 --- a/library/Zend/Paginator/Adapter/Null.php +++ b/library/Zend/Paginator/Adapter/Null.php @@ -59,7 +59,7 @@ public function __construct($count = 0) public function getItems($offset, $itemCountPerPage) { if ($offset >= $this->count()) { - return array(); + return []; } $remainItemCount = $this->count() - $offset; diff --git a/library/Zend/Paginator/SerializableLimitIterator.php b/library/Zend/Paginator/SerializableLimitIterator.php index 72c1399c9d..f5588c9a55 100644 --- a/library/Zend/Paginator/SerializableLimitIterator.php +++ b/library/Zend/Paginator/SerializableLimitIterator.php @@ -62,12 +62,12 @@ public function __construct (Iterator $it, $offset=0, $count=-1) */ public function serialize() { - return serialize(array( + return serialize([ 'it' => $this->getInnerIterator(), 'offset' => $this->_offset, 'count' => $this->_count, 'pos' => $this->getPosition(), - )); + ]); } /** diff --git a/library/Zend/Pdf.php b/library/Zend/Pdf.php index 25a1139251..ce9ced2a66 100644 --- a/library/Zend/Pdf.php +++ b/library/Zend/Pdf.php @@ -111,7 +111,7 @@ class Zend_Pdf * * @var array - array of Zend_Pdf_Page object */ - public $pages = array(); + public $pages = []; /** * Document properties @@ -128,7 +128,7 @@ class Zend_Pdf * * @var array */ - public $properties = array(); + public $properties = []; /** * Original properties set. @@ -137,7 +137,7 @@ class Zend_Pdf * * @var array */ - protected $_originalProperties = array(); + protected $_originalProperties = []; /** * Document level javascript @@ -152,14 +152,14 @@ class Zend_Pdf * * @var array - array of Zend_Pdf_Target objects */ - protected $_namedTargets = array(); + protected $_namedTargets = []; /** * Document outlines * * @var array - array of Zend_Pdf_Outline objects */ - public $outlines = array(); + public $outlines = []; /** * Original document outlines list @@ -167,7 +167,7 @@ class Zend_Pdf * * @var array - array of Zend_Pdf_Outline objects */ - protected $_originalOutlines = array(); + protected $_originalOutlines = []; /** * Original document outlines open elements count @@ -211,14 +211,14 @@ class Zend_Pdf * * @var array */ - protected static $_inheritableAttributes = array('Resources', 'MediaBox', 'CropBox', 'Rotate'); + protected static $_inheritableAttributes = ['Resources', 'MediaBox', 'CropBox', 'Rotate']; /** * List of form fields * * @var array - Associative array, key: name of form field, value: Zend_Pdf_Element */ - protected $_formFields = array(); + protected $_formFields = []; /** * True if the object is a newly created PDF document (affects save() method behavior) @@ -451,7 +451,7 @@ public function rollback($steps) // Mark content as modified to force new trailer generation at render time $this->_trailer->Root->touch(); - $this->pages = array(); + $this->pages = []; $this->_loadPages($this->_trailer->Root->Pages); } @@ -462,7 +462,7 @@ public function rollback($steps) * @param array|null $attributes * @throws Zend_Pdf_Exception */ - protected function _loadPages(Zend_Pdf_Element_Reference $pages, $attributes = array()) + protected function _loadPages(Zend_Pdf_Element_Reference $pages, $attributes = []) { if ($pages->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) { require_once 'Zend/Pdf/Exception.php'; @@ -727,7 +727,7 @@ protected function _dumpPages() $pagesContainer = $root->Pages; $pagesContainer->touch(); - $pagesContainer->Kids->items = array(); + $pagesContainer->Kids->items = []; foreach ($this->pages as $page ) { $page->render($this->_objFactory); @@ -818,7 +818,7 @@ protected function _dumpNamedDestinations() { ksort($this->_namedTargets, SORT_STRING); - $destArrayItems = array(); + $destArrayItems = []; foreach ($this->_namedTargets as $name => $destination) { $destArrayItems[] = new Zend_Pdf_Element_String($name); @@ -1097,8 +1097,8 @@ public function setNamedDestination($name, $destination = null) */ protected function _refreshPagesHash() { - $this->_pageReferences = array(); - $this->_pageNumbers = array(); + $this->_pageReferences = []; + $this->_pageNumbers = []; $count = 1; foreach ($this->pages as $page) { $pageDictionaryHashId = spl_object_hash($page->getPageDictionary()->getObject()); @@ -1192,8 +1192,8 @@ protected function _cleanUpAction(Zend_Pdf_Action $action, $refreshPageCollectio // Walk through child actions $iterator = new RecursiveIteratorIterator($action, RecursiveIteratorIterator::SELF_FIRST); - $actionsToClean = array(); - $deletionCandidateKeys = array(); + $actionsToClean = []; + $deletionCandidateKeys = []; foreach ($iterator as $chainedAction) { if ($chainedAction instanceof Zend_Pdf_Action_GoTo && $this->resolveDestination($chainedAction->getDestination(), false) === null) { @@ -1220,7 +1220,7 @@ protected function _cleanUpAction(Zend_Pdf_Action $action, $refreshPageCollectio */ public function extractFonts() { - $fontResourcesUnique = array(); + $fontResourcesUnique = []; foreach ($this->pages as $page) { $pageResources = $page->extractResources(); @@ -1244,7 +1244,7 @@ public function extractFonts() } } - $fonts = array(); + $fonts = []; require_once 'Zend/Pdf/Exception.php'; foreach ($fontResourcesUnique as $resourceId => $fontDictionary) { try { @@ -1274,7 +1274,7 @@ public function extractFonts() */ public function extractFont($fontName) { - $fontResourcesUnique = array(); + $fontResourcesUnique = []; require_once 'Zend/Pdf/Exception.php'; foreach ($this->pages as $page) { $pageResources = $page->extractResources(); @@ -1433,12 +1433,12 @@ public function render($newSegmentOnly = false, $outputStream = null) $lastFreeObject = $this->_trailer->getLastFreeObject(); // Array of cross-reference table subsections - $xrefTable = array(); + $xrefTable = []; // Object numbers of first objects in each subsection - $xrefSectionStartNums = array(); + $xrefSectionStartNums = []; // Last cross-reference table subsection - $xrefSection = array(); + $xrefSection = []; // Dummy initialization of the first element (specail case - header of linked list of free objects). $xrefSection[] = 0; $xrefSectionStartNums[] = 0; @@ -1455,7 +1455,7 @@ public function render($newSegmentOnly = false, $outputStream = null) } } } else { - $pdfSegmentBlocks = ($newSegmentOnly) ? array() : array($this->_trailer->getPDFString()); + $pdfSegmentBlocks = ($newSegmentOnly) ? [] : [$this->_trailer->getPDFString()]; } // Iterate objects to create new reference table @@ -1465,7 +1465,7 @@ public function render($newSegmentOnly = false, $outputStream = null) if ($objNum - $lastObjNum != 1) { // Save cross-reference table subsection and start new one $xrefTable[] = $xrefSection; - $xrefSection = array(); + $xrefSection = []; $xrefSectionStartNums[] = $objNum; } @@ -1569,7 +1569,7 @@ public function addJavaScript($javaScript) } if (!is_array($javaScript)) { - $javaScript = array($javaScript); + $javaScript = [$javaScript]; } if (null === $this->_javaScript) { @@ -1579,13 +1579,13 @@ public function addJavaScript($javaScript) } if (!empty($this->_javaScript)) { - $items = array(); + $items = []; foreach ($this->_javaScript as $javaScript) { - $jsCode = array( + $jsCode = [ 'S' => new Zend_Pdf_Element_Name('JavaScript'), 'JS' => new Zend_Pdf_Element_String($javaScript) - ); + ]; $items[] = new Zend_Pdf_Element_String('EmbeddedJS'); $items[] = $this->_objFactory->newObject( new Zend_Pdf_Element_Dictionary($jsCode) @@ -1594,7 +1594,7 @@ public function addJavaScript($javaScript) $jsRef = $this->_objFactory->newObject( new Zend_Pdf_Element_Dictionary( - array('Names' => new Zend_Pdf_Element_Array($items)) + ['Names' => new Zend_Pdf_Element_Array($items)] ) ); diff --git a/library/Zend/Pdf/Action.php b/library/Zend/Pdf/Action.php index 2b1864c46f..086236ef04 100644 --- a/library/Zend/Pdf/Action.php +++ b/library/Zend/Pdf/Action.php @@ -60,7 +60,7 @@ abstract class Zend_Pdf_Action extends Zend_Pdf_Target implements RecursiveItera * * @var array Array of Zend_Pdf_Action objects */ - public $next = array(); + public $next = []; /** * Object constructor diff --git a/library/Zend/Pdf/Annotation/Markup.php b/library/Zend/Pdf/Annotation/Markup.php index 9e84f22ac2..a4cdca914c 100644 --- a/library/Zend/Pdf/Annotation/Markup.php +++ b/library/Zend/Pdf/Annotation/Markup.php @@ -65,10 +65,10 @@ public function __construct(Zend_Pdf_Element $annotationDictionary) if ($annotationDictionary->Subtype === null || $annotationDictionary->Subtype->getType() != Zend_Pdf_Element::TYPE_NAME || !in_array( $annotationDictionary->Subtype->value, - array(self::SUBTYPE_HIGHLIGHT, + [self::SUBTYPE_HIGHLIGHT, self::SUBTYPE_UNDERLINE, self::SUBTYPE_SQUIGGLY, - self::SUBTYPE_STRIKEOUT) )) { + self::SUBTYPE_STRIKEOUT] )) { require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('Subtype => Markup entry is omitted or has wrong value.'); } diff --git a/library/Zend/Pdf/Canvas.php b/library/Zend/Pdf/Canvas.php index f320aa7258..e3383ca05c 100644 --- a/library/Zend/Pdf/Canvas.php +++ b/library/Zend/Pdf/Canvas.php @@ -38,7 +38,7 @@ class Zend_Pdf_Canvas extends Zend_Pdf_Canvas_Abstract * * @var array */ - protected $_procSet = array(); + protected $_procSet = []; /** * Canvas width expressed in default user space units (1/72 inch) @@ -54,9 +54,9 @@ class Zend_Pdf_Canvas extends Zend_Pdf_Canvas_Abstract */ protected $_height; - protected $_resources = array('Font' => array(), - 'XObject' => array(), - 'ExtGState' => array()); + protected $_resources = ['Font' => [], + 'XObject' => [], + 'ExtGState' => []]; /** * Object constructor diff --git a/library/Zend/Pdf/Canvas/Abstract.php b/library/Zend/Pdf/Canvas/Abstract.php index 556dd9a453..50821fed67 100644 --- a/library/Zend/Pdf/Canvas/Abstract.php +++ b/library/Zend/Pdf/Canvas/Abstract.php @@ -221,7 +221,7 @@ public function setLineDashingPattern($pattern, $phase = 0) require_once 'Zend/Pdf/Page.php'; if ($pattern === Zend_Pdf_Page::LINE_DASHING_SOLID) { - $pattern = array(); + $pattern = []; $phase = 0; } @@ -913,7 +913,7 @@ public function drawRoundedRectangle($x1, $y1, $x2, $y2, $radius, $this->_addProcSet('PDF'); if(!is_array($radius)) { - $radius = array($radius, $radius, $radius, $radius); + $radius = [$radius, $radius, $radius, $radius]; } else { for ($i = 0; $i < 4; $i++) { if(!isset($radius[$i])) { diff --git a/library/Zend/Pdf/Cmap/ByteEncoding.php b/library/Zend/Pdf/Cmap/ByteEncoding.php index 6cb2c552f9..63d5630970 100644 --- a/library/Zend/Pdf/Cmap/ByteEncoding.php +++ b/library/Zend/Pdf/Cmap/ByteEncoding.php @@ -49,7 +49,7 @@ class Zend_Pdf_Cmap_ByteEncoding extends Zend_Pdf_Cmap * the translated Unicode code points. * @var array */ - protected $_glyphIndexArray = array(); + protected $_glyphIndexArray = []; @@ -71,7 +71,7 @@ class Zend_Pdf_Cmap_ByteEncoding extends Zend_Pdf_Cmap */ public function glyphNumbersForCharacters($characterCodes) { - $glyphNumbers = array(); + $glyphNumbers = []; foreach ($characterCodes as $key => $characterCode) { if (! isset($this->_glyphIndexArray[$characterCode])) { diff --git a/library/Zend/Pdf/Cmap/SegmentToDelta.php b/library/Zend/Pdf/Cmap/SegmentToDelta.php index d72d3eb844..d83a74fca5 100644 --- a/library/Zend/Pdf/Cmap/SegmentToDelta.php +++ b/library/Zend/Pdf/Cmap/SegmentToDelta.php @@ -64,7 +64,7 @@ class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap * Array of ending character codes for each segment. * @var array */ - protected $_segmentTableEndCodes = array(); + protected $_segmentTableEndCodes = []; /** * The ending character code for the segment at the end of the low search @@ -77,25 +77,25 @@ class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap * Array of starting character codes for each segment. * @var array */ - protected $_segmentTableStartCodes = array(); + protected $_segmentTableStartCodes = []; /** * Array of character code to glyph delta values for each segment. * @var array */ - protected $_segmentTableIdDeltas = array(); + protected $_segmentTableIdDeltas = []; /** * Array of offsets into the glyph index array for each segment. * @var array */ - protected $_segmentTableIdRangeOffsets = array(); + protected $_segmentTableIdRangeOffsets = []; /** * Glyph index array. Stores glyph numbers, used with range offset. * @var array */ - protected $_glyphIndexArray = array(); + protected $_glyphIndexArray = []; @@ -117,7 +117,7 @@ class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap */ public function glyphNumbersForCharacters($characterCodes) { - $glyphNumbers = array(); + $glyphNumbers = []; foreach ($characterCodes as $key => $characterCode) { /* These tables only cover the 16-bit character range. @@ -252,7 +252,7 @@ public function glyphNumberForCharacter($characterCode) */ public function getCoveredCharacters() { - $characterCodes = array(); + $characterCodes = []; for ($i = 1; $i <= $this->_segmentCount; $i++) { for ($code = $this->_segmentTableStartCodes[$i]; $code <= $this->_segmentTableEndCodes[$i]; $code++) { $characterCodes[] = $code; @@ -275,7 +275,7 @@ public function getCoveredCharacters() */ public function getCoveredCharactersGlyphs() { - $glyphNumbers = array(); + $glyphNumbers = []; for ($segmentNum = 1; $segmentNum <= $this->_segmentCount; $segmentNum++) { if ($this->_segmentTableIdRangeOffsets[$segmentNum] == 0) { diff --git a/library/Zend/Pdf/Cmap/TrimmedTable.php b/library/Zend/Pdf/Cmap/TrimmedTable.php index a2f859e3da..392fd32bc9 100644 --- a/library/Zend/Pdf/Cmap/TrimmedTable.php +++ b/library/Zend/Pdf/Cmap/TrimmedTable.php @@ -57,7 +57,7 @@ class Zend_Pdf_Cmap_TrimmedTable extends Zend_Pdf_Cmap * Glyph index array. Stores the actual glyph numbers. * @var array */ - protected $_glyphIndexArray = array(); + protected $_glyphIndexArray = []; @@ -79,7 +79,7 @@ class Zend_Pdf_Cmap_TrimmedTable extends Zend_Pdf_Cmap */ public function glyphNumbersForCharacters($characterCodes) { - $glyphNumbers = array(); + $glyphNumbers = []; foreach ($characterCodes as $key => $characterCode) { if (($characterCode < $this->_startCode) || ($characterCode > $this->_endCode)) { @@ -123,7 +123,7 @@ public function glyphNumberForCharacter($characterCode) */ public function getCoveredCharacters() { - $characterCodes = array(); + $characterCodes = []; for ($code = $this->_startCode; $code <= $this->_endCode; $code++) { $characterCodes[] = $code; } @@ -144,7 +144,7 @@ public function getCoveredCharacters() */ public function getCoveredCharactersGlyphs() { - $glyphNumbers = array(); + $glyphNumbers = []; for ($code = $this->_startCode; $code <= $this->_endCode; $code++) { $glyphNumbers[$code] = $this->_glyphIndexArray[$code - $this->_startCode]; } diff --git a/library/Zend/Pdf/Color/Cmyk.php b/library/Zend/Pdf/Color/Cmyk.php index 56a5bbaa93..2e9ded15c4 100644 --- a/library/Zend/Pdf/Color/Cmyk.php +++ b/library/Zend/Pdf/Color/Cmyk.php @@ -120,7 +120,7 @@ public function instructions($stroking) */ public function getComponents() { - return array($this->_c->value, $this->_m->value, $this->_y->value, $this->_k->value); + return [$this->_c->value, $this->_m->value, $this->_y->value, $this->_k->value]; } } diff --git a/library/Zend/Pdf/Color/GrayScale.php b/library/Zend/Pdf/Color/GrayScale.php index 864b3023a1..34710f99d9 100644 --- a/library/Zend/Pdf/Color/GrayScale.php +++ b/library/Zend/Pdf/Color/GrayScale.php @@ -78,7 +78,7 @@ public function instructions($stroking) */ public function getComponents() { - return array($this->_grayLevel->value); + return [$this->_grayLevel->value]; } } diff --git a/library/Zend/Pdf/Color/Rgb.php b/library/Zend/Pdf/Color/Rgb.php index cef0bdf171..ddf85ceb0d 100644 --- a/library/Zend/Pdf/Color/Rgb.php +++ b/library/Zend/Pdf/Color/Rgb.php @@ -108,7 +108,7 @@ public function instructions($stroking) */ public function getComponents() { - return array($this->_r->value, $this->_g->value, $this->_b->value); + return [$this->_r->value, $this->_g->value, $this->_b->value]; } } diff --git a/library/Zend/Pdf/Element.php b/library/Zend/Pdf/Element.php index 0486ac60d8..fec0e0b19e 100644 --- a/library/Zend/Pdf/Element.php +++ b/library/Zend/Pdf/Element.php @@ -151,7 +151,7 @@ public static function phpToPdf($input) require_once 'Zend/Pdf/Element/Boolean.php'; return new Zend_Pdf_Element_Boolean($input); } else if (is_array($input)) { - $pdfElementsArray = array(); + $pdfElementsArray = []; $isDictionary = false; foreach ($input as $key => $value) { diff --git a/library/Zend/Pdf/Element/Array.php b/library/Zend/Pdf/Element/Array.php index d301fc3b6d..e8d69a5920 100644 --- a/library/Zend/Pdf/Element/Array.php +++ b/library/Zend/Pdf/Element/Array.php @@ -170,7 +170,7 @@ public function setParentObject(Zend_Pdf_Element_Object $parent) */ public function toPhp() { - $phpArray = array(); + $phpArray = []; foreach ($this->items as $item) { $phpArray[] = $item->toPhp(); diff --git a/library/Zend/Pdf/Element/Dictionary.php b/library/Zend/Pdf/Element/Dictionary.php index 3d9cf96e8d..6d90f8fb84 100644 --- a/library/Zend/Pdf/Element/Dictionary.php +++ b/library/Zend/Pdf/Element/Dictionary.php @@ -43,7 +43,7 @@ class Zend_Pdf_Element_Dictionary extends Zend_Pdf_Element * * @var array */ - private $_items = array(); + private $_items = []; /** @@ -225,7 +225,7 @@ public function setParentObject(Zend_Pdf_Element_Object $parent) */ public function toPhp() { - $phpArray = array(); + $phpArray = []; foreach ($this->_items as $itemName => $item) { $phpArray[$itemName] = $item->toPhp(); diff --git a/library/Zend/Pdf/Element/Object.php b/library/Zend/Pdf/Element/Object.php index 44fbf37be9..922dc09f74 100644 --- a/library/Zend/Pdf/Element/Object.php +++ b/library/Zend/Pdf/Element/Object.php @@ -208,7 +208,7 @@ public function __set($property, $value) */ public function __call($method, $args) { - return call_user_func_array(array($this->_value, $method), $args); + return call_user_func_array([$this->_value, $method], $args); } /** diff --git a/library/Zend/Pdf/Element/Object/Stream.php b/library/Zend/Pdf/Element/Object/Stream.php index 2cd6c19913..c30bb8f95d 100644 --- a/library/Zend/Pdf/Element/Object/Stream.php +++ b/library/Zend/Pdf/Element/Object/Stream.php @@ -98,16 +98,16 @@ public function __construct($val, $objNum, $genNum, Zend_Pdf_ElementFactory $fac */ private function _extractDictionaryData() { - $dictionaryArray = array(); + $dictionaryArray = []; - $dictionaryArray['Filter'] = array(); - $dictionaryArray['DecodeParms'] = array(); + $dictionaryArray['Filter'] = []; + $dictionaryArray['DecodeParms'] = []; if ($this->_dictionary->Filter === null) { // Do nothing. } else if ($this->_dictionary->Filter->getType() == Zend_Pdf_Element::TYPE_ARRAY) { foreach ($this->_dictionary->Filter->items as $id => $filter) { $dictionaryArray['Filter'][$id] = $filter->value; - $dictionaryArray['DecodeParms'][$id] = array(); + $dictionaryArray['DecodeParms'][$id] = []; if ($this->_dictionary->DecodeParms !== null ) { if ($this->_dictionary->DecodeParms->items[$id] !== null && @@ -121,7 +121,7 @@ private function _extractDictionaryData() } } else if ($this->_dictionary->Filter->getType() != Zend_Pdf_Element::TYPE_NULL) { $dictionaryArray['Filter'][0] = $this->_dictionary->Filter->value; - $dictionaryArray['DecodeParms'][0] = array(); + $dictionaryArray['DecodeParms'][0] = []; if ($this->_dictionary->DecodeParms !== null ) { foreach ($this->_dictionary->DecodeParms->getKeys() as $paramKey) { $dictionaryArray['DecodeParms'][0][$paramKey] = @@ -134,14 +134,14 @@ private function _extractDictionaryData() $dictionaryArray['F'] = $this->_dictionary->F->value; } - $dictionaryArray['FFilter'] = array(); - $dictionaryArray['FDecodeParms'] = array(); + $dictionaryArray['FFilter'] = []; + $dictionaryArray['FDecodeParms'] = []; if ($this->_dictionary->FFilter === null) { // Do nothing. } else if ($this->_dictionary->FFilter->getType() == Zend_Pdf_Element::TYPE_ARRAY) { foreach ($this->_dictionary->FFilter->items as $id => $filter) { $dictionaryArray['FFilter'][$id] = $filter->value; - $dictionaryArray['FDecodeParms'][$id] = array(); + $dictionaryArray['FDecodeParms'][$id] = []; if ($this->_dictionary->FDecodeParms !== null ) { if ($this->_dictionary->FDecodeParms->items[$id] !== null && @@ -155,7 +155,7 @@ private function _extractDictionaryData() } } else { $dictionaryArray['FFilter'][0] = $this->_dictionary->FFilter->value; - $dictionaryArray['FDecodeParms'][0] = array(); + $dictionaryArray['FDecodeParms'][0] = []; if ($this->_dictionary->FDecodeParms !== null ) { foreach ($this->_dictionary->FDecodeParms->getKeys() as $paramKey) { $dictionaryArray['FDecodeParms'][0][$paramKey] = diff --git a/library/Zend/Pdf/Element/Reference.php b/library/Zend/Pdf/Element/Reference.php index 27ca760b7a..50142d40ff 100644 --- a/library/Zend/Pdf/Element/Reference.php +++ b/library/Zend/Pdf/Element/Reference.php @@ -276,7 +276,7 @@ public function __call($method, $args) $this->_dereference(); } - return call_user_func_array(array($this->_ref, $method), $args); + return call_user_func_array([$this->_ref, $method], $args); } /** diff --git a/library/Zend/Pdf/Element/Reference/Table.php b/library/Zend/Pdf/Element/Reference/Table.php index fa36262dbb..d29cec404d 100644 --- a/library/Zend/Pdf/Element/Reference/Table.php +++ b/library/Zend/Pdf/Element/Reference/Table.php @@ -77,8 +77,8 @@ class Zend_Pdf_Element_Reference_Table public function __construct() { $this->_parent = null; - $this->_free = array(); $this->_generations = array(); - $this->_inuse = array(); $this->_usedObjects = array(); + $this->_free = []; $this->_generations = []; + $this->_inuse = []; $this->_usedObjects = []; } diff --git a/library/Zend/Pdf/Element/String.php b/library/Zend/Pdf/Element/String.php index c840166ec8..a2a44deb32 100644 --- a/library/Zend/Pdf/Element/String.php +++ b/library/Zend/Pdf/Element/String.php @@ -82,7 +82,7 @@ public function toString($factory = null) */ public static function escape($str) { - $outEntries = array(); + $outEntries = []; foreach (str_split($str, 128) as $chunk) { // Collect sequence of unescaped characters @@ -167,7 +167,7 @@ public static function escape($str) */ public static function unescape($str) { - $outEntries = array(); + $outEntries = []; $offset = 0; while ($offset < strlen($str)) { diff --git a/library/Zend/Pdf/Element/String/Binary.php b/library/Zend/Pdf/Element/String/Binary.php index 1eb704b02d..fe1e0ac8a1 100644 --- a/library/Zend/Pdf/Element/String/Binary.php +++ b/library/Zend/Pdf/Element/String/Binary.php @@ -62,7 +62,7 @@ public static function escape($inStr) */ public static function unescape($inStr) { - $chunks = array(); + $chunks = []; $offset = 0; $length = 0; while ($offset < strlen($inStr)) { diff --git a/library/Zend/Pdf/ElementFactory.php b/library/Zend/Pdf/ElementFactory.php index 17bd82a905..f9480aea21 100644 --- a/library/Zend/Pdf/ElementFactory.php +++ b/library/Zend/Pdf/ElementFactory.php @@ -41,7 +41,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface * * @var array */ - private $_modifiedObjects = array(); + private $_modifiedObjects = []; /** * List of the removed objects @@ -60,7 +60,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface * * @var array */ - private $_registeredObjects = array(); + private $_registeredObjects = []; /** * PDF object counter. @@ -77,7 +77,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface * * @var array */ - private $_attachedFactories = array(); + private $_attachedFactories = []; /** @@ -100,7 +100,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface * * @var array */ - private $_shiftCalculationCache = array(); + private $_shiftCalculationCache = []; /** @@ -263,7 +263,7 @@ public function calculateShift(Zend_Pdf_ElementFactory_Interface $factory) */ public function cleanEnumerationShiftCache() { - $this->_shiftCalculationCache = array(); + $this->_shiftCalculationCache = []; foreach ($this->_attachedFactories as $attached) { $attached->cleanEnumerationShiftCache(); @@ -373,7 +373,7 @@ public function listModifiedObjects($rootFactory = null) ksort($this->_modifiedObjects); - $result = array(); + $result = []; require_once 'Zend/Pdf/UpdateInfoContainer.php'; foreach ($this->_modifiedObjects as $objNum => $obj) { if ($this->_removedObjects->contains($obj)) { diff --git a/library/Zend/Pdf/FileParser/Font.php b/library/Zend/Pdf/FileParser/Font.php index a9cd3567dc..3fb45ec568 100644 --- a/library/Zend/Pdf/FileParser/Font.php +++ b/library/Zend/Pdf/FileParser/Font.php @@ -49,7 +49,7 @@ abstract class Zend_Pdf_FileParser_Font extends Zend_Pdf_FileParser * {@link __set()}. * @var array */ - private $_fontProperties = array(); + private $_fontProperties = []; /** * Flag indicating whether or not debug logging is active. diff --git a/library/Zend/Pdf/FileParser/Font/OpenType.php b/library/Zend/Pdf/FileParser/Font/OpenType.php index 76e833cac8..4742c521c2 100644 --- a/library/Zend/Pdf/FileParser/Font/OpenType.php +++ b/library/Zend/Pdf/FileParser/Font/OpenType.php @@ -64,7 +64,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon * Stores the byte offsets to the various information tables. * @var array */ - protected $_tableDirectory = array(); + protected $_tableDirectory = []; @@ -310,7 +310,7 @@ protected function _parseNameTable() * use Mac Roman if nothing else is available. We will extract the * actual strings later. */ - $nameRecords = array(); + $nameRecords = []; for ($nameIndex = 0; $nameIndex < $nameCount; $nameIndex++) { $platformID = $this->readUInt(2); @@ -341,14 +341,14 @@ protected function _parseNameTable() * exists for both Mac Roman and Microsoft Unicode, the Unicode entry * will prevail since it is processed last. */ - $nameRecords[$nameID][$languageCode] = array('platform' => $platformID, + $nameRecords[$nameID][$languageCode] = ['platform' => $platformID, 'offset' => $nameOffset, - 'length' => $nameLength ); + 'length' => $nameLength ]; } /* Now go back and extract the interesting strings. */ - $fontNames = array(); + $fontNames = []; foreach ($nameRecords as $name => $languages) { foreach ($languages as $language => $attributes) { $stringOffset = $storageOffset + $attributes['offset']; @@ -762,7 +762,7 @@ protected function _parseHmtxTable() * the glyph's advance width and its left side bearing. We don't use the * left side bearing. */ - $glyphWidths = array(); + $glyphWidths = []; for ($i = 0; $i < $this->numberHMetrics; $i++) { $glyphWidths[$i] = $this->readUInt(2); $this->skipBytes(2); @@ -818,7 +818,7 @@ protected function _parseCmapTable() /* Like the name table, there may be many different encoding subtables * present. Ideally, we are looking for an acceptable Unicode table. */ - $subtables = array(); + $subtables = []; for ($subtableIndex = 0; $subtableIndex < $subtableCount; $subtableIndex++) { $platformID = $this->readUInt(2); @@ -850,7 +850,7 @@ protected function _parseCmapTable() /* In preferred order, find a subtable to use. */ - $offsets = array(); + $offsets = []; /* Unicode 2.0 or later semantics */ diff --git a/library/Zend/Pdf/FileParser/Image/Png.php b/library/Zend/Pdf/FileParser/Image/Png.php index f2665ebcc5..7a88cc032c 100644 --- a/library/Zend/Pdf/FileParser/Image/Png.php +++ b/library/Zend/Pdf/FileParser/Image/Png.php @@ -255,7 +255,7 @@ protected function _parseTRNSChunk($chunkOffset, $chunkLength) { switch($this->_color) { case Zend_Pdf_Image::PNG_CHANNEL_GRAY: $baseColor = $this->readInt(1); - $this->_transparencyData = array($baseColor, $baseColor); + $this->_transparencyData = [$baseColor, $baseColor]; break; case Zend_Pdf_Image::PNG_CHANNEL_RGB: @@ -284,7 +284,7 @@ protected function _parseTRNSChunk($chunkOffset, $chunkLength) { $this->skipBytes(1); $blue = $this->readInt(1); - $this->_transparencyData = array($red, $red, $green, $green, $blue, $blue); + $this->_transparencyData = [$red, $red, $green, $green, $blue, $blue]; break; @@ -313,7 +313,7 @@ protected function _parseTRNSChunk($chunkOffset, $chunkLength) { $tmpData = $this->readBytes($chunkLength); if(($trnsIdx = strpos($tmpData, "\0")) !== false) { - $this->_transparencyData = array($trnsIdx, $trnsIdx); + $this->_transparencyData = [$trnsIdx, $trnsIdx]; } break; diff --git a/library/Zend/Pdf/Filter/Ascii85.php b/library/Zend/Pdf/Filter/Ascii85.php index b1c1600d27..021b3caffc 100644 --- a/library/Zend/Pdf/Filter/Ascii85.php +++ b/library/Zend/Pdf/Filter/Ascii85.php @@ -116,7 +116,7 @@ public static function decode($data, $params = null) $output = ''; //get rid of the whitespaces - $whiteSpace = array("\x00", "\x09", "\x0A", "\x0C", "\x0D", "\x20"); + $whiteSpace = ["\x00", "\x09", "\x0A", "\x0C", "\x0D", "\x20"]; $data = str_replace($whiteSpace, '', $data); if (substr($data, -2) != '~>') { diff --git a/library/Zend/Pdf/Filter/Compression.php b/library/Zend/Pdf/Filter/Compression.php index 422cf6fa5c..627d41e22f 100644 --- a/library/Zend/Pdf/Filter/Compression.php +++ b/library/Zend/Pdf/Filter/Compression.php @@ -257,7 +257,7 @@ protected static function _applyEncodeParams($data, $params) { case 4: // Paeth prediction $lastRow = array_fill(0, $bytesPerRow, 0); - $currentRow = array(); + $currentRow = []; for ($count = 0; $count < $rows; $count++) { $output .= chr($predictor); @@ -363,7 +363,7 @@ protected static function _applyDecodeParams($data, $params) { break; case 4: // Paeth prediction - $currentRow = array(); + $currentRow = []; for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) { $decodedByte = (ord($data[$offset++]) + self::_paeth($lastSample[$count2 % $bytesPerSample], diff --git a/library/Zend/Pdf/Font.php b/library/Zend/Pdf/Font.php index af87767828..d6327e4f17 100644 --- a/library/Zend/Pdf/Font.php +++ b/library/Zend/Pdf/Font.php @@ -417,14 +417,14 @@ abstract class Zend_Pdf_Font * The values are the font objects themselves. * @var array */ - private static $_fontNames = array(); + private static $_fontNames = []; /** * Array whose keys are the md5 hash of the full paths on disk for parsed * fonts. The values are the font objects themselves. * @var array */ - private static $_fontFilePaths = array(); + private static $_fontFilePaths = []; diff --git a/library/Zend/Pdf/NameTree.php b/library/Zend/Pdf/NameTree.php index 36614e67d0..49508bd463 100644 --- a/library/Zend/Pdf/NameTree.php +++ b/library/Zend/Pdf/NameTree.php @@ -41,7 +41,7 @@ class Zend_Pdf_NameTree implements ArrayAccess, Iterator, Countable * * @var array */ - protected $_items = array(); + protected $_items = []; /** * Object constructor @@ -55,8 +55,8 @@ public function __construct(Zend_Pdf_Element $rootDictionary) throw new Zend_Pdf_Exception('Name tree root must be a dictionary.'); } - $intermediateNodes = array(); - $leafNodes = array(); + $intermediateNodes = []; + $leafNodes = []; if ($rootDictionary->Kids !== null) { $intermediateNodes[] = $rootDictionary; } else { @@ -64,7 +64,7 @@ public function __construct(Zend_Pdf_Element $rootDictionary) } while (count($intermediateNodes) != 0) { - $newIntermediateNodes = array(); + $newIntermediateNodes = []; foreach ($intermediateNodes as $node) { foreach ($node->Kids->items as $childNode) { if ($childNode->Kids !== null) { @@ -144,7 +144,7 @@ public function offsetUnset($offset) public function clear() { - $this->_items = array(); + $this->_items = []; } public function count() diff --git a/library/Zend/Pdf/Outline.php b/library/Zend/Pdf/Outline.php index 688a287a5b..27169ed01d 100644 --- a/library/Zend/Pdf/Outline.php +++ b/library/Zend/Pdf/Outline.php @@ -45,7 +45,7 @@ abstract class Zend_Pdf_Outline implements RecursiveIterator, Countable * * @var array */ - public $childOutlines = array(); + public $childOutlines = []; /** @@ -155,12 +155,12 @@ abstract public function setTarget($target = null); */ public function getOptions() { - return array('title' => $this->_title, + return ['title' => $this->_title, 'open' => $this->_open, 'color' => $this->_color, 'italic' => $this->_italic, 'bold' => $this->_bold, - 'target' => $this->_target); + 'target' => $this->_target]; } /** @@ -236,8 +236,8 @@ public static function create($param1, $param2 = null) throw new Zend_Pdf_Exception('Outline create method takes $title (string) and $target (Zend_Pdf_Target or string) or an array as an input'); } - return new Zend_Pdf_Outline_Created(array('title' => $param1, - 'target' => $param2)); + return new Zend_Pdf_Outline_Created(['title' => $param1, + 'target' => $param2]); } else { if (!is_array($param1) || $param2 !== null) { require_once 'Zend/Pdf/Exception.php'; diff --git a/library/Zend/Pdf/Outline/Created.php b/library/Zend/Pdf/Outline/Created.php index c319492c3c..7321ca8ff4 100644 --- a/library/Zend/Pdf/Outline/Created.php +++ b/library/Zend/Pdf/Outline/Created.php @@ -219,7 +219,7 @@ public function setTarget($target = null) * @param array $options * @throws Zend_Pdf_Exception */ - public function __construct($options = array()) + public function __construct($options = []) { if (!isset($options['title'])) { require_once 'Zend/Pdf/Exception.php'; @@ -273,9 +273,9 @@ public function dumpOutline(Zend_Pdf_ElementFactory_Interface $factory, $color = $this->getColor(); if ($color !== null) { $components = $color->getComponents(); - $colorComponentElements = array(new Zend_Pdf_Element_Numeric($components[0]), + $colorComponentElements = [new Zend_Pdf_Element_Numeric($components[0]), new Zend_Pdf_Element_Numeric($components[1]), - new Zend_Pdf_Element_Numeric($components[2])); + new Zend_Pdf_Element_Numeric($components[2])]; $outlineDictionary->C = new Zend_Pdf_Element_Array($colorComponentElements); } diff --git a/library/Zend/Pdf/Outline/Loaded.php b/library/Zend/Pdf/Outline/Loaded.php index 1c3228c12e..f5609b9740 100644 --- a/library/Zend/Pdf/Outline/Loaded.php +++ b/library/Zend/Pdf/Outline/Loaded.php @@ -56,7 +56,7 @@ class Zend_Pdf_Outline_Loaded extends Zend_Pdf_Outline * * @var array */ - protected $_originalChildOutlines = array(); + protected $_originalChildOutlines = []; /** * Get outline title. @@ -214,9 +214,9 @@ public function setColor(Zend_Pdf_Color_Rgb $color) $this->_outlineDictionary->C = null; } else { $components = $color->getComponents(); - $colorComponentElements = array(new Zend_Pdf_Element_Numeric($components[0]), + $colorComponentElements = [new Zend_Pdf_Element_Numeric($components[0]), new Zend_Pdf_Element_Numeric($components[1]), - new Zend_Pdf_Element_Numeric($components[2])); + new Zend_Pdf_Element_Numeric($components[2])]; $this->_outlineDictionary->C = new Zend_Pdf_Element_Array($colorComponentElements); } diff --git a/library/Zend/Pdf/Page.php b/library/Zend/Pdf/Page.php index 78b0c3de57..22de2e1995 100644 --- a/library/Zend/Pdf/Page.php +++ b/library/Zend/Pdf/Page.php @@ -415,11 +415,11 @@ protected function _addProcSet($procSetName) */ public function getResources() { - $resources = array(); + $resources = []; $resDictionary = $this->_dictionary->Resources; foreach ($resDictionary->getKeys() as $resType) { - $resources[$resType] = array(); + $resources[$resType] = []; if ($resType == 'ProcSet') { foreach ($resDictionary->ProcSet->items as $procSetEntry) { @@ -479,7 +479,7 @@ public function getWidth() public function __clone() { $factory = Zend_Pdf_ElementFactory::createFactory(1); - $processed = array(); + $processed = []; // Clone dictionary object. // Do it explicitly to prevent sharing page attributes between different @@ -648,12 +648,12 @@ public function extractFonts() if ($this->_dictionary->Resources->Font === null) { // Page doesn't have any font attached // Return empty array - return array(); + return []; } $fontResources = $this->_dictionary->Resources->Font; - $fontResourcesUnique = array(); + $fontResourcesUnique = []; foreach ($fontResources->getKeys() as $fontResourceName) { $fontDictionary = $fontResources->$fontResourceName; @@ -666,7 +666,7 @@ public function extractFonts() $fontResourcesUnique[spl_object_hash($fontDictionary->getObject())] = $fontDictionary; } - $fonts = array(); + $fonts = []; require_once 'Zend/Pdf/Exception.php'; foreach ($fontResourcesUnique as $resourceId => $fontDictionary) { try { @@ -702,7 +702,7 @@ public function extractFont($fontName) $fontResources = $this->_dictionary->Resources->Font; - $fontResourcesUnique = array(); + $fontResourcesUnique = []; require_once 'Zend/Pdf/Exception.php'; foreach ($fontResources->getKeys() as $fontResourceName) { diff --git a/library/Zend/Pdf/RecursivelyIteratableObjectsContainer.php b/library/Zend/Pdf/RecursivelyIteratableObjectsContainer.php index c3d9cd2b4b..9edef38c1e 100644 --- a/library/Zend/Pdf/RecursivelyIteratableObjectsContainer.php +++ b/library/Zend/Pdf/RecursivelyIteratableObjectsContainer.php @@ -29,7 +29,7 @@ */ class Zend_Pdf_RecursivelyIteratableObjectsContainer implements RecursiveIterator, Countable { - protected $_objects = array(); + protected $_objects = []; public function __construct(array $objects) { $this->_objects = $objects; } diff --git a/library/Zend/Pdf/Resource/Extractor.php b/library/Zend/Pdf/Resource/Extractor.php index 15fbed7aee..ed14318284 100644 --- a/library/Zend/Pdf/Resource/Extractor.php +++ b/library/Zend/Pdf/Resource/Extractor.php @@ -69,7 +69,7 @@ class Zend_Pdf_Resource_Extractor public function __construct() { $this->_factory = Zend_Pdf_ElementFactory::createFactory(1); - $this->_processed = array(); + $this->_processed = []; } /** diff --git a/library/Zend/Pdf/Resource/Font.php b/library/Zend/Pdf/Resource/Font.php index a0827d7aaa..30dac9f940 100644 --- a/library/Zend/Pdf/Resource/Font.php +++ b/library/Zend/Pdf/Resource/Font.php @@ -62,7 +62,7 @@ abstract class Zend_Pdf_Resource_Font extends Zend_Pdf_Resource * Array containing descriptive names for the font. See {@link fontName()}. * @var array */ - protected $_fontNames = array(); + protected $_fontNames = []; /** * Flag indicating whether or not this font is bold. diff --git a/library/Zend/Pdf/Resource/Font/CidFont.php b/library/Zend/Pdf/Resource/Font/CidFont.php index a4771f897c..d04df3a37c 100644 --- a/library/Zend/Pdf/Resource/Font/CidFont.php +++ b/library/Zend/Pdf/Resource/Font/CidFont.php @@ -127,7 +127,7 @@ public function __construct(Zend_Pdf_FileParser_Font_OpenType $fontParser) /* Constract characters widths array using font CMap and glyphs widths array */ $glyphWidths = $fontParser->glyphWidths; $charGlyphs = $this->_cmap->getCoveredCharactersGlyphs(); - $charWidths = array(); + $charWidths = []; foreach ($charGlyphs as $charCode => $glyph) { if(isset($glyphWidths[$glyph]) && !is_null($glyphWidths[$glyph])) { $charWidths[$charCode] = $glyphWidths[$glyph]; @@ -161,15 +161,15 @@ public function __construct(Zend_Pdf_FileParser_Font_OpenType $fontParser) /* Width array optimization. Step2: Compact character codes sequences */ $lastCharCode = -1; - $widthsSequences = array(); + $widthsSequences = []; foreach ($charWidths as $charCode => $width) { if ($lastCharCode == -1) { - $charCodesSequense = array(); + $charCodesSequense = []; $sequenceStartCode = $charCode; } else if ($charCode != $lastCharCode + 1) { // New chracters sequence detected $widthsSequences[$sequenceStartCode] = $charCodesSequense; - $charCodesSequense = array(); + $charCodesSequense = []; $sequenceStartCode = $charCode; } $charCodesSequense[] = $width; @@ -180,10 +180,10 @@ public function __construct(Zend_Pdf_FileParser_Font_OpenType $fontParser) $widthsSequences[$sequenceStartCode] = $charCodesSequense; } - $pdfCharsWidths = array(); + $pdfCharsWidths = []; foreach ($widthsSequences as $startCode => $widthsSequence) { /* Width array optimization. Step3: Compact widths sequences */ - $pdfWidths = array(); + $pdfWidths = []; $lastWidth = -1; $widthsInSequence = 0; foreach ($widthsSequence as $width) { @@ -221,7 +221,7 @@ public function __construct(Zend_Pdf_FileParser_Font_OpenType $fontParser) // Reset widths collection $startCode += count($pdfWidths); - $pdfWidths = array(); + $pdfWidths = []; } $widthsInSequence = 2; @@ -379,7 +379,7 @@ public function getCoveredPercentage($string, $charEncoding = '') */ public function widthsForChars($charCodes) { - $widths = array(); + $widths = []; foreach ($charCodes as $key => $charCode) { if (!isset($this->_charWidths[$charCode])) { $widths[$key] = $this->_missingCharWidth; diff --git a/library/Zend/Pdf/Resource/Font/FontDescriptor.php b/library/Zend/Pdf/Resource/Font/FontDescriptor.php index bef833637a..518469329c 100644 --- a/library/Zend/Pdf/Resource/Font/FontDescriptor.php +++ b/library/Zend/Pdf/Resource/Font/FontDescriptor.php @@ -113,10 +113,10 @@ static public function factory(Zend_Pdf_Resource_Font $font, Zend_Pdf_FileParser // bits 17-19: AllCap, SmallCap, ForceBold; not available $fontDescriptor->Flags = new Zend_Pdf_Element_Numeric($flags); - $fontBBox = array(new Zend_Pdf_Element_Numeric($font->toEmSpace($fontParser->xMin)), + $fontBBox = [new Zend_Pdf_Element_Numeric($font->toEmSpace($fontParser->xMin)), new Zend_Pdf_Element_Numeric($font->toEmSpace($fontParser->yMin)), new Zend_Pdf_Element_Numeric($font->toEmSpace($fontParser->xMax)), - new Zend_Pdf_Element_Numeric($font->toEmSpace($fontParser->yMax))); + new Zend_Pdf_Element_Numeric($font->toEmSpace($fontParser->yMax))]; $fontDescriptor->FontBBox = new Zend_Pdf_Element_Array($fontBBox); $fontDescriptor->ItalicAngle = new Zend_Pdf_Element_Numeric($fontParser->italicAngle); diff --git a/library/Zend/Pdf/Resource/Font/Simple.php b/library/Zend/Pdf/Resource/Font/Simple.php index 029a566cc8..b1804f868c 100644 --- a/library/Zend/Pdf/Resource/Font/Simple.php +++ b/library/Zend/Pdf/Resource/Font/Simple.php @@ -222,7 +222,7 @@ public function getCoveredPercentage($string, $charEncoding = '') */ public function widthsForGlyphs($glyphNumbers) { - $widths = array(); + $widths = []; foreach ($glyphNumbers as $key => $glyphNumber) { if (!isset($this->_glyphWidths[$glyphNumber])) { $widths[$key] = $this->_missingGlyphWidth; diff --git a/library/Zend/Pdf/Resource/Font/Simple/Parsed.php b/library/Zend/Pdf/Resource/Font/Simple/Parsed.php index 5716d315af..1fcd7d460a 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Parsed.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Parsed.php @@ -91,7 +91,7 @@ public function __construct(Zend_Pdf_FileParser_Font_OpenType $fontParser) /* Now convert the scalar glyph widths to Zend_Pdf_Element_Numeric objects. */ - $pdfWidths = array(); + $pdfWidths = []; foreach ($this->_glyphWidths as $width) { $pdfWidths[] = new Zend_Pdf_Element_Numeric($this->toEmSpace($width)); } diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/Courier.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/Courier.php index 7bbf517d2e..371a420797 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/Courier.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/Courier.php @@ -115,7 +115,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0x0258, 0x02 => 0x0258, 0x03 => 0x0258, 0x04 => 0x0258, 0x05 => 0x0258, 0x06 => 0x0258, 0x07 => 0x0258, 0x08 => 0x0258, 0x09 => 0x0258, 0x0a => 0x0258, 0x0b => 0x0258, @@ -195,11 +195,11 @@ public function __construct() 0x0130 => 0x0258, 0x0131 => 0x0258, 0x0132 => 0x0258, 0x0133 => 0x0258, 0x0134 => 0x0258, 0x0135 => 0x0258, 0x0136 => 0x0258, 0x0137 => 0x0258, 0x0138 => 0x0258, 0x0139 => 0x0258, 0x013a => 0x0258, 0x013b => 0x0258, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -278,7 +278,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierBold.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierBold.php index 99788bb413..7a9af013d2 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierBold.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierBold.php @@ -116,7 +116,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0x0258, 0x02 => 0x0258, 0x03 => 0x0258, 0x04 => 0x0258, 0x05 => 0x0258, 0x06 => 0x0258, 0x07 => 0x0258, 0x08 => 0x0258, 0x09 => 0x0258, 0x0a => 0x0258, 0x0b => 0x0258, @@ -196,11 +196,11 @@ public function __construct() 0x0130 => 0x0258, 0x0131 => 0x0258, 0x0132 => 0x0258, 0x0133 => 0x0258, 0x0134 => 0x0258, 0x0135 => 0x0258, 0x0136 => 0x0258, 0x0137 => 0x0258, 0x0138 => 0x0258, 0x0139 => 0x0258, 0x013a => 0x0258, 0x013b => 0x0258, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -279,7 +279,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierBoldOblique.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierBoldOblique.php index 2f3527dd33..2860a82fc9 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierBoldOblique.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierBoldOblique.php @@ -117,7 +117,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0x0258, 0x02 => 0x0258, 0x03 => 0x0258, 0x04 => 0x0258, 0x05 => 0x0258, 0x06 => 0x0258, 0x07 => 0x0258, 0x08 => 0x0258, 0x09 => 0x0258, 0x0a => 0x0258, 0x0b => 0x0258, @@ -197,11 +197,11 @@ public function __construct() 0x0130 => 0x0258, 0x0131 => 0x0258, 0x0132 => 0x0258, 0x0133 => 0x0258, 0x0134 => 0x0258, 0x0135 => 0x0258, 0x0136 => 0x0258, 0x0137 => 0x0258, 0x0138 => 0x0258, 0x0139 => 0x0258, 0x013a => 0x0258, 0x013b => 0x0258, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -280,7 +280,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierOblique.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierOblique.php index 2f1766aaa5..bac6104a12 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierOblique.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/CourierOblique.php @@ -117,7 +117,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0x0258, 0x02 => 0x0258, 0x03 => 0x0258, 0x04 => 0x0258, 0x05 => 0x0258, 0x06 => 0x0258, 0x07 => 0x0258, 0x08 => 0x0258, 0x09 => 0x0258, 0x0a => 0x0258, 0x0b => 0x0258, @@ -197,11 +197,11 @@ public function __construct() 0x0130 => 0x0258, 0x0131 => 0x0258, 0x0132 => 0x0258, 0x0133 => 0x0258, 0x0134 => 0x0258, 0x0135 => 0x0258, 0x0136 => 0x0258, 0x0137 => 0x0258, 0x0138 => 0x0258, 0x0139 => 0x0258, 0x013a => 0x0258, 0x013b => 0x0258, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -280,7 +280,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/Helvetica.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/Helvetica.php index c843bbf0c5..f260d14fe9 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/Helvetica.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/Helvetica.php @@ -125,7 +125,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0x0116, 0x02 => 0x0116, 0x03 => 0x0163, 0x04 => 0x022c, 0x05 => 0x022c, 0x06 => 0x0379, 0x07 => 0x029b, 0x08 => 0xde, 0x09 => 0x014d, 0x0a => 0x014d, 0x0b => 0x0185, @@ -205,11 +205,11 @@ public function __construct() 0x0130 => 0x0116, 0x0131 => 0x0248, 0x0132 => 0x022c, 0x0133 => 0x022c, 0x0134 => 0x0225, 0x0135 => 0x022c, 0x0136 => 0x022c, 0x0137 => 0x01f4, 0x0138 => 0x022c, 0x0139 => 0x014d, 0x013a => 0x0116, 0x013b => 0x022c, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -288,7 +288,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBold.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBold.php index 032d048ea4..41719eaf5c 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBold.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBold.php @@ -125,7 +125,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0x0116, 0x02 => 0x014d, 0x03 => 0x01da, 0x04 => 0x022c, 0x05 => 0x022c, 0x06 => 0x0379, 0x07 => 0x02d2, 0x08 => 0x0116, 0x09 => 0x014d, 0x0a => 0x014d, 0x0b => 0x0185, @@ -205,11 +205,11 @@ public function __construct() 0x0130 => 0x014d, 0x0131 => 0x0248, 0x0132 => 0x0263, 0x0133 => 0x0263, 0x0134 => 0x0225, 0x0135 => 0x0263, 0x0136 => 0x0263, 0x0137 => 0x01f4, 0x0138 => 0x0263, 0x0139 => 0x014d, 0x013a => 0x0116, 0x013b => 0x022c, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -288,7 +288,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBoldOblique.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBoldOblique.php index 0ad846db4f..3e6f7f712a 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBoldOblique.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBoldOblique.php @@ -128,7 +128,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0x0116, 0x02 => 0x014d, 0x03 => 0x01da, 0x04 => 0x022c, 0x05 => 0x022c, 0x06 => 0x0379, 0x07 => 0x02d2, 0x08 => 0x0116, 0x09 => 0x014d, 0x0a => 0x014d, 0x0b => 0x0185, @@ -208,11 +208,11 @@ public function __construct() 0x0130 => 0x014d, 0x0131 => 0x0248, 0x0132 => 0x0263, 0x0133 => 0x0263, 0x0134 => 0x0225, 0x0135 => 0x0263, 0x0136 => 0x0263, 0x0137 => 0x01f4, 0x0138 => 0x0263, 0x0139 => 0x014d, 0x013a => 0x0116, 0x013b => 0x022c, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -291,7 +291,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaOblique.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaOblique.php index add19f95f4..edb7c6a31e 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaOblique.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/HelveticaOblique.php @@ -127,7 +127,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0x0116, 0x02 => 0x0116, 0x03 => 0x0163, 0x04 => 0x022c, 0x05 => 0x022c, 0x06 => 0x0379, 0x07 => 0x029b, 0x08 => 0xde, 0x09 => 0x014d, 0x0a => 0x014d, 0x0b => 0x0185, @@ -207,11 +207,11 @@ public function __construct() 0x0130 => 0x0116, 0x0131 => 0x0248, 0x0132 => 0x022c, 0x0133 => 0x022c, 0x0134 => 0x0225, 0x0135 => 0x022c, 0x0136 => 0x022c, 0x0137 => 0x01f4, 0x0138 => 0x022c, 0x0139 => 0x014d, 0x013a => 0x0116, 0x013b => 0x022c, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -290,7 +290,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/Symbol.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/Symbol.php index b5df771c10..a6eb406910 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/Symbol.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/Symbol.php @@ -56,7 +56,7 @@ class Zend_Pdf_Resource_Font_Simple_Standard_Symbol extends Zend_Pdf_Resource_Fo * See {@link encodeString()}. * @var array */ - protected $_toFontEncoding = array( + protected $_toFontEncoding = [ 0x20 => "\x20", 0x21 => "\x21", 0x2200 => "\x22", 0x23 => "\x23", 0x2203 => "\x24", 0x25 => "\x25", 0x26 => "\x26", 0x220b => "\x27", 0x28 => "\x28", 0x29 => "\x29", 0x2217 => "\x2a", 0x2b => "\x2b", @@ -104,14 +104,14 @@ class Zend_Pdf_Resource_Font_Simple_Standard_Symbol extends Zend_Pdf_Resource_Fo 0x222b => "\xf2", 0x2320 => "\xf3", 0xf8f5 => "\xf4", 0x2321 => "\xf5", 0xf8f6 => "\xf6", 0xf8f7 => "\xf7", 0xf8f8 => "\xf8", 0xf8f9 => "\xf9", 0xf8fa => "\xfa", 0xf8fb => "\xfb", 0xf8fc => "\xfc", 0xf8fd => "\xfd", - 0xf8fe => "\xfe"); + 0xf8fe => "\xfe"]; /** * Array for conversion from special font encoding to local encoding. * See {@link decodeString()}. * @var array */ - protected $_fromFontEncoding = array( + protected $_fromFontEncoding = [ 0x20 => "\x00\x20", 0x21 => "\x00\x21", 0x22 => "\x22\x00", 0x23 => "\x00\x23", 0x24 => "\x22\x03", 0x25 => "\x00\x25", 0x26 => "\x00\x26", 0x27 => "\x22\x0b", 0x28 => "\x00\x28", @@ -175,7 +175,7 @@ class Zend_Pdf_Resource_Font_Simple_Standard_Symbol extends Zend_Pdf_Resource_Fo 0xf6 => "\xf8\xf6", 0xf7 => "\xf8\xf7", 0xf8 => "\xf8\xf8", 0xf9 => "\xf8\xf9", 0xfa => "\xf8\xfa", 0xfb => "\xf8\xfb", 0xfc => "\xf8\xfc", 0xfd => "\xf8\xfd", 0xfe => "\xf8\xfe", - ); + ]; @@ -245,7 +245,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0xfa, 0x02 => 0x014d, 0x03 => 0x02c9, 0x04 => 0x01f4, 0x05 => 0x0225, 0x06 => 0x0341, 0x07 => 0x030a, 0x08 => 0x01b7, 0x09 => 0x014d, 0x0a => 0x014d, 0x0b => 0x01f4, @@ -293,11 +293,11 @@ public function __construct() 0xb0 => 0x0149, 0xb1 => 0x0112, 0xb2 => 0x02ae, 0xb3 => 0x02ae, 0xb4 => 0x02ae, 0xb5 => 0x0180, 0xb6 => 0x0180, 0xb7 => 0x0180, 0xb8 => 0x0180, 0xb9 => 0x0180, 0xba => 0x0180, 0xbb => 0x01ee, - 0xbc => 0x01ee, 0xbd => 0x01ee, 0xbe => 0x0316); + 0xbc => 0x01ee, 0xbd => 0x01ee, 0xbe => 0x0316]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x2200 => 0x03, 0x23 => 0x04, 0x2203 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x220b => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2217 => 0x0b, 0x2b => 0x0c, @@ -345,7 +345,7 @@ public function __construct() 0x222b => 0xb1, 0x2320 => 0xb2, 0xf8f5 => 0xb3, 0x2321 => 0xb4, 0xf8f6 => 0xb5, 0xf8f7 => 0xb6, 0xf8f8 => 0xb7, 0xf8f9 => 0xb8, 0xf8fa => 0xb9, 0xf8fb => 0xba, 0xf8fc => 0xbb, 0xf8fd => 0xbc, - 0xf8fe => 0xbd, 0xf8ff => 0xbe); + 0xf8fe => 0xbd, 0xf8ff => 0xbe]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesBold.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesBold.php index d1ca475cdb..06644bf263 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesBold.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesBold.php @@ -124,7 +124,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0xfa, 0x02 => 0x014d, 0x03 => 0x022b, 0x04 => 0x01f4, 0x05 => 0x01f4, 0x06 => 0x03e8, 0x07 => 0x0341, 0x08 => 0x014d, 0x09 => 0x014d, 0x0a => 0x014d, 0x0b => 0x01f4, @@ -204,11 +204,11 @@ public function __construct() 0x0130 => 0x014d, 0x0131 => 0x023a, 0x0132 => 0x01f4, 0x0133 => 0x022c, 0x0134 => 0x0225, 0x0135 => 0x01f4, 0x0136 => 0x01f4, 0x0137 => 0x01bc, 0x0138 => 0x022c, 0x0139 => 0x012c, 0x013a => 0x0116, 0x013b => 0x01f4, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -287,7 +287,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesBoldItalic.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesBoldItalic.php index 5a0bf0f8a7..0fad8d0baa 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesBoldItalic.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesBoldItalic.php @@ -125,7 +125,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0xfa, 0x02 => 0x0185, 0x03 => 0x022b, 0x04 => 0x01f4, 0x05 => 0x01f4, 0x06 => 0x0341, 0x07 => 0x030a, 0x08 => 0x014d, 0x09 => 0x014d, 0x0a => 0x014d, 0x0b => 0x01f4, @@ -205,11 +205,11 @@ public function __construct() 0x0130 => 0x0116, 0x0131 => 0x025e, 0x0132 => 0x01f4, 0x0133 => 0x022c, 0x0134 => 0x0225, 0x0135 => 0x01f4, 0x0136 => 0x01f4, 0x0137 => 0x0185, 0x0138 => 0x022c, 0x0139 => 0x012c, 0x013a => 0x0116, 0x013b => 0x01f4, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -288,7 +288,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesItalic.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesItalic.php index 6d9d4fb4cb..68124c7948 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesItalic.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesItalic.php @@ -125,7 +125,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0xfa, 0x02 => 0x014d, 0x03 => 0x01a4, 0x04 => 0x01f4, 0x05 => 0x01f4, 0x06 => 0x0341, 0x07 => 0x030a, 0x08 => 0x014d, 0x09 => 0x014d, 0x0a => 0x014d, 0x0b => 0x01f4, @@ -205,11 +205,11 @@ public function __construct() 0x0130 => 0x0116, 0x0131 => 0x02a3, 0x0132 => 0x01f4, 0x0133 => 0x01f4, 0x0134 => 0x0225, 0x0135 => 0x01f4, 0x0136 => 0x01f4, 0x0137 => 0x0185, 0x0138 => 0x01f4, 0x0139 => 0x012c, 0x013a => 0x0116, 0x013b => 0x01f4, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -288,7 +288,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesRoman.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesRoman.php index baf8ffc7a6..e0b9c45d0a 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesRoman.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/TimesRoman.php @@ -125,7 +125,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0xfa, 0x02 => 0x014d, 0x03 => 0x0198, 0x04 => 0x01f4, 0x05 => 0x01f4, 0x06 => 0x0341, 0x07 => 0x030a, 0x08 => 0x014d, 0x09 => 0x014d, 0x0a => 0x014d, 0x0b => 0x01f4, @@ -205,11 +205,11 @@ public function __construct() 0x0130 => 0x0116, 0x0131 => 0x0234, 0x0132 => 0x01f4, 0x0133 => 0x01f4, 0x0134 => 0x0225, 0x0135 => 0x01f4, 0x0136 => 0x01f4, 0x0137 => 0x01bc, 0x0138 => 0x01f4, 0x0139 => 0x012c, 0x013a => 0x0116, 0x013b => 0x01f4, - ); + ]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x21 => 0x02, 0x22 => 0x03, 0x23 => 0x04, 0x24 => 0x05, 0x25 => 0x06, 0x26 => 0x07, 0x2019 => 0x08, 0x28 => 0x09, 0x29 => 0x0a, 0x2a => 0x0b, 0x2b => 0x0c, @@ -288,7 +288,7 @@ public function __construct() 0x2212 => 0x012d, 0xce => 0x012e, 0x0148 => 0x012f, 0x0163 => 0x0130, 0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134, 0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138, - 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b); + 0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Simple/Standard/ZapfDingbats.php b/library/Zend/Pdf/Resource/Font/Simple/Standard/ZapfDingbats.php index c55139b496..edfa987614 100644 --- a/library/Zend/Pdf/Resource/Font/Simple/Standard/ZapfDingbats.php +++ b/library/Zend/Pdf/Resource/Font/Simple/Standard/ZapfDingbats.php @@ -56,7 +56,7 @@ class Zend_Pdf_Resource_Font_Simple_Standard_ZapfDingbats extends Zend_Pdf_Resou * See {@link encodeString()}. * @var array */ - protected $_toFontEncoding = array( + protected $_toFontEncoding = [ 0x20 => "\x20", 0x2701 => "\x21", 0x2702 => "\x22", 0x2703 => "\x23", 0x2704 => "\x24", 0x260e => "\x25", 0x2706 => "\x26", 0x2707 => "\x27", 0x2708 => "\x28", 0x2709 => "\x29", 0x261b => "\x2a", 0x261e => "\x2b", @@ -107,14 +107,14 @@ class Zend_Pdf_Resource_Font_Simple_Standard_ZapfDingbats extends Zend_Pdf_Resou 0x27b1 => "\xf1", 0x27b2 => "\xf2", 0x27b3 => "\xf3", 0x27b4 => "\xf4", 0x27b5 => "\xf5", 0x27b6 => "\xf6", 0x27b7 => "\xf7", 0x27b8 => "\xf8", 0x27b9 => "\xf9", 0x27ba => "\xfa", 0x27bb => "\xfb", 0x27bc => "\xfc", - 0x27bd => "\xfd", 0x27be => "\xfe"); + 0x27bd => "\xfd", 0x27be => "\xfe"]; /** * Array for conversion from special font encoding to local encoding. * See {@link decodeString()}. * @var array */ - protected $_fromFontEncoding = array( + protected $_fromFontEncoding = [ 0x20 => "\x00\x20", 0x21 => "\x27\x01", 0x22 => "\x27\x02", 0x23 => "\x27\x03", 0x24 => "\x27\x04", 0x25 => "\x26\x0e", 0x26 => "\x27\x06", 0x27 => "\x27\x07", 0x28 => "\x27\x08", @@ -182,7 +182,7 @@ class Zend_Pdf_Resource_Font_Simple_Standard_ZapfDingbats extends Zend_Pdf_Resou 0xf5 => "\x27\xb5", 0xf6 => "\x27\xb6", 0xf7 => "\x27\xb7", 0xf8 => "\x27\xb8", 0xf9 => "\x27\xb9", 0xfa => "\x27\xba", 0xfb => "\x27\xbb", 0xfc => "\x27\xbc", 0xfd => "\x27\xbd", - 0xfe => "\x27\xbe"); + 0xfe => "\x27\xbe"]; @@ -265,7 +265,7 @@ public function __construct() * since this data never makes it to the PDF file. It is only used * internally for layout calculations. */ - $this->_glyphWidths = array( + $this->_glyphWidths = [ 0x00 => 0x01f4, 0x01 => 0x0116, 0x02 => 0x03ce, 0x03 => 0x03c1, 0x04 => 0x03ce, 0x05 => 0x03d4, 0x06 => 0x02cf, 0x07 => 0x0315, 0x08 => 0x0316, 0x09 => 0x0317, 0x0a => 0x02b2, 0x0b => 0x03c0, @@ -316,11 +316,11 @@ public function __construct() 0xbc => 0x036a, 0xbd => 0x036a, 0xbe => 0x02f8, 0xbf => 0x03b2, 0xc0 => 0x0303, 0xc1 => 0x0361, 0xc2 => 0x0303, 0xc3 => 0x0378, 0xc4 => 0x03c7, 0xc5 => 0x0378, 0xc6 => 0x033f, 0xc7 => 0x0369, - 0xc8 => 0x039f, 0xc9 => 0x03ca, 0xca => 0x0396); + 0xc8 => 0x039f, 0xc9 => 0x03ca, 0xca => 0x0396]; /* The cmap table is similarly synthesized. */ - $cmapData = array( + $cmapData = [ 0x20 => 0x01, 0x2701 => 0x02, 0x2702 => 0x03, 0x2703 => 0x04, 0x2704 => 0x05, 0x260e => 0x06, 0x2706 => 0x07, 0x2707 => 0x08, 0x2708 => 0x09, 0x2709 => 0x0a, 0x261b => 0x0b, 0x261e => 0x0c, @@ -371,7 +371,7 @@ public function __construct() 0x27b1 => 0xbd, 0x27b2 => 0xbe, 0x27b3 => 0xbf, 0x27b4 => 0xc0, 0x27b5 => 0xc1, 0x27b6 => 0xc2, 0x27b7 => 0xc3, 0x27b8 => 0xc4, 0x27b9 => 0xc5, 0x27ba => 0xc6, 0x27bb => 0xc7, 0x27bc => 0xc8, - 0x27bd => 0xc9, 0x27be => 0xca); + 0x27bd => 0xc9, 0x27be => 0xca]; require_once 'Zend/Pdf/Cmap.php'; $this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData( Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData); diff --git a/library/Zend/Pdf/Resource/Font/Type0.php b/library/Zend/Pdf/Resource/Font/Type0.php index 4a88580cf4..058e1dabc3 100644 --- a/library/Zend/Pdf/Resource/Font/Type0.php +++ b/library/Zend/Pdf/Resource/Font/Type0.php @@ -133,7 +133,7 @@ public function __construct(Zend_Pdf_Resource_Font_CidFont $descendantFont) $this->_resource->Subtype = new Zend_Pdf_Element_Name('Type0'); $this->_resource->BaseFont = new Zend_Pdf_Element_Name($descendantFont->getResource()->BaseFont->value); - $this->_resource->DescendantFonts = new Zend_Pdf_Element_Array(array( $descendantFont->getResource() )); + $this->_resource->DescendantFonts = new Zend_Pdf_Element_Array([ $descendantFont->getResource() ]); $this->_resource->Encoding = new Zend_Pdf_Element_Name('Identity-H'); $toUnicode = $this->_objectFactory->newStreamObject(self::getToUnicodeCMapData()); diff --git a/library/Zend/Pdf/Resource/GraphicsState.php b/library/Zend/Pdf/Resource/GraphicsState.php index 960a0decec..b10f80c95b 100644 --- a/library/Zend/Pdf/Resource/GraphicsState.php +++ b/library/Zend/Pdf/Resource/GraphicsState.php @@ -88,8 +88,8 @@ public function __construct(Zend_Pdf_Element_Object $extGStateObject = null) */ public function setAlpha($alpha, $mode = 'Normal') { - if (!in_array($mode, array('Normal', 'Multiply', 'Screen', 'Overlay', 'Darken', 'Lighten', 'ColorDodge', - 'ColorBurn', 'HardLight', 'SoftLight', 'Difference', 'Exclusion'))) { + if (!in_array($mode, ['Normal', 'Multiply', 'Screen', 'Overlay', 'Darken', 'Lighten', 'ColorDodge', + 'ColorBurn', 'HardLight', 'SoftLight', 'Difference', 'Exclusion'])) { require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('Unsupported transparency mode.'); } diff --git a/library/Zend/Pdf/Resource/Image/Jpeg.php b/library/Zend/Pdf/Resource/Image/Jpeg.php index ad13235bee..d3158e05db 100644 --- a/library/Zend/Pdf/Resource/Image/Jpeg.php +++ b/library/Zend/Pdf/Resource/Image/Jpeg.php @@ -122,7 +122,7 @@ public function __construct($imageFileName) $this->_width = $imageInfo[0]; $this->_height = $imageInfo[1]; - $this->_imageProperties = array(); + $this->_imageProperties = []; $this->_imageProperties['bitDepth'] = $imageInfo['bits']; $this->_imageProperties['jpegImageType'] = $imageInfo[2]; $this->_imageProperties['jpegColorType'] = $imageInfo['channels']; diff --git a/library/Zend/Pdf/Resource/Image/Png.php b/library/Zend/Pdf/Resource/Image/Png.php index 661b4325fb..ec8426e0f0 100644 --- a/library/Zend/Pdf/Resource/Image/Png.php +++ b/library/Zend/Pdf/Resource/Image/Png.php @@ -109,7 +109,7 @@ public function __construct($imageFileName) $this->_width = $width; $this->_height = $height; - $this->_imageProperties = array(); + $this->_imageProperties = []; $this->_imageProperties['bitDepth'] = $bits; $this->_imageProperties['pngColorType'] = $color; $this->_imageProperties['pngFilterType'] = $prefilter; @@ -155,27 +155,27 @@ public function __construct($imageFileName) switch ($color) { case Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_GRAY: $baseColor = ord(substr($trnsData, 1, 1)); - $transparencyData = array(new Zend_Pdf_Element_Numeric($baseColor), - new Zend_Pdf_Element_Numeric($baseColor)); + $transparencyData = [new Zend_Pdf_Element_Numeric($baseColor), + new Zend_Pdf_Element_Numeric($baseColor)]; break; case Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_RGB: $red = ord(substr($trnsData,1,1)); $green = ord(substr($trnsData,3,1)); $blue = ord(substr($trnsData,5,1)); - $transparencyData = array(new Zend_Pdf_Element_Numeric($red), + $transparencyData = [new Zend_Pdf_Element_Numeric($red), new Zend_Pdf_Element_Numeric($red), new Zend_Pdf_Element_Numeric($green), new Zend_Pdf_Element_Numeric($green), new Zend_Pdf_Element_Numeric($blue), - new Zend_Pdf_Element_Numeric($blue)); + new Zend_Pdf_Element_Numeric($blue)]; break; case Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_INDEXED: //Find the first transparent color in the index, we will mask that. (This is a bit of a hack. This should be a SMask and mask all entries values). if(($trnsIdx = strpos($trnsData, "\0")) !== false) { - $transparencyData = array(new Zend_Pdf_Element_Numeric($trnsIdx), - new Zend_Pdf_Element_Numeric($trnsIdx)); + $transparencyData = [new Zend_Pdf_Element_Numeric($trnsIdx), + new Zend_Pdf_Element_Numeric($trnsIdx)]; } break; @@ -321,7 +321,7 @@ public function __construct($imageFileName) $imageDictionary->SMask = $smaskStream; // Encode stream with FlateDecode filter - $smaskStreamDecodeParms = array(); + $smaskStreamDecodeParms = []; $smaskStreamDecodeParms['Predictor'] = new Zend_Pdf_Element_Numeric(15); $smaskStreamDecodeParms['Columns'] = new Zend_Pdf_Element_Numeric($width); $smaskStreamDecodeParms['Colors'] = new Zend_Pdf_Element_Numeric(1); @@ -341,7 +341,7 @@ public function __construct($imageFileName) $imageDictionary->BitsPerComponent = new Zend_Pdf_Element_Numeric($bits); $imageDictionary->Filter = new Zend_Pdf_Element_Name('FlateDecode'); - $decodeParms = array(); + $decodeParms = []; $decodeParms['Predictor'] = new Zend_Pdf_Element_Numeric(15); // Optimal prediction $decodeParms['Columns'] = new Zend_Pdf_Element_Numeric($width); $decodeParms['Colors'] = new Zend_Pdf_Element_Numeric((($color==Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_RGB || $color==Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_RGB_ALPHA)?(3):(1))); diff --git a/library/Zend/Pdf/Resource/Image/Tiff.php b/library/Zend/Pdf/Resource/Image/Tiff.php index 3618951a75..c3bd04d7fd 100644 --- a/library/Zend/Pdf/Resource/Image/Tiff.php +++ b/library/Zend/Pdf/Resource/Image/Tiff.php @@ -391,7 +391,7 @@ public function __construct($imageFileName) throw new Zend_Pdf_Exception("Problem reading tiff file. Tiff is probably corrupt."); } - $this->_imageProperties = array(); + $this->_imageProperties = []; $this->_imageProperties['bitDepth'] = $this->_bitsPerSample; $this->_imageProperties['fileSize'] = $this->_fileSize; $this->_imageProperties['TIFFendianType'] = $this->_endianType; @@ -406,7 +406,7 @@ public function __construct($imageFileName) $imageDictionary->Width = new Zend_Pdf_Element_Numeric($this->_width); if($this->_whiteIsZero === true) { - $imageDictionary->Decode = new Zend_Pdf_Element_Array(array(new Zend_Pdf_Element_Numeric(1), new Zend_Pdf_Element_Numeric(0))); + $imageDictionary->Decode = new Zend_Pdf_Element_Array([new Zend_Pdf_Element_Numeric(1), new Zend_Pdf_Element_Numeric(0)]); } $imageDictionary->Height = new Zend_Pdf_Element_Numeric($this->_height); $imageDictionary->ColorSpace = new Zend_Pdf_Element_Name($this->_colorSpace); diff --git a/library/Zend/Pdf/StringParser.php b/library/Zend/Pdf/StringParser.php index e54991047a..86a8802b3d 100644 --- a/library/Zend/Pdf/StringParser.php +++ b/library/Zend/Pdf/StringParser.php @@ -69,7 +69,7 @@ class Zend_Pdf_StringParser * * @var array */ - private $_elements = array(); + private $_elements = []; /** * PDF objects factory. @@ -87,7 +87,7 @@ class Zend_Pdf_StringParser public function cleanUp() { $this->_context = null; - $this->_elements = array(); + $this->_elements = []; $this->_objFactory = null; } @@ -433,7 +433,7 @@ private function _readBinaryString() */ private function _readArray() { - $elements = array(); + $elements = []; while ( strlen($nextLexeme = $this->readLexeme()) != 0 ) { if ($nextLexeme != ']') { @@ -554,7 +554,7 @@ public function getObject($offset, Zend_Pdf_Element_Reference_Context $context) $this->offset = $offset; $this->_context = $context; - $this->_elements = array(); + $this->_elements = []; $objNum = $this->readLexeme(); if (!ctype_digit($objNum)) { diff --git a/library/Zend/Pdf/Style.php b/library/Zend/Pdf/Style.php index 4aff3e48cc..11c1f81150 100644 --- a/library/Zend/Pdf/Style.php +++ b/library/Zend/Pdf/Style.php @@ -149,7 +149,7 @@ public function setLineDashingPattern($pattern, $phase = 0) { require_once 'Zend/Pdf/Page.php'; if ($pattern === Zend_Pdf_Page::LINE_DASHING_SOLID) { - $pattern = array(); + $pattern = []; $phase = 0; } diff --git a/library/Zend/Pdf/Trailer.php b/library/Zend/Pdf/Trailer.php index 1c1b5e1eb6..8425caa037 100644 --- a/library/Zend/Pdf/Trailer.php +++ b/library/Zend/Pdf/Trailer.php @@ -29,7 +29,7 @@ */ abstract class Zend_Pdf_Trailer { - private static $_allowedKeys = array('Size', 'Prev', 'Root', 'Encrypt', 'Info', 'ID', 'Index', 'W', 'XRefStm', 'DocChecksum'); + private static $_allowedKeys = ['Size', 'Prev', 'Root', 'Encrypt', 'Info', 'ID', 'Index', 'W', 'XRefStm', 'DocChecksum']; /** * Trailer dictionary. diff --git a/library/Zend/ProgressBar/Adapter.php b/library/Zend/ProgressBar/Adapter.php index 89e59183b4..173f01c735 100644 --- a/library/Zend/ProgressBar/Adapter.php +++ b/library/Zend/ProgressBar/Adapter.php @@ -34,10 +34,10 @@ abstract class Zend_ProgressBar_Adapter * * @var array */ - protected $_skipOptions = array( + protected $_skipOptions = [ 'options', 'config', - ); + ]; /** * Create a new adapter diff --git a/library/Zend/ProgressBar/Adapter/Console.php b/library/Zend/ProgressBar/Adapter/Console.php index abfc3b0557..2b83f25ced 100644 --- a/library/Zend/ProgressBar/Adapter/Console.php +++ b/library/Zend/ProgressBar/Adapter/Console.php @@ -86,9 +86,9 @@ class Zend_ProgressBar_Adapter_Console extends Zend_ProgressBar_Adapter * * @var array */ - protected $_elements = array(self::ELEMENT_PERCENT, + protected $_elements = [self::ELEMENT_PERCENT, self::ELEMENT_BAR, - self::ELEMENT_ETA); + self::ELEMENT_ETA]; /** * Which action to do at finish call @@ -263,10 +263,10 @@ public function setWidth($width = null) */ public function setElements(array $elements) { - $allowedElements = array(self::ELEMENT_PERCENT, + $allowedElements = [self::ELEMENT_PERCENT, self::ELEMENT_BAR, self::ELEMENT_ETA, - self::ELEMENT_TEXT); + self::ELEMENT_TEXT]; if (count(array_diff($elements, $allowedElements)) > 0) { require_once 'Zend/ProgressBar/Adapter/Exception.php'; @@ -365,9 +365,9 @@ public function setCharset($charset) */ public function setFinishAction($action) { - $allowedActions = array(self::FINISH_ACTION_CLEAR_LINE, + $allowedActions = [self::FINISH_ACTION_CLEAR_LINE, self::FINISH_ACTION_EOL, - self::FINISH_ACTION_NONE); + self::FINISH_ACTION_NONE]; if (!in_array($action, $allowedActions)) { require_once 'Zend/ProgressBar/Adapter/Exception.php'; @@ -401,7 +401,7 @@ public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $te } // Build all elements - $renderedElements = array(); + $renderedElements = []; foreach ($this->_elements as $element) { switch ($element) { diff --git a/library/Zend/ProgressBar/Adapter/JsPull.php b/library/Zend/ProgressBar/Adapter/JsPull.php index 62e76fd241..6b6bc79039 100644 --- a/library/Zend/ProgressBar/Adapter/JsPull.php +++ b/library/Zend/ProgressBar/Adapter/JsPull.php @@ -70,7 +70,7 @@ public function setExitAfterSend($exitAfterSend) */ public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text) { - $arguments = array( + $arguments = [ 'current' => $current, 'max' => $max, 'percent' => ($percent * 100), @@ -78,7 +78,7 @@ public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $te 'timeRemaining' => $timeRemaining, 'text' => $text, 'finished' => false - ); + ]; $data = Zend_Json::encode($arguments); @@ -93,7 +93,7 @@ public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $te */ public function finish() { - $data = Zend_Json::encode(array('finished' => true)); + $data = Zend_Json::encode(['finished' => true]); $this->_outputData($data); } diff --git a/library/Zend/ProgressBar/Adapter/JsPush.php b/library/Zend/ProgressBar/Adapter/JsPush.php index bba55c83c3..ea9c25c086 100644 --- a/library/Zend/ProgressBar/Adapter/JsPush.php +++ b/library/Zend/ProgressBar/Adapter/JsPush.php @@ -92,14 +92,14 @@ public function setFinishMethodName($methodName) */ public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text) { - $arguments = array( + $arguments = [ 'current' => $current, 'max' => $max, 'percent' => ($percent * 100), 'timeTaken' => $timeTaken, 'timeRemaining' => $timeRemaining, 'text' => $text - ); + ]; $data = '", $response->getBody() ); @@ -465,25 +465,25 @@ public function testRedirect() $response->getBody() ); $response = new Zend_OpenId_ResponseHelper(false); - Zend_OpenId::redirect("http://www.test.com/test.php", array('a'=>'b'), $response, 'GET'); + Zend_OpenId::redirect("http://www.test.com/test.php", ['a'=>'b'], $response, 'GET'); $this->assertSame( "", $response->getBody() ); $response = new Zend_OpenId_ResponseHelper(false); - Zend_OpenId::redirect("http://www.test.com/test.php", array('a'=>'b','c'=>'d'), $response, 'GET'); + Zend_OpenId::redirect("http://www.test.com/test.php", ['a'=>'b','c'=>'d'], $response, 'GET'); $this->assertSame( "", $response->getBody() ); $response = new Zend_OpenId_ResponseHelper(false); - Zend_OpenId::redirect("http://www.test.com/test.php?a=b", array('c'=>'d'), $response, 'GET'); + Zend_OpenId::redirect("http://www.test.com/test.php?a=b", ['c'=>'d'], $response, 'GET'); $this->assertSame( "", $response->getBody() ); $response = new Zend_OpenId_ResponseHelper(false); - Zend_OpenId::redirect("http://www.test.com/test.php", array('a'=>'x y'), $response, 'GET'); + Zend_OpenId::redirect("http://www.test.com/test.php", ['a'=>'x y'], $response, 'GET'); $this->assertSame( "", $response->getBody() ); @@ -491,8 +491,8 @@ public function testRedirect() $response = new Zend_OpenId_ResponseHelper(true); Zend_OpenId::redirect("http://www.test.com/", null, $response, 'POST'); $this->assertSame( 200, $response->getHttpResponseCode() ); - $this->assertSame( array(), $response->getRawHeaders() ); - $this->assertSame( array(), $response->getHeaders() ); + $this->assertSame( [], $response->getRawHeaders() ); + $this->assertSame( [], $response->getHeaders() ); $this->assertSame( "\n" . "
      \n" . @@ -501,7 +501,7 @@ public function testRedirect() $response->getBody() ); $response = new Zend_OpenId_ResponseHelper(true); - Zend_OpenId::redirect("http://www.test.com/test.php?a=b", array('a'=>'b'), $response, 'POST'); + Zend_OpenId::redirect("http://www.test.com/test.php?a=b", ['a'=>'b'], $response, 'POST'); $this->assertSame( "\n" . "\n" . @@ -511,7 +511,7 @@ public function testRedirect() $response->getBody() ); $response = new Zend_OpenId_ResponseHelper(true); - Zend_OpenId::redirect("http://www.test.com/test.php?a=b", array('a'=>'b','c'=>'d'), $response, 'POST'); + Zend_OpenId::redirect("http://www.test.com/test.php?a=b", ['a'=>'b','c'=>'d'], $response, 'POST'); $this->assertSame( "\n" . "\n" . diff --git a/tests/Zend/Paginator/Adapter/ArrayTest.php b/tests/Zend/Paginator/Adapter/ArrayTest.php index 322fabd2ce..09d2955706 100644 --- a/tests/Zend/Paginator/Adapter/ArrayTest.php +++ b/tests/Zend/Paginator/Adapter/ArrayTest.php @@ -85,8 +85,8 @@ public function testReturnsCorrectCount() * @group ZF-4151 */ public function testEmptySet() { - $this->_adapter = new Zend_Paginator_Adapter_Array(array()); + $this->_adapter = new Zend_Paginator_Adapter_Array([]); $actual = $this->_adapter->getItems(0, 10); - $this->assertEquals(array(), $actual); + $this->assertEquals([], $actual); } } diff --git a/tests/Zend/Paginator/Adapter/DbSelect/OracleTest.php b/tests/Zend/Paginator/Adapter/DbSelect/OracleTest.php index 3a627b8b51..397e9c9a1f 100644 --- a/tests/Zend/Paginator/Adapter/DbSelect/OracleTest.php +++ b/tests/Zend/Paginator/Adapter/DbSelect/OracleTest.php @@ -62,10 +62,10 @@ protected function setUp () } $this->_db = new Zend_Db_Adapter_Oracle( - array('host' => TESTS_ZEND_DB_ADAPTER_ORACLE_HOSTNAME , + ['host' => TESTS_ZEND_DB_ADAPTER_ORACLE_HOSTNAME , 'username' => TESTS_ZEND_DB_ADAPTER_ORACLE_USERNAME , 'password' => TESTS_ZEND_DB_ADAPTER_ORACLE_PASSWORD , - 'dbname' => TESTS_ZEND_DB_ADAPTER_ORACLE_SID)); + 'dbname' => TESTS_ZEND_DB_ADAPTER_ORACLE_SID]); $this->_dropTable(); $this->_createTable(); diff --git a/tests/Zend/Paginator/Adapter/DbSelectTest.php b/tests/Zend/Paginator/Adapter/DbSelectTest.php index f983502711..2cd0a8978f 100644 --- a/tests/Zend/Paginator/Adapter/DbSelectTest.php +++ b/tests/Zend/Paginator/Adapter/DbSelectTest.php @@ -79,9 +79,9 @@ protected function setUp() parent::setUp(); - $this->_db = new Zend_Db_Adapter_Pdo_Sqlite(array( + $this->_db = new Zend_Db_Adapter_Pdo_Sqlite([ 'dbname' => dirname(__FILE__) . '/../_files/test.sqlite' - )); + ]); $this->_table = new TestTable($this->_db); @@ -105,7 +105,7 @@ protected function tearDown() */ public function testCacheIdentifierIsHashOfAssembledSelect() { - $dbAdapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', array(''), '', false); + $dbAdapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [''], '', false); $select = new Zend_Db_Select($dbAdapter); $select->from('ZF_6989'); @@ -226,9 +226,9 @@ public function testGroupByQueryReturnsOneRow() */ public function testGroupByQueryOnEmptyTableReturnsRowCountZero() { - $db = new Zend_Db_Adapter_Pdo_Sqlite(array( + $db = new Zend_Db_Adapter_Pdo_Sqlite([ 'dbname' => dirname(__FILE__) . '/../_files/testempty.sqlite' - )); + ]); $query = $db->select()->from('test') ->order('number ASC') @@ -272,7 +272,7 @@ public function testDistinctColumnQueryReturnsCorrectResult() public function testSelectSpecificColumns() { $number = $this->_db->quoteIdentifier('number'); - $query = $this->_db->select()->from('test', array('testgroup', 'number')) + $query = $this->_db->select()->from('test', ['testgroup', 'number']) ->where("$number >= ?", '1'); $adapter = new Zend_Paginator_Adapter_DbSelect($query); @@ -320,33 +320,33 @@ public function testSelectHasAliasedColumns() // Insert some data $db->insert('sandboxTransaction', - array( + [ 'foreign_id' => 1, 'name' => 'transaction 1 with foreign_id 1', - ) + ] ); $db->insert('sandboxTransaction', - array( + [ 'foreign_id' => 1, 'name' => 'transaction 2 with foreign_id 1', - ) + ] ); $db->insert('sandboxForeign', - array( + [ 'name' => 'John Doe', - ) + ] ); $db->insert('sandboxForeign', - array( + [ 'name' => 'Jane Smith', - ) + ] ); - $query = $db->select()->from(array('a'=>'sandboxTransaction'), array()) - ->join(array('b'=>'sandboxForeign'), 'a.foreign_id = b.id', array('name')) + $query = $db->select()->from(['a'=>'sandboxTransaction'], []) + ->join(['b'=>'sandboxForeign'], 'a.foreign_id = b.id', ['name']) ->distinct(true); try { @@ -362,10 +362,10 @@ public function testSelectHasAliasedColumns() */ public function testUnionSelect() { - $union = $this->_db->select()->union(array( + $union = $this->_db->select()->union([ $this->_db->select()->from('test')->where('number <= 250'), $this->_db->select()->from('test')->where('number > 250') - )); + ]); $adapter = new Zend_Paginator_Adapter_DbSelect($union); $expected = 500; @@ -379,10 +379,10 @@ public function testUnionSelect() */ public function testGetCountSelect() { - $union = $this->_db->select()->union(array( + $union = $this->_db->select()->union([ $this->_db->select()->from('test')->where('number <= 250'), $this->_db->select()->from('test')->where('number > 250') - )); + ]); $adapter = new Zend_Paginator_Adapter_DbSelect($union); @@ -396,7 +396,7 @@ public function testGetCountSelect() */ public function testMultipleDistinctColumns() { - $select = $this->_db->select()->from('test', array('testgroup', 'number')) + $select = $this->_db->select()->from('test', ['testgroup', 'number']) ->distinct(true); $adapter = new Zend_Paginator_Adapter_DbSelect($select); @@ -429,7 +429,7 @@ public function testSingleDistinctColumn() public function testGroupByMultipleColumns() { $select = $this->_db->select()->from('test', 'testgroup') - ->group(array('number', 'testgroup')); + ->group(['number', 'testgroup']); $adapter = new Zend_Paginator_Adapter_DbSelect($select); @@ -496,9 +496,9 @@ public function testMultipleGroupSelect() public function testSetRowCountWithAlias() { $select = $this->_db->select(); - $select->from('test', array( + $select->from('test', [ Zend_Paginator_Adapter_DbSelect::ROW_COUNT_COLUMN => new Zend_Db_Expr('COUNT(DISTINCT number)') - )); + ]); $this->_db->setProfiler(true); $adapter = new Zend_Paginator_Adapter_DbSelect($this->_db->select()); @@ -532,10 +532,10 @@ public function testGroupByOneColumnWithZendExpr() public function testObjectSelectWithBind() { $select = $this->_db->select(); - $select->from('test', array('number')) + $select->from('test', ['number']) ->where('number = ?') ->distinct(true) - ->bind(array(250)); + ->bind([250]); $adapter = new Zend_Paginator_Adapter_DbSelect($select); $this->assertEquals(1, $adapter->count()); @@ -547,9 +547,9 @@ public function testObjectSelectWithBind() $selectUnion = $this->_db ->select() - ->bind(array(250)); + ->bind([250]); - $selectUnion->union(array($select, $select2)); + $selectUnion->union([$select, $select2]); $adapter = new Zend_Paginator_Adapter_DbSelect($selectUnion); $this->assertEquals(2, $adapter->count()); } diff --git a/tests/Zend/Paginator/Adapter/IteratorTest.php b/tests/Zend/Paginator/Adapter/IteratorTest.php index 2dba80529b..e74ceb9652 100644 --- a/tests/Zend/Paginator/Adapter/IteratorTest.php +++ b/tests/Zend/Paginator/Adapter/IteratorTest.php @@ -108,7 +108,7 @@ public function testThrowsExceptionIfNotCountable() */ public function testDoesNotThrowOutOfBoundsExceptionIfIteratorIsEmpty() { - $this->_paginator = Zend_Paginator::factory(new ArrayIterator(array())); + $this->_paginator = Zend_Paginator::factory(new ArrayIterator([])); $items = $this->_paginator->getCurrentItems(); try { foreach ($items as $item); @@ -131,9 +131,9 @@ public function testGetItemsSerializable() { * @group ZF-4151 */ public function testEmptySet() { - $iterator = new ArrayIterator(array()); + $iterator = new ArrayIterator([]); $this->_adapter = new Zend_Paginator_Adapter_Iterator($iterator); $actual = $this->_adapter->getItems(0, 10); - $this->assertEquals(array(), $actual); + $this->assertEquals([], $actual); } } diff --git a/tests/Zend/Paginator/Adapter/NullTest.php b/tests/Zend/Paginator/Adapter/NullTest.php index cab6110dfd..279af68655 100644 --- a/tests/Zend/Paginator/Adapter/NullTest.php +++ b/tests/Zend/Paginator/Adapter/NullTest.php @@ -107,7 +107,7 @@ public function testAdapterReturnsCorrectValues() public function testEmptySet() { $this->_adapter = new Zend_Paginator_Adapter_Null(0); $actual = $this->_adapter->getItems(0, 10); - $this->assertEquals(array(), $actual); + $this->assertEquals([], $actual); } /** diff --git a/tests/Zend/Paginator/ScrollingStyle/JumpingTest.php b/tests/Zend/Paginator/ScrollingStyle/JumpingTest.php index 322fa05797..5bfd67661e 100644 --- a/tests/Zend/Paginator/ScrollingStyle/JumpingTest.php +++ b/tests/Zend/Paginator/ScrollingStyle/JumpingTest.php @@ -102,7 +102,7 @@ public function testGetsPagesInRangeForLastPage() { $this->_paginator->setCurrentPageNumber(11); $actual = $this->_scrollingStyle->getPages($this->_paginator); - $expected = array(11 => 11); + $expected = [11 => 11]; $this->assertEquals($expected, $actual); } diff --git a/tests/Zend/PaginatorTest.php b/tests/Zend/PaginatorTest.php index bd904015e0..819bd9c5af 100644 --- a/tests/Zend/PaginatorTest.php +++ b/tests/Zend/PaginatorTest.php @@ -143,9 +143,9 @@ protected function setUp() $this->markTestSkipped('Pdo_Sqlite extension is not loaded'); } - $this->_adapter = new Zend_Db_Adapter_Pdo_Sqlite(array( + $this->_adapter = new Zend_Db_Adapter_Pdo_Sqlite([ 'dbname' => dirname(__FILE__) . '/Paginator/_files/test.sqlite' - )); + ]); $this->_query = $this->_adapter->select()->from('test'); @@ -156,8 +156,8 @@ protected function setUp() // get a fresh new copy of ViewRenderer in each tests Zend_Controller_Action_HelperBroker::resetHelpers(); - $fO = array('lifetime' => 3600, 'automatic_serialization' => true); - $bO = array('cache_dir'=> $this->_getTmpDir()); + $fO = ['lifetime' => 3600, 'automatic_serialization' => true]; + $bO = ['cache_dir'=> $this->_getTmpDir()]; $this->_cache = Zend_Cache::factory('Core', 'File', $fO, $bO); @@ -190,7 +190,7 @@ protected function _rmDirRecursive($path) foreach ($dir as $file) { if (!$file->isDir()) { unlink($file->getPathname()); - } elseif (!in_array($file->getFilename(), array('.', '..'))) { + } elseif (!in_array($file->getFilename(), ['.', '..'])) { $this->_rmDirRecursive($file->getPathname()); } } @@ -283,29 +283,29 @@ public function testAddsSingleScrollingStylePrefixPath() $paths = $loader->getPaths(); $this->assertArrayHasKey('prefix1_', $paths); - $this->assertEquals($paths['prefix1_'], array('path1/')); + $this->assertEquals($paths['prefix1_'], ['path1/']); $loader->clearPaths('prefix1'); } public function testAddsSingleScrollingStylePrefixPathWithArray() { - Zend_Paginator::addScrollingStylePrefixPaths(array('prefix' => 'prefix2', - 'path' => 'path2')); + Zend_Paginator::addScrollingStylePrefixPaths(['prefix' => 'prefix2', + 'path' => 'path2']); $loader = Zend_Paginator::getScrollingStyleLoader(); $paths = $loader->getPaths(); $this->assertArrayHasKey('prefix2_', $paths); - $this->assertEquals($paths['prefix2_'], array('path2/')); + $this->assertEquals($paths['prefix2_'], ['path2/']); $loader->clearPaths('prefix2'); } public function testAddsMultipleScrollingStylePrefixPaths() { - $paths = array('prefix3' => 'path3', + $paths = ['prefix3' => 'path3', 'prefix4' => 'path4', - 'prefix5' => 'path5'); + 'prefix5' => 'path5']; Zend_Paginator::addScrollingStylePrefixPaths($paths); $loader = Zend_Paginator::getScrollingStyleLoader(); @@ -314,7 +314,7 @@ public function testAddsMultipleScrollingStylePrefixPaths() for ($i = 3; $i <= 5; $i++) { $prefix = 'prefix' . $i . '_'; $this->assertArrayHasKey($prefix, $paths); - $this->assertEquals($paths[$prefix], array('path' . $i . '/')); + $this->assertEquals($paths[$prefix], ['path' . $i . '/']); } $loader->clearPaths('prefix3'); @@ -329,29 +329,29 @@ public function testAddsSingleAdapterPrefixPath() $paths = $loader->getPaths(); $this->assertArrayHasKey('prefix1_', $paths); - $this->assertEquals($paths['prefix1_'], array('path1/')); + $this->assertEquals($paths['prefix1_'], ['path1/']); $loader->clearPaths('prefix1'); } public function testAddsSingleAdapterPrefixPathWithArray() { - Zend_Paginator::addAdapterPrefixPaths(array('prefix' => 'prefix2', - 'path' => 'path2')); + Zend_Paginator::addAdapterPrefixPaths(['prefix' => 'prefix2', + 'path' => 'path2']); $loader = Zend_Paginator::getAdapterLoader(); $paths = $loader->getPaths(); $this->assertArrayHasKey('prefix2_', $paths); - $this->assertEquals($paths['prefix2_'], array('path2/')); + $this->assertEquals($paths['prefix2_'], ['path2/']); $loader->clearPaths('prefix2'); } public function testAddsMultipleAdapterPrefixPaths() { - $paths = array('prefix3' => 'path3', + $paths = ['prefix3' => 'path3', 'prefix4' => 'path4', - 'prefix5' => 'path5'); + 'prefix5' => 'path5']; Zend_Paginator::addAdapterPrefixPaths($paths); $loader = Zend_Paginator::getAdapterLoader(); @@ -360,7 +360,7 @@ public function testAddsMultipleAdapterPrefixPaths() for ($i = 3; $i <= 5; $i++) { $prefix = 'prefix' . $i . '_'; $this->assertArrayHasKey($prefix, $paths); - $this->assertEquals($paths[$prefix], array('path' . $i . '/')); + $this->assertEquals($paths[$prefix], ['path' . $i . '/']); } $loader->clearPaths('prefix3'); @@ -390,14 +390,14 @@ public function testHasCorrectCountOfAllItemsAfterInit() public function testAddCustomAdapterPathsInConstructor() { - $paginator = Zend_Paginator::factory(range(1, 101), Zend_Paginator::INTERNAL_ADAPTER, array('My_Paginator_Adapter' => 'My/Paginator/Adapter')); + $paginator = Zend_Paginator::factory(range(1, 101), Zend_Paginator::INTERNAL_ADAPTER, ['My_Paginator_Adapter' => 'My/Paginator/Adapter']); $loader = Zend_Paginator::getAdapterLoader(); $paths = $loader->getPaths(); $this->assertEquals(2, count($paths)); - $this->assertEquals(array('Zend_Paginator_Adapter_' => array('Zend/Paginator/Adapter/'), - 'My_Paginator_Adapter_' => array('My/Paginator/Adapter/')), $paths); + $this->assertEquals(['Zend_Paginator_Adapter_' => ['Zend/Paginator/Adapter/'], + 'My_Paginator_Adapter_' => ['My/Paginator/Adapter/']], $paths); $loader->clearPaths('My_Paginator_Adapter'); } @@ -407,11 +407,11 @@ public function testLoadsFromConfig() Zend_Paginator::setConfig($this->_config->testing); $this->assertEquals('Scrolling', Zend_Paginator::getDefaultScrollingStyle()); - $paths = array( + $paths = [ 'prefix6' => 'path6', 'prefix7' => 'path7', 'prefix8' => 'path8' - ); + ]; $loader = Zend_Paginator::getScrollingStyleLoader(); $paths = $loader->getPaths(); @@ -419,7 +419,7 @@ public function testLoadsFromConfig() for ($i = 6; $i <= 8; $i++) { $prefix = 'prefix' . $i . '_'; $this->assertArrayHasKey($prefix, $paths); - $this->assertEquals($paths[$prefix], array('path' . $i . '/')); + $this->assertEquals($paths[$prefix], ['path' . $i . '/']); } $loader->clearPaths('prefix6'); @@ -432,7 +432,7 @@ public function testLoadsFromConfig() for ($i = 6; $i <= 8; $i++) { $prefix = 'prefix' . $i . '_'; $this->assertArrayHasKey($prefix, $paths); - $this->assertEquals($paths[$prefix], array('path' . $i . '/')); + $this->assertEquals($paths[$prefix], ['path' . $i . '/']); } $loader->clearPaths('prefix6'); @@ -518,7 +518,7 @@ public function testGetsPageCount() public function testGetsAndSetsItemCountPerPage() { - Zend_Paginator::setConfig(new Zend_Config(array())); + Zend_Paginator::setConfig(new Zend_Config([])); $this->_paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array(range(1, 101))); $this->assertEquals(10, $this->_paginator->getItemCountPerPage()); $this->_paginator->setItemCountPerPage(15); @@ -531,7 +531,7 @@ public function testGetsAndSetsItemCountPerPage() */ public function testGetsAndSetsItemCounterPerPageOfNegativeOne() { - Zend_Paginator::setConfig(new Zend_Config(array())); + Zend_Paginator::setConfig(new Zend_Config([])); $this->_paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array(range(1, 101))); $this->_paginator->setItemCountPerPage(-1); $this->assertEquals(101, $this->_paginator->getItemCountPerPage()); @@ -543,7 +543,7 @@ public function testGetsAndSetsItemCounterPerPageOfNegativeOne() */ public function testGetsAndSetsItemCounterPerPageOfZero() { - Zend_Paginator::setConfig(new Zend_Config(array())); + Zend_Paginator::setConfig(new Zend_Config([])); $this->_paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array(range(1, 101))); $this->_paginator->setItemCountPerPage(0); $this->assertEquals(101, $this->_paginator->getItemCountPerPage()); @@ -555,7 +555,7 @@ public function testGetsAndSetsItemCounterPerPageOfZero() */ public function testGetsAndSetsItemCounterPerPageOfNull() { - Zend_Paginator::setConfig(new Zend_Config(array())); + Zend_Paginator::setConfig(new Zend_Config([])); $this->_paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array(range(1, 101))); $this->_paginator->setItemCountPerPage(); $this->assertEquals(101, $this->_paginator->getItemCountPerPage()); @@ -633,7 +633,7 @@ public function testGetsItem() public function testThrowsExceptionWhenCollectionIsEmpty() { - $paginator = Zend_Paginator::factory(array()); + $paginator = Zend_Paginator::factory([]); try { $paginator->getItem(1); @@ -787,7 +787,7 @@ public function testGivesCorrectItemCount() */ public function testKeepsCurrentPageNumberAfterItemCountPerPageSet() { - $paginator = Zend_Paginator::factory(array('item1', 'item2')); + $paginator = Zend_Paginator::factory(['item1', 'item2']); $paginator->setCurrentPageNumber(2) ->setItemCountPerPage(1); @@ -830,11 +830,11 @@ public function testCachedItem() $this->_paginator->setCurrentPageNumber(3)->getCurrentItems(); $pageItems = $this->_paginator->getPageItemCache(); - $expected = array( + $expected = [ 1 => new ArrayIterator(range(1, 10)), 2 => new ArrayIterator(range(11, 20)), 3 => new ArrayIterator(range(21, 30)) - ); + ]; $this->assertEquals($expected, $pageItems); } @@ -847,16 +847,16 @@ public function testClearPageItemCache() // clear only page 2 items $this->_paginator->clearPageItemCache(2); $pageItems = $this->_paginator->getPageItemCache(); - $expected = array( + $expected = [ 1 => new ArrayIterator(range(1, 10)), 3 => new ArrayIterator(range(21, 30)) - ); + ]; $this->assertEquals($expected, $pageItems); // clear all $this->_paginator->clearPageItemCache(); $pageItems = $this->_paginator->getPageItemCache(); - $this->assertEquals(array(), $pageItems); + $this->assertEquals([], $pageItems); } public function testWithCacheDisabled() @@ -867,7 +867,7 @@ public function testWithCacheDisabled() $cachedPageItems = $this->_paginator->getPageItemCache(); $expected = new ArrayIterator(range(1, 10)); - $this->assertEquals(array(), $cachedPageItems); + $this->assertEquals([], $cachedPageItems); $pageItems = $this->_paginator->getCurrentItems(); @@ -890,14 +890,14 @@ public function testCacheDoesNotDisturbResultsWhenChangingParam() $pageItems = $this->_paginator->setItemCountPerPage(8)->setCurrentPageNumber(3)->getCurrentItems(); $pageItems = $this->_paginator->getPageItemCache(); - $expected = array(3 => new ArrayIterator(range(17, 24))); + $expected = [3 => new ArrayIterator(range(17, 24))]; $this->assertEquals($expected, $pageItems); // get back to already cached data $this->_paginator->setItemCountPerPage(5); $pageItems = $this->_paginator->getPageItemCache(); - $expected =array(1 => new ArrayIterator(range(1, 5)), - 2 => new ArrayIterator(range(6, 10))); + $expected =[1 => new ArrayIterator(range(1, 5)), + 2 => new ArrayIterator(range(6, 10))]; $this->assertEquals($expected, $pageItems); } @@ -915,7 +915,7 @@ public function testToJson() // ZF-5519 public function testFilter() { - $filter = new Zend_Filter_Callback(array($this, 'filterCallback')); + $filter = new Zend_Filter_Callback([$this, 'filterCallback']); $paginator = Zend_Paginator::factory(range(1, 10)); $paginator->setFilter($filter); @@ -926,7 +926,7 @@ public function testFilter() public function filterCallback($value) { - $data = array(); + $data = []; foreach ($value as $number) { $data[] = ($number * 10); @@ -940,7 +940,7 @@ public function filterCallback($value) */ public function testGetSetDefaultItemCountPerPage() { - Zend_Paginator::setConfig(new Zend_Config(array())); + Zend_Paginator::setConfig(new Zend_Config([])); $paginator = Zend_Paginator::factory(range(1, 10)); $this->assertEquals(10, $paginator->getItemCountPerPage()); @@ -1004,7 +1004,7 @@ public function testInvalidDataInConstructor_ThrowsException() { $this->setExpectedException("Zend_Paginator_Exception"); - $p = new Zend_Paginator(array()); + $p = new Zend_Paginator([]); } /** @@ -1012,7 +1012,7 @@ public function testInvalidDataInConstructor_ThrowsException() */ public function testArrayAccessInClassSerializableLimitIterator() { - $iterator = new ArrayIterator(array('zf9396', 'foo', null)); + $iterator = new ArrayIterator(['zf9396', 'foo', null]); $paginator = Zend_Paginator::factory($iterator); $this->assertEquals('zf9396', $paginator->getItem(1)); @@ -1033,7 +1033,7 @@ public function testArrayAccessInClassSerializableLimitIterator() */ public function testSetDefaultPageRange() { - Zend_Paginator::setConfig(new Zend_Config(array())); + Zend_Paginator::setConfig(new Zend_Config([])); $paginator = Zend_Paginator::factory(range(1, 10)); $this->assertEquals(10, $paginator->getPageRange()); @@ -1052,7 +1052,7 @@ public function testSetDefaultPageRange() */ public function testCurrentItemCountIsRetrievedFromCacheIfCachingIsEnabled() { - $dbAdapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', array(''), '', false); + $dbAdapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [''], '', false); $select = new Zend_Db_Select($dbAdapter); $select->from('ZF_6989'); @@ -1062,7 +1062,7 @@ public function testCurrentItemCountIsRetrievedFromCacheIfCachingIsEnabled() $paginator = new Zend_Paginator_TestCache($paginatorAdapter); $expectedCacheId = md5($paginator->getCacheInternalId() . '_itemCount'); - $cache = $this->getMock('Zend_Cache_Core', array('load'), array(), '', false); + $cache = $this->getMock('Zend_Cache_Core', ['load'], [], '', false); $cache->expects($this->once()) ->method('load') ->with($expectedCacheId) @@ -1079,7 +1079,7 @@ public function testCurrentItemCountIsRetrievedFromCacheIfCachingIsEnabled() */ public function testPaginatorGeneratesSameCacheIdentifierForDbSelectAdaptersWithIdenticalSqlStatements() { - $dbAdapterOne = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', array(''), + $dbAdapterOne = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [''], __FUNCTION__ . 'DbAdapterOne', false); $selectOne = new Zend_Db_Select($dbAdapterOne); $selectOne->from('ZF_6989'); @@ -1089,7 +1089,7 @@ public function testPaginatorGeneratesSameCacheIdentifierForDbSelectAdaptersWith $paginatorOne = new Zend_Paginator_TestCache($paginatorAdapterOne); - $dbAdapterTwo = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', array(''), + $dbAdapterTwo = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [''], __FUNCTION__ . 'DbAdapterTwo', false); $selectTwo = new Zend_Db_Select($dbAdapterTwo); $selectTwo->from('ZF_6989'); @@ -1108,7 +1108,7 @@ public function testPaginatorGeneratesSameCacheIdentifierForDbSelectAdaptersWith */ public function testPaginatorGeneratesSameCacheIdentifierForDbTableSelectAdaptersWithIdenticalSqlStatements() { - $dbAdapterOne = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', array(''), + $dbAdapterOne = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [''], __FUNCTION__ . 'DbAdapterOne', false); $selectOne = new Zend_Db_Select($dbAdapterOne); $selectOne->from('ZF_6989'); @@ -1118,7 +1118,7 @@ public function testPaginatorGeneratesSameCacheIdentifierForDbTableSelectAdapter $paginatorOne = new Zend_Paginator_TestCache($paginatorAdapterOne); - $dbAdapterTwo = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', array(''), + $dbAdapterTwo = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', [''], __FUNCTION__ . 'DbAdapterTwo', false); $selectTwo = new Zend_Db_Select($dbAdapterTwo); $selectTwo->from('ZF_6989'); @@ -1137,7 +1137,7 @@ class Zend_Paginator_TestArrayAggregate implements Zend_Paginator_AdapterAggrega { public function getPaginatorAdapter() { - return new Zend_Paginator_Adapter_Array(array(1, 2, 3, 4)); + return new Zend_Paginator_Adapter_Array([1, 2, 3, 4]); } } diff --git a/tests/Zend/Pdf/ActionTest.php b/tests/Zend/Pdf/ActionTest.php index 443e18985d..0d8322e9e5 100644 --- a/tests/Zend/Pdf/ActionTest.php +++ b/tests/Zend/Pdf/ActionTest.php @@ -170,7 +170,7 @@ public function testLoad() $action = Zend_Pdf_Action::load($dictionary); $actionsCount = 0; - $iterator = new RecursiveIteratorIterator(new Zend_Pdf_RecursivelyIteratableObjectsContainer(array($action)), + $iterator = new RecursiveIteratorIterator(new Zend_Pdf_RecursivelyIteratableObjectsContainer([$action]), RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $chainedAction) { $actionsCount++; @@ -290,8 +290,8 @@ public function testExtract() $action = Zend_Pdf_Action::load($dictionary); - $actionsToClean = array(); - $deletionCandidateKeys = array(); + $actionsToClean = []; + $deletionCandidateKeys = []; $iterator = new RecursiveIteratorIterator($action, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $chainedAction) { if ($chainedAction instanceof Zend_Pdf_Action_GoTo) { @@ -303,7 +303,7 @@ public function testExtract() unset($action->next[$deletionCandidateKeys[$id]]); } $actionsCount = 0; - $iterator = new RecursiveIteratorIterator(new Zend_Pdf_RecursivelyIteratableObjectsContainer(array($action)), + $iterator = new RecursiveIteratorIterator(new Zend_Pdf_RecursivelyIteratableObjectsContainer([$action]), RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $chainedAction) { $actionsCount++; diff --git a/tests/Zend/Pdf/DrawingTest.php b/tests/Zend/Pdf/DrawingTest.php index b469a1e44d..3b247ee24d 100644 --- a/tests/Zend/Pdf/DrawingTest.php +++ b/tests/Zend/Pdf/DrawingTest.php @@ -92,7 +92,7 @@ public function testDrawing() // Draw rectangle $page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8)) ->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)) - ->setLineDashingPattern(array(3, 2, 3, 4), 1.6) + ->setLineDashingPattern([3, 2, 3, 4], 1.6) ->drawRectangle(60, 400, 500, 350); // Draw rounded rectangle @@ -123,8 +123,8 @@ public function testDrawing() // Draw and fill polygon $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1)); - $x = array(); - $y = array(); + $x = []; + $y = []; for ($count = 0; $count < 8; $count++) { $x[] = 140 + 25*cos(3*M_PI_4*$count); $y[] = 375 + 25*sin(3*M_PI_4*$count); @@ -154,7 +154,7 @@ public function testDrawing() // Draw rectangle $page3->setFillColor(new Zend_Pdf_Color_GrayScale(0.8)) ->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)) - ->setLineDashingPattern(array(3, 2, 3, 4), 1.6) + ->setLineDashingPattern([3, 2, 3, 4], 1.6) ->drawRectangle(60, 400, 500, 350); // Draw rounded rectangle @@ -186,8 +186,8 @@ public function testDrawing() // Draw and fill polygon $page3->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1)); - $x = array(); - $y = array(); + $x = []; + $y = []; for ($count = 0; $count < 8; $count++) { $x[] = 140 + 25*cos(3*M_PI_4*$count); $y[] = 375 + 25*sin(3*M_PI_4*$count); @@ -280,7 +280,7 @@ public function testFontDrawing() $pdf = new Zend_Pdf(); - $fontsList = array(Zend_Pdf_Font::FONT_COURIER, + $fontsList = [Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_COURIER_BOLD, Zend_Pdf_Font::FONT_COURIER_BOLD_ITALIC, Zend_Pdf_Font::FONT_COURIER_BOLD_OBLIQUE, @@ -296,7 +296,7 @@ public function testFontDrawing() Zend_Pdf_Font::FONT_TIMES_BOLD, Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC, Zend_Pdf_Font::FONT_TIMES_ITALIC, - Zend_Pdf_Font::FONT_TIMES_ROMAN); + Zend_Pdf_Font::FONT_TIMES_ROMAN]; $titleFont = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_COURIER_BOLD_OBLIQUE); @@ -349,10 +349,10 @@ public function testFontDrawing() } $nonAlphabeticalPhonts = - array(Zend_Pdf_Font::FONT_SYMBOL => + [Zend_Pdf_Font::FONT_SYMBOL => "\x00\x20\x00\x21\x22\x00\x00\x23\x22\x03\x00\x25\x00\x26\x22\x0b\x00\x28\x00\x29\x22\x17\x00\x2b\x00\x2c\x22\x12\x00\x2e\x00\x2f\x00\x30\x00\x31\x00\x32\x00\x33\x00\x34\x00\x35\x00\x36\x00\x37\x00\x38\x00\x39\x00\x3a\x00\x3b\x00\x3c\x00\x3d\x00\x3e\x00\x3f\x22\x45\x03\x91\x03\x92\x03\xa7\x22\x06\x03\x95\x03\xa6", Zend_Pdf_Font::FONT_ZAPFDINGBATS => - "\x00\x20\x27\x01\x27\x02\x27\x03\x27\x04\x26\x0e\x27\x06\x27\x07\x27\x08\x27\x09\x26\x1b\x26\x1e\x27\x0c\x27\x0d\x27\x0e\x27\x0f\x27\x10\x27\x11\x27\x12\x27\x13\x27\x14\x27\x15\x27\x16\x27\x17\x27\x18\x27\x19\x27\x1a"); + "\x00\x20\x27\x01\x27\x02\x27\x03\x27\x04\x26\x0e\x27\x06\x27\x07\x27\x08\x27\x09\x26\x1b\x26\x1e\x27\x0c\x27\x0d\x27\x0e\x27\x0f\x27\x10\x27\x11\x27\x12\x27\x13\x27\x14\x27\x15\x27\x16\x27\x17\x27\x18\x27\x19\x27\x1a"]; foreach ($nonAlphabeticalPhonts as $fontName => $example) { // Add new page generated by Zend_Pdf object (page is attached to the specified the document) $pdf->pages[] = ($page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4_LANDSCAPE)); @@ -401,7 +401,7 @@ public function testFontDrawing() $font->widthForGlyph(10); } - $TTFFontsList = array('VeraBd.ttf', + $TTFFontsList = ['VeraBd.ttf', 'VeraBI.ttf', 'VeraIt.ttf', 'VeraMoBd.ttf', @@ -410,7 +410,7 @@ public function testFontDrawing() 'VeraMono.ttf', 'VeraSeBd.ttf', 'VeraSe.ttf', - 'Vera.ttf'); + 'Vera.ttf']; foreach ($TTFFontsList as $fontName) { // Add new page generated by Zend_Pdf object (page is attached to the specified the document) @@ -478,9 +478,9 @@ public function testFontExtracting() $pdf = new Zend_Pdf(); - $fontsList = array(Zend_Pdf_Font::FONT_COURIER, + $fontsList = [Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_HELVETICA_BOLD, - Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC); + Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC]; foreach ($fontsList as $fontName) { // Add new page generated by Zend_Pdf object (page is attached to the specified the document) @@ -495,7 +495,7 @@ public function testFontExtracting() $type = $font->getFontType(); } - $TTFFontsList = array('VeraBd.ttf', + $TTFFontsList = ['VeraBd.ttf', 'VeraBI.ttf', 'VeraIt.ttf', 'VeraMoBd.ttf', @@ -504,7 +504,7 @@ public function testFontExtracting() 'VeraMono.ttf', 'VeraSeBd.ttf', 'VeraSe.ttf', - 'Vera.ttf'); + 'Vera.ttf']; foreach ($TTFFontsList as $fontName) { // Add new page generated by Zend_Pdf object (page is attached to the specified the document) @@ -523,10 +523,10 @@ public function testFontExtracting() $pdf1 = Zend_Pdf::load(dirname(__FILE__) . '/_files/output.pdf'); - $newPages = array(); + $newPages = []; - $fontList = array(); - $fontNames = array(); + $fontList = []; + $fontNames = []; foreach ($pdf1->pages as $page) { $pageFonts = $page->extractFonts(); foreach ($pageFonts as $font) { @@ -535,7 +535,7 @@ public function testFontExtracting() } } - $this->assertEquals(array(Zend_Pdf_Font::FONT_COURIER, + $this->assertEquals([Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_HELVETICA_BOLD, Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC, 'BitstreamVeraSans-Bold', @@ -547,7 +547,7 @@ public function testFontExtracting() 'BitstreamVeraSansMono-Roman', 'BitstreamVeraSerif-Bold', 'BitstreamVeraSerif-Roman', - 'BitstreamVeraSans-Roman'), + 'BitstreamVeraSans-Roman'], $fontNames); $pdf1->pages[] = ($page = $pdf1->newPage(Zend_Pdf_Page::SIZE_A4)); @@ -558,11 +558,11 @@ public function testFontExtracting() $yPosition -= 30; } - $fontNames1 = array(); + $fontNames1 = []; foreach ($pdf1->extractFonts() as $font) { $fontNames1[] = $font->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en', 'UTF-8'); } - $this->assertEquals(array(Zend_Pdf_Font::FONT_COURIER, + $this->assertEquals([Zend_Pdf_Font::FONT_COURIER, Zend_Pdf_Font::FONT_HELVETICA_BOLD, Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC, 'BitstreamVeraSans-Bold', @@ -574,7 +574,7 @@ public function testFontExtracting() 'BitstreamVeraSansMono-Roman', 'BitstreamVeraSerif-Bold', 'BitstreamVeraSerif-Roman', - 'BitstreamVeraSans-Roman'), + 'BitstreamVeraSans-Roman'], $fontNames1); $page = reset($pdf1->pages); diff --git a/tests/Zend/Pdf/Element/ArrayTest.php b/tests/Zend/Pdf/Element/ArrayTest.php index 7558826868..89f535da26 100644 --- a/tests/Zend/Pdf/Element/ArrayTest.php +++ b/tests/Zend/Pdf/Element/ArrayTest.php @@ -68,7 +68,7 @@ public function testPDFArray1() public function testPDFArray2() { - $srcArray = array(); + $srcArray = []; $srcArray[] = new Zend_Pdf_Element_Boolean(false); $srcArray[] = new Zend_Pdf_Element_Numeric(100.426); $srcArray[] = new Zend_Pdf_Element_Name('MyName'); @@ -93,7 +93,7 @@ public function testPDFArrayBadInput1() public function testPDFArrayBadInput2() { try { - $srcArray = array(); + $srcArray = []; $srcArray[] = new Zend_Pdf_Element_Boolean(false); $srcArray[] = new Zend_Pdf_Element_Numeric(100.426); $srcArray[] = new Zend_Pdf_Element_Name('MyName'); @@ -116,7 +116,7 @@ public function testGetType() public function testToString() { - $srcArray = array(); + $srcArray = []; $srcArray[] = new Zend_Pdf_Element_Boolean(false); $srcArray[] = new Zend_Pdf_Element_Numeric(100.426); $srcArray[] = new Zend_Pdf_Element_Name('MyName'); diff --git a/tests/Zend/Pdf/Element/DictionaryTest.php b/tests/Zend/Pdf/Element/DictionaryTest.php index 9102ea5e2b..29e0fc6748 100644 --- a/tests/Zend/Pdf/Element/DictionaryTest.php +++ b/tests/Zend/Pdf/Element/DictionaryTest.php @@ -43,7 +43,7 @@ public function testPDFDictionary1() public function testPDFDictionary2() { - $srcArray = array(); + $srcArray = []; $srcArray['Bool'] = new Zend_Pdf_Element_Boolean(false); $srcArray['Number'] = new Zend_Pdf_Element_Numeric(100.426); $srcArray['Name'] = new Zend_Pdf_Element_Name('MyName'); @@ -68,7 +68,7 @@ public function testPDFDictionaryBadInput1() public function testPDFDictionaryBadInput2() { try { - $srcArray = array(); + $srcArray = []; $srcArray['Bool'] = new Zend_Pdf_Element_Boolean(false); $srcArray['Number'] = new Zend_Pdf_Element_Numeric(100.426); $srcArray['Name'] = new Zend_Pdf_Element_Name('MyName'); @@ -86,7 +86,7 @@ public function testPDFDictionaryBadInput2() public function testPDFDictionaryBadInput3() { try { - $srcArray = array(); + $srcArray = []; $srcArray['Bool'] = new Zend_Pdf_Element_Boolean(false); $srcArray['Number'] = new Zend_Pdf_Element_Numeric(100.426); $srcArray['Name'] = new Zend_Pdf_Element_Name('MyName'); @@ -109,7 +109,7 @@ public function testGetType() public function testToString() { - $srcArray = array(); + $srcArray = []; $srcArray['Bool'] = new Zend_Pdf_Element_Boolean(false); $srcArray['Number'] = new Zend_Pdf_Element_Numeric(100.426); $srcArray['Name'] = new Zend_Pdf_Element_Name('MyName'); diff --git a/tests/Zend/Pdf/Element/StringTest.php b/tests/Zend/Pdf/Element/StringTest.php index 299c89f249..d978244513 100644 --- a/tests/Zend/Pdf/Element/StringTest.php +++ b/tests/Zend/Pdf/Element/StringTest.php @@ -69,11 +69,11 @@ public function testUnescape() */ public function testUnescapeOctal() { - $input = array( + $input = [ 0304 => '\\304', 0326 => '\\326', 0334 => '\\334' - ); + ]; foreach ($input as $k => $v) { $this->assertEquals(Zend_Pdf_Element_String::unescape($v), chr($k), 'expected German Umlaut'); diff --git a/tests/Zend/Pdf/ProcessingTest.php b/tests/Zend/Pdf/ProcessingTest.php index 260b062eaf..2979c4c9ea 100644 --- a/tests/Zend/Pdf/ProcessingTest.php +++ b/tests/Zend/Pdf/ProcessingTest.php @@ -67,7 +67,7 @@ public function testCreate() // Draw rectangle $page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8)) ->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)) - ->setLineDashingPattern(array(3, 2, 3, 4), 1.6) + ->setLineDashingPattern([3, 2, 3, 4], 1.6) ->drawRectangle(60, 400, 500, 350); // Draw rounded rectangle @@ -98,8 +98,8 @@ public function testCreate() // Draw and fill polygon $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1)); - $x = array(); - $y = array(); + $x = []; + $y = []; for ($count = 0; $count < 8; $count++) { $x[] = 140 + 25*cos(3*M_PI_4*$count); $y[] = 375 + 25*sin(3*M_PI_4*$count); @@ -138,7 +138,7 @@ public function testModify() $page->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0.9)) ->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)) ->setLineWidth(3) - ->setLineDashingPattern(array(3, 2, 3, 4), 1.6) + ->setLineDashingPattern([3, 2, 3, 4], 1.6) ->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 32); @@ -173,7 +173,7 @@ public function testModify() // Draw rectangle $page2->setFillColor(new Zend_Pdf_Color_GrayScale(0.8)) ->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)) - ->setLineDashingPattern(array(3, 2, 3, 4), 1.6) + ->setLineDashingPattern([3, 2, 3, 4], 1.6) ->drawRectangle(60, 400, 500, 350); // Draw rounded rectangle @@ -204,8 +204,8 @@ public function testModify() // Draw and fill polygon $page2->setFillColor(new Zend_Pdf_Color_Rgb(1, 0, 1)); - $x = array(); - $y = array(); + $x = []; + $y = []; for ($count = 0; $count < 8; $count++) { $x[] = 140 + 25*cos(3*M_PI_4*$count); $y[] = 375 + 25*sin(3*M_PI_4*$count); @@ -297,7 +297,7 @@ public function testPageCloning() // Exception is thrown } - $outputPageSet = array(); + $outputPageSet = []; foreach ($pdf->pages as $srcPage){ $page = new Zend_Pdf_Page($srcPage); @@ -310,7 +310,7 @@ public function testPageCloning() $page->setFillColor(new Zend_Pdf_Color_Rgb(0, 0, 0.9)) ->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)) ->setLineWidth(3) - ->setLineDashingPattern(array(3, 2, 3, 4), 1.6) + ->setLineDashingPattern([3, 2, 3, 4], 1.6) ->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 32); @@ -344,8 +344,8 @@ public function testZendPdfIsExtendableWithAccessToProperties() $pdf = new ExtendedZendPdf(); // Test accessing protected variables and their default content - $this->assertEquals(array(), $pdf->_originalProperties); - $this->assertEquals(array(), $pdf->_namedTargets); + $this->assertEquals([], $pdf->_originalProperties); + $this->assertEquals([], $pdf->_namedTargets); $pdfpage = new ExtendedZendPdfPage(Zend_Pdf_Page::SIZE_A4); // Test accessing protected variables and their default content diff --git a/tests/Zend/PdfTest.php b/tests/Zend/PdfTest.php index 5df3051fb8..7283a0ae22 100644 --- a/tests/Zend/PdfTest.php +++ b/tests/Zend/PdfTest.php @@ -55,7 +55,7 @@ protected function setUp() public function testGetTextFieldNames() { $fieldNames = $this->_pdf->getTextFieldNames(); - $this->assertEquals(array('Field1', 'Field2'), $fieldNames); + $this->assertEquals(['Field1', 'Field2'], $fieldNames); } /** @@ -65,7 +65,7 @@ public function testGetTextFieldNamesNoFieldsEmptyArray() { $pdf = new Zend_Pdf(); $fieldNames = $pdf->getTextFieldNames(); - $this->assertEquals(array(), $fieldNames); + $this->assertEquals([], $fieldNames); } public function testSetTextField() @@ -179,7 +179,7 @@ public function testSetJavaScriptArray() { // setting string value is possible $pdf = new Zend_Pdf(); - $javaScriptArray = array('print();', 'alert();'); + $javaScriptArray = ['print();', 'alert();']; $pdf->setJavaScript($javaScriptArray); $this->assertEquals($javaScriptArray, $pdf->getJavaScript()); } @@ -197,7 +197,7 @@ public function testAddJavaScript() { // adding JavaScript appends previously added JavaScript $pdf = new Zend_Pdf(); - $javaScriptArray = array('print();', 'alert();'); + $javaScriptArray = ['print();', 'alert();']; $pdf->addJavaScript($javaScriptArray[0]); $pdf->addJavaScript($javaScriptArray[1]); $this->assertEquals($javaScriptArray, $pdf->getJavaScript()); @@ -226,13 +226,13 @@ public function testSetJavaScriptEmptyString() public function testSetJavaScriptEmptyArray() { $pdf = new Zend_Pdf(); - $pdf->setJavaScript(array()); + $pdf->setJavaScript([]); } public function testSetAndSaveLoadAndGetJavaScript() { $tempFile = tempnam(sys_get_temp_dir(), 'PdfUnitFile'); - $javaScript = array('print();', 'alert();'); + $javaScript = ['print();', 'alert();']; $pdf = new Zend_Pdf(); $pdf->setJavaScript($javaScript); @@ -248,7 +248,7 @@ public function testSetAndSaveLoadAndGetJavaScript() public function testSetAndSaveLoadAndResetAndSaveLoadAndGetJavaScript() { $tempFile = tempnam(sys_get_temp_dir(), 'PdfUnitFile'); - $javaScript = array('print();', 'alert();'); + $javaScript = ['print();', 'alert();']; $pdf = new Zend_Pdf(); $pdf->setJavaScript($javaScript); diff --git a/tests/Zend/ProgressBar/Adapter/ConsoleTest.php b/tests/Zend/ProgressBar/Adapter/ConsoleTest.php index 67633fd062..d9429d7820 100644 --- a/tests/Zend/ProgressBar/Adapter/ConsoleTest.php +++ b/tests/Zend/ProgressBar/Adapter/ConsoleTest.php @@ -87,7 +87,7 @@ public function testStandardOutputStream() public function testManualStandardOutputStream() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('outputStream' => 'php://stdout')); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['outputStream' => 'php://stdout']); $this->assertTrue(is_resource($adapter->getOutputStream())); @@ -97,7 +97,7 @@ public function testManualStandardOutputStream() public function testManualErrorOutputStream() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('outputStream' => 'php://stderr')); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['outputStream' => 'php://stderr']); $this->assertTrue(is_resource($adapter->getOutputStream())); @@ -107,7 +107,7 @@ public function testManualErrorOutputStream() public function testFixedWidth() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 30)); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 30]); $adapter->notify(0, 100, 0, 0, null, null); $this->assertEquals(' 0% [----------] ', $adapter->getLastOutput()); @@ -116,7 +116,7 @@ public function testFixedWidth() public function testInvalidElement() { try { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 30, 'elements' => array('foo'))); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 30, 'elements' => ['foo']]); $adapter->notify(0, 100, 0, 0, null, null); $this->fail('An expected Zend_ProgressBar_Adapter_Exception has not been raised'); @@ -127,7 +127,7 @@ public function testInvalidElement() public function testCariageReturn() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 30)); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 30]); $adapter->notify(0, 100, 0, 0, null, null); $adapter->notify(0, 100, 0, 0, null, null); @@ -136,7 +136,7 @@ public function testCariageReturn() public function testBarLayout() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 30)); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 30]); $adapter->notify(50, 100, .5, 0, null, null); $this->assertContains(' 50% [#####-----]', $adapter->getLastOutput()); @@ -144,7 +144,7 @@ public function testBarLayout() public function testBarOnly() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 20, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_BAR))); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 20, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_BAR]]); $adapter->notify(0, 100, 0, 0, null, null); $this->assertEquals('[------------------]', $adapter->getLastOutput()); @@ -152,7 +152,7 @@ public function testBarOnly() public function testPercentageOnly() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 20, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT))); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 20, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT]]); $adapter->notify(0, 100, 0, 0, null, null); $this->assertEquals(' 0%', $adapter->getLastOutput()); @@ -160,7 +160,7 @@ public function testPercentageOnly() public function testEtaOnly() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 20, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_ETA))); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 20, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_ETA]]); $adapter->notify(0, 100, 0, 0, null, null); $this->assertEquals(' ', $adapter->getLastOutput()); @@ -168,9 +168,9 @@ public function testEtaOnly() public function testCustomOrder() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 25, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_ETA, + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 25, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_ETA, Zend_ProgressBar_Adapter_Console::ELEMENT_PERCENT, - Zend_ProgressBar_Adapter_Console::ELEMENT_BAR))); + Zend_ProgressBar_Adapter_Console::ELEMENT_BAR]]); $adapter->notify(0, 100, 0, 0, null, null); $this->assertEquals(' 0% [-----]', $adapter->getLastOutput()); @@ -178,7 +178,7 @@ public function testCustomOrder() public function testBarStyleIndicator() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 20, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_BAR), 'barIndicatorChar' => '>')); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 20, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_BAR], 'barIndicatorChar' => '>']); $adapter->notify(10, 100, .1, 0, null, null); $this->assertContains('[##>---------------]', $adapter->getLastOutput()); @@ -186,7 +186,7 @@ public function testBarStyleIndicator() public function testBarStyleIndicatorWide() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 20, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_BAR), 'barIndicatorChar' => '[]')); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 20, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_BAR], 'barIndicatorChar' => '[]']); $adapter->notify(10, 100, .1, 0, null, null); $this->assertContains('[##[]--------------]', $adapter->getLastOutput()); @@ -194,7 +194,7 @@ public function testBarStyleIndicatorWide() public function testBarStyleLeftRightNormal() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 20, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_BAR), 'barLeftChar' => '+', 'barRightChar' => ' ')); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 20, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_BAR], 'barLeftChar' => '+', 'barRightChar' => ' ']); $adapter->notify(10, 100, .1, 0, null, null); $this->assertContains('[++ ]', $adapter->getLastOutput()); @@ -202,7 +202,7 @@ public function testBarStyleLeftRightNormal() public function testBarStyleLeftRightWide() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 20, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_BAR), 'barLeftChar' => '+-', 'barRightChar' => '=-')); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 20, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_BAR], 'barLeftChar' => '+-', 'barRightChar' => '=-']); $adapter->notify(10, 100, .1, 0, null, null); $this->assertContains('[+-=-=-=-=-=-=-=-=-]', $adapter->getLastOutput()); @@ -210,7 +210,7 @@ public function testBarStyleLeftRightWide() public function testBarStyleLeftIndicatorRightWide() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 20, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_BAR), 'barLeftChar' => '+-', 'barIndicatorChar' => '[]', 'barRightChar' => '=-')); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 20, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_BAR], 'barLeftChar' => '+-', 'barIndicatorChar' => '[]', 'barRightChar' => '=-']); $adapter->notify(10, 100, .1, 0, null, null); $this->assertContains('[+-[]=-=-=-=-=-=-=-]', $adapter->getLastOutput()); @@ -218,7 +218,7 @@ public function testBarStyleLeftIndicatorRightWide() public function testEtaDelayDisplay() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 100, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_ETA))); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 100, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_ETA]]); $adapter->notify(33, 100, .33, 3, null, null); $this->assertContains(' ', $adapter->getLastOutput()); @@ -231,7 +231,7 @@ public function testEtaDelayDisplay() public function testEtaHighValue() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 100, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_ETA))); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 100, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_ETA]]); $adapter->notify(1, 100005, .001, 5, 100000, null); @@ -240,7 +240,7 @@ public function testEtaHighValue() public function testTextElementDefaultLength() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 100, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR))); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 100, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR]]); $adapter->notify(0, 100, 0, 0, null, 'foobar'); $this->assertContains('foobar [', $adapter->getLastOutput()); @@ -248,7 +248,7 @@ public function testTextElementDefaultLength() public function testTextElementCustomLength() { - $adapter = new Zend_ProgressBar_Adapter_Console_Stub(array('width' => 100, 'elements' => array(Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR), 'textWidth' => 10)); + $adapter = new Zend_ProgressBar_Adapter_Console_Stub(['width' => 100, 'elements' => [Zend_ProgressBar_Adapter_Console::ELEMENT_TEXT, Zend_ProgressBar_Adapter_Console::ELEMENT_BAR], 'textWidth' => 10]); $adapter->notify(0, 100, 0, 0, null, 'foobar'); $this->assertContains('foobar [', $adapter->getLastOutput()); diff --git a/tests/Zend/ProgressBar/Adapter/JsPushTest.php b/tests/Zend/ProgressBar/Adapter/JsPushTest.php index 98a31a5616..8efc8d85be 100644 --- a/tests/Zend/ProgressBar/Adapter/JsPushTest.php +++ b/tests/Zend/ProgressBar/Adapter/JsPushTest.php @@ -53,9 +53,9 @@ public static function main() public function testJson() { - $result = array(); + $result = []; - $adapter = new Zend_ProgressBar_Adapter_jsPush_Stub(array('finishMethodName' => 'Zend_ProgressBar_Finish')); + $adapter = new Zend_ProgressBar_Adapter_jsPush_Stub(['finishMethodName' => 'Zend_ProgressBar_Finish']); $adapter->notify(0, 2, 0.5, 1, 1, 'status'); $output = $adapter->getLastOutput(); diff --git a/tests/Zend/ProgressBar/Adapter/MockupStream.php b/tests/Zend/ProgressBar/Adapter/MockupStream.php index fc8c9e6aac..8383b7af52 100644 --- a/tests/Zend/ProgressBar/Adapter/MockupStream.php +++ b/tests/Zend/ProgressBar/Adapter/MockupStream.php @@ -33,7 +33,7 @@ class Zend_ProgressBar_Adapter_Console_MockupStream { private $test; - public static $tests = array(); + public static $tests = []; function stream_open($path, $mode, $options, &$opened_path) { diff --git a/tests/Zend/Queue/Adapter/ActivemqOfflineTest.php b/tests/Zend/Queue/Adapter/ActivemqOfflineTest.php index 7db5ba7f15..023bf0731e 100644 --- a/tests/Zend/Queue/Adapter/ActivemqOfflineTest.php +++ b/tests/Zend/Queue/Adapter/ActivemqOfflineTest.php @@ -43,7 +43,7 @@ public function testSubscribesOncePerQueue() $options['driverOptions']['stompClient'] = $stompClient; $adapter = new Zend_Queue_Adapter_Activemq($options); - $queue = new Zend_Queue('array', array('name' => 'foo')); + $queue = new Zend_Queue('array', ['name' => 'foo']); $adapter->receive(null, null, $queue); $adapter->receive(null, null, $queue); @@ -61,8 +61,8 @@ public function testSubscribesOncePerQueue() class StompClientMock extends Zend_Queue_Stomp_Client { - public $frameStack = array(); - public $responseStack = array(); + public $frameStack = []; + public $responseStack = []; public function __construct() { // spoof a successful connection in the response stack diff --git a/tests/Zend/Queue/Adapter/ActivemqTest.php b/tests/Zend/Queue/Adapter/ActivemqTest.php index f6fa62d771..1aa8f9698f 100644 --- a/tests/Zend/Queue/Adapter/ActivemqTest.php +++ b/tests/Zend/Queue/Adapter/ActivemqTest.php @@ -67,7 +67,7 @@ public function getAdapterName() public function getTestConfig() { - $driverOptions = array(); + $driverOptions = []; if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_HOST')) { $driverOptions['host'] = TESTS_ZEND_QUEUE_ACTIVEMQ_HOST; } @@ -77,7 +77,7 @@ public function getTestConfig() if (defined('TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME')) { $driverOptions['scheme'] = TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME; } - return array('driverOptions' => $driverOptions); + return ['driverOptions' => $driverOptions]; } /** @@ -104,7 +104,7 @@ public function testConst() */ public function testReceiveWillRetrieveZeroItems() { - $options = array('driverOptions' => $this->getTestConfig()); + $options = ['driverOptions' => $this->getTestConfig()]; $queue = new Zend_Queue('Activemq', $options); $queue2 = $queue->createQueue('queue'); diff --git a/tests/Zend/Queue/Adapter/AdapterTest.php b/tests/Zend/Queue/Adapter/AdapterTest.php index 2cde6addbb..faf32f91b4 100644 --- a/tests/Zend/Queue/Adapter/AdapterTest.php +++ b/tests/Zend/Queue/Adapter/AdapterTest.php @@ -91,7 +91,7 @@ public function getAdapterFullName() public function getTestConfig() { - return array('driverOptions' => array()); + return ['driverOptions' => []]; } /** @@ -138,7 +138,7 @@ protected function createQueue($name, $config = null) Zend_Loader::loadClass($class); } - set_error_handler(array($this, 'handleErrors')); + set_error_handler([$this, 'handleErrors']); try { $queue = new Zend_Queue($this->getAdapterName(), $config); } catch (Zend_Queue_Exception $e) { @@ -209,27 +209,27 @@ public function testZendQueueAdapterConstructor() } try { - $obj = new $class( array()); + $obj = new $class( []); $this->fail('__construct() cannot accept an empty array for a configuration'); } catch (Exception $e) { $this->assertTrue(true); } try { - $obj = new $class(array('name' => 'queue1', 'driverOptions'=>true)); + $obj = new $class(['name' => 'queue1', 'driverOptions'=>true]); $this->fail('__construct() $config[\'options\'] must be an array'); } catch (Exception $e) { $this->assertTrue(true); } try { - $obj = new $class(array('name' => 'queue1', 'driverOptions'=>array('opt'=>'val'))); + $obj = new $class(['name' => 'queue1', 'driverOptions'=>['opt'=>'val']]); $this->fail('__construct() humm I think this test is supposed to work @TODO'); } catch (Exception $e) { $this->assertTrue(true); } try { - $config = new Zend_Config(array('driverOptions' => array() )); + $config = new Zend_Config(['driverOptions' => [] ]); $obj = new $class($config); $this->fail('__construct() \'name\' is a required configuration value'); } catch (Exception $e) { @@ -237,7 +237,7 @@ public function testZendQueueAdapterConstructor() } try { - $config = new Zend_Config(array('name' => 'queue1', 'driverOptions' => array(), 'options' => array('opt1' => 'val1'))); + $config = new Zend_Config(['name' => 'queue1', 'driverOptions' => [], 'options' => ['opt1' => 'val1']]); $obj = new $class($config); $this->fail('__construct() is not supposed to accept a true value for a configuraiton'); } catch (Exception $e) { @@ -484,7 +484,7 @@ public function testDeleteMessage() // no more messages, should return false // stomp and amazon always return true. - $falsePositive = array('Activemq', 'Amazon'); + $falsePositive = ['Activemq', 'Amazon']; if (! in_array($this->getAdapterName(), $falsePositive)) { $this->assertFalse($adapter->deleteMessage($message)); } @@ -581,11 +581,11 @@ public function testCapabilities() $this->assertTrue(is_array($list)); // these functions must have an boolean answer - $func = array( + $func = [ 'create', 'delete', 'send', 'receive', 'deleteMessage', 'getQueues', 'count', 'isExists' - ); + ]; foreach ( array_values($func) as $f ) { $this->assertTrue(isset($list[$f])); @@ -701,7 +701,7 @@ public function testVisibility() } $adapter = $queue->getAdapter(); - $not_supported = array('Activemq'); + $not_supported = ['Activemq']; if ((! $queue->isSupported('deleteMessage')) || in_array($this->getAdapterName(), $not_supported)) { $queue->deleteQueue(); $this->markTestSkipped($this->getAdapterName() . ' does not support visibility of messages'); diff --git a/tests/Zend/Queue/Adapter/ArrayTest.php b/tests/Zend/Queue/Adapter/ArrayTest.php index 4f455f65d1..dc42d34424 100644 --- a/tests/Zend/Queue/Adapter/ArrayTest.php +++ b/tests/Zend/Queue/Adapter/ArrayTest.php @@ -79,7 +79,7 @@ public function getAdapterFullName() public function getTestConfig() { - return array('driverOptions' => array()); + return ['driverOptions' => []]; } // test the constants @@ -105,7 +105,7 @@ public function test_get_setData() $queue = $this->createQueue(__FUNCTION__); $adapter = $queue->getAdapter(); - $data = array('test' => 1); + $data = ['test' => 1]; $adapter->setData($data); $got = $adapter->getData(); $this->assertEquals($data['test'], $got['test']); diff --git a/tests/Zend/Queue/Adapter/DbTest.php b/tests/Zend/Queue/Adapter/DbTest.php index 558c699437..09935e1e4a 100644 --- a/tests/Zend/Queue/Adapter/DbTest.php +++ b/tests/Zend/Queue/Adapter/DbTest.php @@ -96,16 +96,16 @@ public function getAdapterFullName() public function getTestConfig() { - $driverOptions = array(); + $driverOptions = []; if (defined('TESTS_ZEND_QUEUE_DB')) { require_once 'Zend/Json.php'; $driverOptions = Zend_Json::decode(TESTS_ZEND_QUEUE_DB); } - return array( - 'options' => array(Zend_Db_Select::FOR_UPDATE => true), + return [ + 'options' => [Zend_Db_Select::FOR_UPDATE => true], 'driverOptions' => $driverOptions, - ); + ]; } // test the constants @@ -124,14 +124,14 @@ public function test_constructor2() * @see Zend_Db_Select */ require_once 'Zend/Db/Select.php'; - $config['options'][Zend_Db_Select::FOR_UPDATE] = array(); + $config['options'][Zend_Db_Select::FOR_UPDATE] = []; $queue = $this->createQueue(__FUNCTION__, $config); $this->fail('FOR_UPDATE accepted an array'); } catch (Exception $e) { $this->assertTrue(true, 'FOR_UPDATE cannot be an array'); } - foreach (array('host', 'username', 'password', 'dbname') as $i => $arg) { + foreach (['host', 'username', 'password', 'dbname'] as $i => $arg) { try { $config = $this->getTestConfig(); unset($config['driverOptions'][$arg]); diff --git a/tests/Zend/Queue/Adapter/MemcacheqTest.php b/tests/Zend/Queue/Adapter/MemcacheqTest.php index 809a5b6fdf..d8083a6b79 100644 --- a/tests/Zend/Queue/Adapter/MemcacheqTest.php +++ b/tests/Zend/Queue/Adapter/MemcacheqTest.php @@ -94,14 +94,14 @@ public function getAdapterFullName() public function getTestConfig() { - $driverOptions = array(); + $driverOptions = []; if (defined('TESTS_ZEND_QUEUE_MEMCACHEQ_HOST')) { $driverOptions['host'] = TESTS_ZEND_QUEUE_MEMCACHEQ_HOST; } if (defined('TESTS_ZEND_QUEUE_MEMCACHEQ_PORT')) { $driverOptions['port'] = TESTS_ZEND_QUEUE_MEMCACHEQ_PORT; } - return array('driverOptions' => $driverOptions); + return ['driverOptions' => $driverOptions]; } // test the constants @@ -121,7 +121,7 @@ public function testConst() */ public function testReceiveWillRetrieveZeroItems() { - $options = array('name' => 'ZF7650', 'driverOptions' => $this->getTestConfig()); + $options = ['name' => 'ZF7650', 'driverOptions' => $this->getTestConfig()]; $queue = new Zend_Queue('Memcacheq', $options); $queue2 = $queue->createQueue('queue'); diff --git a/tests/Zend/Queue/Adapter/NullTest.php b/tests/Zend/Queue/Adapter/NullTest.php index dcd4f55840..9fe3948518 100644 --- a/tests/Zend/Queue/Adapter/NullTest.php +++ b/tests/Zend/Queue/Adapter/NullTest.php @@ -79,7 +79,7 @@ public function getAdapterFullName() public function getTestConfig() { - return array('driverOptions' => array()); + return ['driverOptions' => []]; } // test the constants diff --git a/tests/Zend/Queue/Adapter/PlatformJobQueueTest.php b/tests/Zend/Queue/Adapter/PlatformJobQueueTest.php index c83dd4fbb5..6ff6a53635 100644 --- a/tests/Zend/Queue/Adapter/PlatformJobQueueTest.php +++ b/tests/Zend/Queue/Adapter/PlatformJobQueueTest.php @@ -66,10 +66,10 @@ public function getAdapterName() public function getTestConfig() { - return array('daemonOptions' => array( + return ['daemonOptions' => [ 'host' => constant('TESTS_ZEND_QUEUE_PLATFORMJQ_HOST'), 'password' => constant('TESTS_ZEND_QUEUE_PLATFORMJQ_PASS'), - )); + ]]; } /** @@ -89,21 +89,21 @@ public function getAdapterFullName() public function testFailedConstructor() { try { - $queue = $this->createQueue(__FUNCTION__, array()); + $queue = $this->createQueue(__FUNCTION__, []); $this->fail('The test should fail if no host and password are passed'); } catch (Exception $e) { $this->assertTrue( true, 'Job Queue host and password should be provided'); } try { - $queue = $this->createQueue(__FUNCTION__, array('daemonOptions' => array())); + $queue = $this->createQueue(__FUNCTION__, ['daemonOptions' => []]); $this->fail('The test should fail if no host is passed'); } catch (Exception $e) { $this->assertTrue(true, 'Platform Job Queue host should be provided'); } try { - $queue = $this->createQueue(__FUNCTION__, array('daemonOptions' => array('host' => 'localhost'))); + $queue = $this->createQueue(__FUNCTION__, ['daemonOptions' => ['host' => 'localhost']]); $this->fail('The test should fail if no password is passed'); } catch (Exception $e) { $this->assertTrue(true, 'Platform Job Queue password should be provided'); @@ -119,7 +119,7 @@ public function testZendQueueMessageTest() return; } - $message = $queue->send(array('script' => 'info.php')); + $message = $queue->send(['script' => 'info.php']); $this->assertTrue($message instanceof Zend_Queue_Message); @@ -141,7 +141,7 @@ public function testSend() } $adapter = $queue->getAdapter(); - $message = $adapter->send(array('script' => 'info.php')); + $message = $adapter->send(['script' => 'info.php']); $this->assertTrue($message instanceof Zend_Queue_Message); $list = $queue->receive(); @@ -174,7 +174,7 @@ public function testReceive() $scriptName = 'info.php'; // send the message - $message = $adapter->send((array('script' => $scriptName))); + $message = $adapter->send((['script' => $scriptName])); $this->assertTrue($message instanceof Zend_Queue_Message); // get it back @@ -212,7 +212,7 @@ public function testDeleteMessage() $scriptName = 'info.php'; // send the message - $message = $adapter->send((array('script' => $scriptName))); + $message = $adapter->send((['script' => $scriptName])); $this->assertTrue($message instanceof Zend_Queue_Message); // get it back @@ -254,7 +254,7 @@ public function testCount() $initCount = $adapter->count(); // send a message - $message = $adapter->send(array('script' => 'info.php')); + $message = $adapter->send(['script' => 'info.php']); // test queue count for being 1 $this->assertEquals($adapter->count(), ($initCount + 1)); @@ -293,7 +293,7 @@ public function testSampleBehavior() $scriptName = 'info.php'; for ($i = 0; $i < 10; $i++) { - $queue->send(array('script' => $scriptName)); + $queue->send(['script' => $scriptName]); } $messages = $queue->receive(5); diff --git a/tests/Zend/Queue/Custom/DbForUpdate.php b/tests/Zend/Queue/Custom/DbForUpdate.php index 991815dc8b..acc0849065 100644 --- a/tests/Zend/Queue/Custom/DbForUpdate.php +++ b/tests/Zend/Queue/Custom/DbForUpdate.php @@ -60,7 +60,7 @@ public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null $queue = $this->_queue; } - $msgs = array(); + $msgs = []; $info = $this->_msg_table->info(); @@ -74,7 +74,7 @@ public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null // changes: added forUpdate $query = $db->select()->forUpdate(); - $query->from($info['name'], array('*')); + $query->from($info['name'], ['*']); $query->where('queue_id=?', $this->getQueueId($queue->getName())); $query->where('handle IS NULL OR timeout+' . (int)$timeout . ' < ' . (int)$microtime); $query->limit($maxMessages); @@ -83,13 +83,13 @@ public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null // setup our changes to the message $data['handle'] = md5(uniqid(rand(), true)); - $update = array( + $update = [ 'handle' => $data['handle'], 'timeout' => $microtime - ); + ]; // update the database - $where = array(); + $where = []; $where[] = $db->quoteInto('message_id=?', $data['message_id']); $count = $db->update($info['name'], $update, $where); @@ -110,11 +110,11 @@ public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null throw new Zend_Queue_Exception($e->getMessage(), $e->getCode()); } - $config = array( + $config = [ 'queue' => $queue, 'data' => $msgs, 'messageClass' => $queue->getMessageClass() - ); + ]; $classname = $queue->getMessageSetClass(); Zend_Loader::loadClass($classname); diff --git a/tests/Zend/Queue/Custom/Messages.php b/tests/Zend/Queue/Custom/Messages.php index 03a1659571..c1108baa5e 100644 --- a/tests/Zend/Queue/Custom/Messages.php +++ b/tests/Zend/Queue/Custom/Messages.php @@ -42,7 +42,7 @@ class Custom_Messages * * @param array $config ('queue', 'messageClass', 'data'=>array()); */ - public function __construct(array $config=array()) + public function __construct(array $config=[]) { if (isset($config['queue'])) { $this->_queue = $config['queue']; @@ -72,7 +72,7 @@ public function __construct(array $config=array()) // for each of the messages foreach($config['data'] as $i => $data) { // construct the message parameters - $message = array('data' => $data); + $message = ['data' => $data]; // If queue has not been set, then use the default. if (empty($message['queue'])) { diff --git a/tests/Zend/Queue/Custom/Queue.php b/tests/Zend/Queue/Custom/Queue.php index e7adc853dc..4145d1d295 100644 --- a/tests/Zend/Queue/Custom/Queue.php +++ b/tests/Zend/Queue/Custom/Queue.php @@ -59,7 +59,7 @@ class Custom_Queue extends Zend_Queue public function __construct() { $args = func_get_args(); - call_user_func_array(array($this, 'parent::__construct'), $args); + call_user_func_array([$this, 'parent::__construct'], $args); $this->setMessageClass('Custom_Message'); $this->setMessageSetClass('Custom_Messages'); diff --git a/tests/Zend/Queue/CustomTest.php b/tests/Zend/Queue/CustomTest.php index d8e2e2fda3..51226e2442 100644 --- a/tests/Zend/Queue/CustomTest.php +++ b/tests/Zend/Queue/CustomTest.php @@ -62,7 +62,7 @@ public function setA($a) public function __sleep() { - return array('a'); // serialize only this variable + return ['a']; // serialize only this variable } } @@ -71,15 +71,15 @@ class Zend_Queue_CustomTest extends PHPUnit_Framework_TestCase public function test_behavior() { $object_count = 10; - $objects = array(); + $objects = []; - $queue = new Custom_Queue('Array', array('name'=>'ObjectA')); + $queue = new Custom_Queue('Array', ['name'=>'ObjectA']); $this->assertTrue($queue instanceof Custom_Queue); // ------------------------------------------------ send // add items $objects[0-4] - $objects = array(); + $objects = []; for ($i = 0; $i < $object_count-5; $i++) { $object = new Custom_Object(); $queue->send(new Custom_Message($object)); diff --git a/tests/Zend/Queue/FactoryTest.php b/tests/Zend/Queue/FactoryTest.php index 37dbbaf95d..57080af7b5 100644 --- a/tests/Zend/Queue/FactoryTest.php +++ b/tests/Zend/Queue/FactoryTest.php @@ -55,13 +55,13 @@ public function testDb() $options = json_decode(TESTS_ZEND_QUEUE_DB, true); - $config = array('name' => 'queue1', - 'driverOptions' => array('host' => $options['host'], + $config = ['name' => 'queue1', + 'driverOptions' => ['host' => $options['host'], 'username' => $options['username'], 'password' => $options['password'], 'dbname' => $options['dbname'], 'type' => $options['type'], - 'port' => $options['port'])); // optional parameter + 'port' => $options['port']]]; // optional parameter $adapter = new Zend_Queue('Db', $config); @@ -75,9 +75,9 @@ public function testMemcacheq() $this->markTestSkipped('MemcacheQ setup required'); } - $config = array('name' => 'queue1', - 'driverOptions' => array('host' => TESTS_ZEND_QUEUE_MEMCACHEQ_HOST, - 'port' => TESTS_ZEND_QUEUE_MEMCACHEQ_PORT)); + $config = ['name' => 'queue1', + 'driverOptions' => ['host' => TESTS_ZEND_QUEUE_MEMCACHEQ_HOST, + 'port' => TESTS_ZEND_QUEUE_MEMCACHEQ_PORT]]; $adapter = new Zend_Queue('Memcacheq', $config); @@ -92,12 +92,12 @@ public function testActivemq() $this->markTestSkipped('ActiveMQ setup required'); } - $config = array('name' => 'queue1', - 'driverOptions' => array('host' => TESTS_ZEND_QUEUE_ACTIVEMQ_HOST, + $config = ['name' => 'queue1', + 'driverOptions' => ['host' => TESTS_ZEND_QUEUE_ACTIVEMQ_HOST, 'port' => TESTS_ZEND_QUEUE_ACTIVEMQ_PORT, 'scheme' => TESTS_ZEND_QUEUE_ACTIVEMQ_SCHEME, 'username' => '', - 'password' => '')); + 'password' => '']]; $adapter = new Zend_Queue('Activemq', $config); @@ -106,8 +106,8 @@ public function testActivemq() public function testArray() { - $config = array('name' => 'queue1', - 'driverOptions' => array()); + $config = ['name' => 'queue1', + 'driverOptions' => []]; $adapter = new Zend_Queue('Array', $config); diff --git a/tests/Zend/Queue/Message/IteratorTest.php b/tests/Zend/Queue/Message/IteratorTest.php index 4a1ea9308b..932f0cbeb3 100644 --- a/tests/Zend/Queue/Message/IteratorTest.php +++ b/tests/Zend/Queue/Message/IteratorTest.php @@ -52,30 +52,30 @@ class Zend_Queue_Message_IteratorTest extends PHPUnit_Framework_TestCase protected function setUp() { // Test Zend_Config - $this->options = array( + $this->options = [ 'name' => 'queue1', - 'params' => array(), - ); + 'params' => [], + ]; $this->queue = new Zend_Queue('array', $this->options); // construct messages $this->message_count = 5; - $data = array(); - $datum = array(); + $data = []; + $datum = []; for ($i = 0; $i < $this->message_count; $i++) { - $data[] = array( + $data[] = [ 'id' => $i+1, 'handle' => null, 'body' => 'Hello world' // This is my 2524'th time writing that. - ); + ]; } - $options = array( + $options = [ 'queue' => $this->queue, 'data' => $data, 'messageClass' => $this->queue->getMessageClass() - ); + ]; $classname = $this->queue->getMessageSetClass(); if (!class_exists($classname)) { diff --git a/tests/Zend/Queue/MessageTest.php b/tests/Zend/Queue/MessageTest.php index e001c4539f..058aeb89d7 100644 --- a/tests/Zend/Queue/MessageTest.php +++ b/tests/Zend/Queue/MessageTest.php @@ -52,23 +52,23 @@ class Zend_Queue_MessageTest extends PHPUnit_Framework_TestCase protected function setUp() { // Test Zend_Config - $this->options = array( + $this->options = [ 'name' => 'queue1', - 'params' => array(), - ); + 'params' => [], + ]; $this->queue = new Zend_Queue('array', $this->options); - $this->data = array( + $this->data = [ 'id' => 123, 'handle' => 567, 'body' => 'Hello world' // This is my 2524'th time writing that. - ); + ]; - $this->options = array( + $this->options = [ 'queue' => $this->queue, 'data' => $this->data, - ); + ]; $this->message = new Zend_Queue_Message($this->options); } @@ -168,7 +168,7 @@ public function test_set_getQueue() // parameter verification try { - $null = new Zend_Queue('Null', array()); + $null = new Zend_Queue('Null', []); $this->message->setQueue($null); $this->fail('invalid class passed to setQueue()'); } catch (Exception $e) { diff --git a/tests/Zend/Queue/Queue1Test.php b/tests/Zend/Queue/Queue1Test.php index d78c852798..9e78c7c3b5 100644 --- a/tests/Zend/Queue/Queue1Test.php +++ b/tests/Zend/Queue/Queue1Test.php @@ -46,9 +46,9 @@ protected function setUp() date_default_timezone_set('GMT'); // Test Zend_Config - $this->config = array( + $this->config = [ 'name' => 'queue1' - ); + ]; $this->queue = new Zend_Queue('Array', $this->config); } diff --git a/tests/Zend/Queue/Queue2Test.php b/tests/Zend/Queue/Queue2Test.php index 12786519fd..e357f28359 100644 --- a/tests/Zend/Queue/Queue2Test.php +++ b/tests/Zend/Queue/Queue2Test.php @@ -44,9 +44,9 @@ class Zend_Queue_Queue2Test extends Zend_Queue_QueueBaseTest protected function setUp() { // Test Zend_Config - $this->config = array( + $this->config = [ 'name' => 'queue1' - ); + ]; $this->queue = new Zend_Queue('Null', $this->config); } diff --git a/tests/Zend/Queue/QueueBaseTest.php b/tests/Zend/Queue/QueueBaseTest.php index 54f7403e5c..501ce1dfea 100644 --- a/tests/Zend/Queue/QueueBaseTest.php +++ b/tests/Zend/Queue/QueueBaseTest.php @@ -53,9 +53,9 @@ abstract class Zend_Queue_QueueBaseTest extends PHPUnit_Framework_TestCase protected function setUp() { // Test Zend_Config - $this->config = array( + $this->config = [ 'name' => 'queue1', - ); + ]; $this->queue = new Zend_Queue('Null', $this->config); } @@ -80,11 +80,11 @@ public function testConst() public function testConstruct() { // Test Zend_Config - $config = array( + $config = [ 'name' => 'queue1', - 'params' => array(), + 'params' => [], 'adapter' => 'array' - ); + ]; $zend_config = new Zend_Config($config); @@ -145,7 +145,7 @@ public function testCreateAndDeleteQueue() { // parameter testing try { - $this->queue->createQueue(array()); + $this->queue->createQueue([]); $this->fail('createQueue() $name must be a string'); } catch (Exception $e) { $this->assertTrue(true); @@ -184,7 +184,7 @@ public function testSendAndCountAndReceiveAndDeleteMessage() // ------------------------------------ send() // parameter verification try { - $this->queue->send(array()); + $this->queue->send([]); $this->fail('send() $mesage must be a string'); } catch (Exception $e) { $this->assertTrue(true); @@ -199,14 +199,14 @@ public function testSendAndCountAndReceiveAndDeleteMessage() // ------------------------------------ receive() // parameter verification try { - $this->queue->receive(array()); + $this->queue->receive([]); $this->fail('receive() $maxMessages must be a integer or null'); } catch (Exception $e) { $this->assertTrue(true); } try { - $this->queue->receive(1, array()); + $this->queue->receive(1, []); $this->fail('receive() $timeout must be a integer or null'); } catch (Exception $e) { $this->assertTrue(true); @@ -227,11 +227,11 @@ public function testCapabilities() $this->assertTrue(is_array($list)); // these functions must have an boolean answer - $func = array( + $func = [ 'create', 'delete', 'send', 'receive', 'deleteMessage', 'getQueues', 'count', 'isExists' - ); + ]; foreach ( array_values($func) as $f ) { $this->assertTrue(isset($list[$f])); diff --git a/tests/Zend/Queue/QueueTest.php b/tests/Zend/Queue/QueueTest.php index 70f26e6f41..4a87f2ddf8 100644 --- a/tests/Zend/Queue/QueueTest.php +++ b/tests/Zend/Queue/QueueTest.php @@ -50,10 +50,10 @@ class Zend_Queue_QueueTest extends PHPUnit_Framework_TestCase protected function setUp() { // Test Zend_Config - $this->config = array( + $this->config = [ 'name' => 'queue1', - 'params' => array(), - ); + 'params' => [], + ]; $this->queue = new Zend_Queue('array', $this->config); } @@ -78,11 +78,11 @@ public function testConst() public function testConstruct() { // Test Zend_Config - $config = array( + $config = [ 'name' => 'queue1', - 'params' => array(), + 'params' => [], 'adapter' => 'array' - ); + ]; require_once "Zend/Config.php"; $zend_config = new Zend_Config($config); @@ -136,7 +136,7 @@ public function test_create_deleteQueue() { // parameter testing try { - $this->queue->createQueue(array()); + $this->queue->createQueue([]); $this->fail('createQueue() $name must be a string'); } catch (Exception $e) { $this->assertTrue(true); @@ -163,7 +163,7 @@ public function test_send_count_receive_deleteMessage() // ------------------------------------ send() // parameter verification try { - $this->queue->send(array()); + $this->queue->send([]); $this->fail('send() $mesage must be a string'); } catch (Exception $e) { $this->assertTrue(true); @@ -178,14 +178,14 @@ public function test_send_count_receive_deleteMessage() // ------------------------------------ receive() // parameter verification try { - $this->queue->receive(array()); + $this->queue->receive([]); $this->fail('receive() $maxMessages must be a integer or null'); } catch (Exception $e) { $this->assertTrue(true); } try { - $this->queue->receive(1, array()); + $this->queue->receive(1, []); $this->fail('receive() $timeout must be a integer or null'); } catch (Exception $e) { $this->assertTrue(true); @@ -206,11 +206,11 @@ public function test_capabilities() $this->assertTrue(is_array($list)); // these functions must have an boolean answer - $func = array( + $func = [ 'create', 'delete', 'send', 'receive', 'deleteMessage', 'getQueues', 'count', 'isExists' - ); + ]; foreach ( array_values($func) as $f ) { $this->assertTrue(isset($list[$f])); diff --git a/tests/Zend/Queue/Stomp/FrameTest.php b/tests/Zend/Queue/Stomp/FrameTest.php index cc53fb93cf..3243c5e6b9 100644 --- a/tests/Zend/Queue/Stomp/FrameTest.php +++ b/tests/Zend/Queue/Stomp/FrameTest.php @@ -76,7 +76,7 @@ public function test_to_fromFrame() public function test_setHeaders() { $frame = new Zend_Queue_Stomp_Frame(); - $frame->setHeaders(array('testing' => 1)); + $frame->setHeaders(['testing' => 1]); $this->assertEquals(1, $frame->getHeader('testing')); } @@ -85,42 +85,42 @@ public function test_parameters() $frame = new Zend_Queue_Stomp_Frame(); try { - $frame->setAutoContentLength(array()); + $frame->setAutoContentLength([]); $this->fail('Exception should have been thrown'); } catch(Exception $e) { $this->assertTrue(true); } try { - $frame->setHeader(array(), 1); + $frame->setHeader([], 1); $this->fail('Exception should have been thrown'); } catch(Exception $e) { $this->assertTrue(true); } try { - $frame->setHeader('testing', array()); + $frame->setHeader('testing', []); $this->fail('Exception should have been thrown'); } catch(Exception $e) { $this->assertTrue(true); } try { - $frame->getHeader(array()); + $frame->getHeader([]); $this->fail('Exception should have been thrown'); } catch(Exception $e) { $this->assertTrue(true); } try { - $frame->setBody(array()); + $frame->setBody([]); $this->fail('Exception should have been thrown'); } catch(Exception $e) { $this->assertTrue(true); } try { - $frame->setCommand(array()); + $frame->setCommand([]); $this->fail('Exception should have been thrown'); } catch(Exception $e) { $this->assertTrue(true); @@ -134,7 +134,7 @@ public function test_parameters() } try { - $frame->fromFrame(array()); + $frame->fromFrame([]); $this->fail('Exception should have been thrown'); } catch(Exception $e) { $this->assertTrue(true); diff --git a/tests/Zend/Reflection/ParameterTest.php b/tests/Zend/Reflection/ParameterTest.php index a539f13bc9..b06102087f 100644 --- a/tests/Zend/Reflection/ParameterTest.php +++ b/tests/Zend/Reflection/ParameterTest.php @@ -50,20 +50,20 @@ public function setup() public function testDeclaringClassReturn() { - $parameter = new Zend_Reflection_Parameter(array('Zend_Reflection_TestSampleClass2', 'getProp2'), 0); + $parameter = new Zend_Reflection_Parameter(['Zend_Reflection_TestSampleClass2', 'getProp2'], 0); $this->assertEquals(get_class($parameter->getDeclaringClass()), 'Zend_Reflection_Class'); } public function testClassReturn_NoClassGiven_ReturnsNull() { - $parameter = new Zend_Reflection_Parameter(array('Zend_Reflection_TestSampleClass2', 'getProp2'), 'param1'); + $parameter = new Zend_Reflection_Parameter(['Zend_Reflection_TestSampleClass2', 'getProp2'], 'param1'); $this->assertNull($parameter->getClass()); } public function testClassReturn() { - $parameter = new Zend_Reflection_Parameter(array('Zend_Reflection_TestSampleClass2', 'getProp2'), 'param2'); + $parameter = new Zend_Reflection_Parameter(['Zend_Reflection_TestSampleClass2', 'getProp2'], 'param2'); $this->assertEquals(get_class($parameter->getClass()), 'Zend_Reflection_Class'); } @@ -72,17 +72,17 @@ public function testClassReturn() */ public function testTypeReturn($param, $type) { - $parameter = new Zend_Reflection_Parameter(array('Zend_Reflection_TestSampleClass5', 'doSomething'), $param); + $parameter = new Zend_Reflection_Parameter(['Zend_Reflection_TestSampleClass5', 'doSomething'], $param); $this->assertEquals($parameter->getType(), $type); } public function paramTypeTestProvider() { - return array( - array('one','int'), - array('two','int'), - array('three','string'), - ); + return [ + ['one','int'], + ['two','int'], + ['three','string'], + ]; } } diff --git a/tests/Zend/Reflection/_files/TestSampleClass.php b/tests/Zend/Reflection/_files/TestSampleClass.php index 7533976a8d..0354852308 100644 --- a/tests/Zend/Reflection/_files/TestSampleClass.php +++ b/tests/Zend/Reflection/_files/TestSampleClass.php @@ -46,7 +46,7 @@ public function getProp2($param1, Zend_Reflection_TestSampleClass $param2) public function getIterator() { - return array(); + return []; } } diff --git a/tests/Zend/RegistryTest.php b/tests/Zend/RegistryTest.php index a8602053b3..5ffd326104 100644 --- a/tests/Zend/RegistryTest.php +++ b/tests/Zend/RegistryTest.php @@ -96,7 +96,7 @@ public function testRegistryEqualContents() { Zend_Registry::set('foo', 'bar'); $registry1 = Zend_Registry::getInstance(); - $registry2 = new Zend_Registry(array('foo' => 'bar')); + $registry2 = new Zend_Registry(['foo' => 'bar']); $this->assertEquals($registry1, $registry2); $this->assertNotSame($registry1, $registry2); } @@ -104,7 +104,7 @@ public function testRegistryEqualContents() public function testRegistryUnequalContents() { $registry1 = Zend_Registry::getInstance(); - $registry2 = new Zend_Registry(array('foo' => 'bar')); + $registry2 = new Zend_Registry(['foo' => 'bar']); $this->assertNotEquals($registry1, $registry2); $this->assertNotSame($registry1, $registry2); } @@ -130,7 +130,7 @@ public function testRegistryArrayObject() public function testRegistryArrayAsProps() { - $registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS); + $registry = new Zend_Registry([], ArrayObject::ARRAY_AS_PROPS); $registry->foo = 'bar'; $this->assertTrue(isset($registry->foo)); $this->assertEquals('bar', $registry->foo); diff --git a/tests/Zend/Rest/ClientTest.php b/tests/Zend/Rest/ClientTest.php index c53f05a573..9055c8e499 100644 --- a/tests/Zend/Rest/ClientTest.php +++ b/tests/Zend/Rest/ClientTest.php @@ -44,9 +44,9 @@ public function setUp() $this->path = dirname(__FILE__) . '/responses/'; $this->adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $this->adapter - )); + ]); Zend_Rest_Client::setHttpClient($client); $this->rest = new Zend_Rest_Client('http://framework.zend.com/'); @@ -205,7 +205,7 @@ public function testRestPostWithArrayData() . $expXml; $this->adapter->setResponse($response); - $response = $this->rest->restPost('/rest/', array('foo' => 'bar', 'baz' => 'bat')); + $response = $this->rest->restPost('/rest/', ['foo' => 'bar', 'baz' => 'bat']); $this->assertTrue($response instanceof Zend_Http_Response); $body = $response->getBody(); $this->assertContains($expXml, $response->getBody()); diff --git a/tests/Zend/Rest/ControllerTest.php b/tests/Zend/Rest/ControllerTest.php index 38db25a909..32aaab6246 100644 --- a/tests/Zend/Rest/ControllerTest.php +++ b/tests/Zend/Rest/ControllerTest.php @@ -46,7 +46,7 @@ class Zend_Rest_TestController extends Zend_Rest_Controller public $testValue = ''; public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, - array $invokeArgs = array()) + array $invokeArgs = []) { $this->testValue = ''; } diff --git a/tests/Zend/Rest/ResultTest.php b/tests/Zend/Rest/ResultTest.php index 33bae91c4d..2292bf1e9d 100644 --- a/tests/Zend/Rest/ResultTest.php +++ b/tests/Zend/Rest/ResultTest.php @@ -81,7 +81,7 @@ public function testResponseArray() foreach ($client as $key => $value) { $result_array[$key] = (string) $value; } - $this->assertEquals(array("foo" => "bar", "baz" => "1", "key_1" => "0", "bat" => "123", "status" => "success"), $result_array); + $this->assertEquals(["foo" => "bar", "baz" => "1", "key_1" => "0", "bat" => "123", "status" => "success"], $result_array); } public function testResponseObject() diff --git a/tests/Zend/Rest/RouteTest.php b/tests/Zend/Rest/RouteTest.php index 527eea207a..13b15ee1c4 100644 --- a/tests/Zend/Rest/RouteTest.php +++ b/tests/Zend/Rest/RouteTest.php @@ -71,7 +71,7 @@ public function setUp() $this->_dispatcher = $this->_front->getDispatcher(); - $this->_dispatcher->setControllerDirectory(array( + $this->_dispatcher->setControllerDirectory([ 'default' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Controller' . DIRECTORY_SEPARATOR . @@ -81,7 +81,7 @@ public function setUp() 'Controller' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Admin', - )); + ]); } public function test_getVersion() @@ -102,19 +102,19 @@ public function test_getInstance_fromINIConfig() $this->assertEquals('object', $route->getDefault('controller')); $request = $this->_buildRequest('GET', '/mod/project'); - $values = $this->_invokeRouteMatch($request, array(), $route); + $values = $this->_invokeRouteMatch($request, [], $route); $this->assertEquals('mod', $values['module']); $this->assertEquals('project', $values['controller']); $this->assertEquals('index', $values['action']); $request = $this->_buildRequest('POST', '/mod/user'); - $values = $this->_invokeRouteMatch($request, array(), $route); + $values = $this->_invokeRouteMatch($request, [], $route); $this->assertEquals('mod', $values['module']); $this->assertEquals('user', $values['controller']); $this->assertEquals('post', $values['action']); $request = $this->_buildRequest('GET', '/other'); - $values = $this->_invokeRouteMatch($request, array(), $route); + $values = $this->_invokeRouteMatch($request, [], $route); $this->assertFalse($values); } @@ -502,7 +502,7 @@ public function test_RESTfulApp_route_chaining_urlencodedWithPlusSymbol() public function test_RESTfulModule_GET_user_index() { $request = $this->_buildRequest('GET', '/mod/user/index'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -518,7 +518,7 @@ public function test_RESTfulModule_GET_user_index() public function test_RESTfulModule_GET_user_index_withParam_urlencodedWithPlusSymbol() { $request = $this->_buildRequest('GET', '/mod/user/index/the%2Bemail%40address/email%2Btest%40example.com'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -532,7 +532,7 @@ public function test_RESTfulModule_GET_user_index_withParam_urlencodedWithPlusSy public function test_RESTfulModule_GET_user() { $request = $this->_buildRequest('GET', '/mod/user/1234'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -548,7 +548,7 @@ public function test_RESTfulModule_GET_user() public function test_RESTfulModule_GET_user_urlencodedWithPlusSymbol() { $request = $this->_buildRequest('GET', '/mod/user/email%2Btest%40example.com'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -562,7 +562,7 @@ public function test_RESTfulModule_GET_user_urlencodedWithPlusSymbol() public function test_RESTfulModule_POST_user() { $request = $this->_buildRequest('POST', '/mod/user'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -575,7 +575,7 @@ public function test_RESTfulModule_POST_user() public function test_RESTfulModule_POST_user_inNonRESTModule_returnsFalse() { $request = $this->_buildRequest('POST', '/default/user'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertFalse($values); @@ -584,7 +584,7 @@ public function test_RESTfulModule_POST_user_inNonRESTModule_returnsFalse() public function test_RESTfulModule_PUT_user_byIdentifier() { $request = $this->_buildRequest('PUT', '/mod/user/lcrouch'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -601,7 +601,7 @@ public function test_RESTfulModule_PUT_user_byIdentifier() public function test_RESTfulModule_PUT_user_byIdentifier_urlencodedWithPlusSymbol() { $request = $this->_buildRequest('PUT', '/mod/user/email%2Btest%40example.com'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -615,7 +615,7 @@ public function test_RESTfulModule_PUT_user_byIdentifier_urlencodedWithPlusSymbo public function test_RESTfulModule_DELETE_user_byIdentifier() { $request = $this->_buildRequest('DELETE', '/mod/user/lcrouch'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -632,7 +632,7 @@ public function test_RESTfulModule_DELETE_user_byIdentifier() public function test_RESTfulModule_DELETE_user_byIdentifier_urlencodedWithPlusSymbol() { $request = $this->_buildRequest('DELETE', '/mod/user/email%2Btest%40example.com'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -646,7 +646,7 @@ public function test_RESTfulModule_DELETE_user_byIdentifier_urlencodedWithPlusSy public function test_RESTfulController_GET_user_index() { $request = $this->_buildRequest('GET', '/mod/user/index'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -659,7 +659,7 @@ public function test_RESTfulController_GET_user_index() public function test_RESTfulController_GET_default_controller_returns_false() { $request = $this->_buildRequest('GET', '/mod/index/index'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertFalse($values); @@ -668,7 +668,7 @@ public function test_RESTfulController_GET_default_controller_returns_false() public function test_RESTfulController_GET_other_index_returns_false() { $request = $this->_buildRequest('GET', '/mod/project/index'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertFalse($values); @@ -677,7 +677,7 @@ public function test_RESTfulController_GET_other_index_returns_false() public function test_RESTfulController_GET_user() { $request = $this->_buildRequest('GET', '/mod/user/1234'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -693,7 +693,7 @@ public function test_RESTfulController_GET_user() public function test_RESTfulController_GET_user_urlencodedWithPlusSymbol() { $request = $this->_buildRequest('GET', '/mod/user/email%2Btest%40example.com'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -707,7 +707,7 @@ public function test_RESTfulController_GET_user_urlencodedWithPlusSymbol() public function test_RESTfulController_POST_user() { $request = $this->_buildRequest('POST', '/mod/user'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -720,7 +720,7 @@ public function test_RESTfulController_POST_user() public function test_RESTfulController_POST_user_inNonRESTModule_returnsFalse() { $request = $this->_buildRequest('POST', '/default/user'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertFalse($values); @@ -729,7 +729,7 @@ public function test_RESTfulController_POST_user_inNonRESTModule_returnsFalse() public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulController_defaultControllerInURL_returnsFalse() { $request = $this->_buildRequest('POST', '/mod/index'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertFalse($values); @@ -738,7 +738,7 @@ public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulCo public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulController_noDefaultControllerInURL_returnsFalse() { $request = $this->_buildRequest('POST', '/mod'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertFalse($values); @@ -747,7 +747,7 @@ public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulCo public function test_RESTfulController_PUT_user_byIdentifier() { $request = $this->_buildRequest('PUT', '/mod/user/lcrouch'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -764,7 +764,7 @@ public function test_RESTfulController_PUT_user_byIdentifier() public function test_RESTfulController_PUT_user_byIdentifier_urlencodedWithPlusSymbol() { $request = $this->_buildRequest('PUT', '/mod/user/email%2Btest%40example.com'); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -778,7 +778,7 @@ public function test_RESTfulController_PUT_user_byIdentifier_urlencodedWithPlusS public function test_RESTfulController_DELETE_user_byIdentifier() { $request = $this->_buildRequest('DELETE', '/mod/user/lcrouch'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -795,7 +795,7 @@ public function test_RESTfulController_DELETE_user_byIdentifier() public function test_RESTfulController_DELETE_user_byIdentifier_urlencodedWithPlusSymbol() { $request = $this->_buildRequest('DELETE', '/mod/user/email%2Btest%40example.com'); - $config = array('mod'); + $config = ['mod']; $values = $this->_invokeRouteMatch($request, $config); $this->assertTrue(is_array($values)); @@ -808,40 +808,40 @@ public function test_RESTfulController_DELETE_user_byIdentifier_urlencodedWithPl public function test_assemble_plain_ignores_action() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('module'=>'mod', 'controller'=>'user', 'action'=>'get'); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['module'=>'mod', 'controller'=>'user', 'action'=>'get']; $url = $route->assemble($params); $this->assertEquals('mod/user', $url); } public function test_assemble_id_after_controller() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('module'=>'mod', 'controller'=>'user', 'id'=>'lcrouch'); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['module'=>'mod', 'controller'=>'user', 'id'=>'lcrouch']; $url = $route->assemble($params); $this->assertEquals('mod/user/lcrouch', $url); } public function test_assemble_index_after_controller_with_params() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('module'=>'mod', 'controller'=>'user', 'index'=>true, 'foo'=>'bar'); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['module'=>'mod', 'controller'=>'user', 'index'=>true, 'foo'=>'bar']; $url = $route->assemble($params); $this->assertEquals('mod/user/index/foo/bar', $url); } public function test_assemble_encode_param_values() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('module'=>'mod', 'controller'=>'user', 'index'=>true, 'foo'=>'bar is n!ice'); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['module'=>'mod', 'controller'=>'user', 'index'=>true, 'foo'=>'bar is n!ice']; $url = $route->assemble($params); $this->assertEquals('mod/user/index/foo/bar+is+n%21ice', $url); } public function test_assemble_does_NOT_encode_param_values() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('module'=>'mod', 'controller'=>'user', 'index'=>true, 'foo'=>'bar is n!ice'); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['module'=>'mod', 'controller'=>'user', 'index'=>true, 'foo'=>'bar is n!ice']; $url = $route->assemble($params, false, false); $this->assertEquals('mod/user/index/foo/bar is n!ice', $url); } @@ -851,8 +851,8 @@ public function test_assemble_does_NOT_encode_param_values() */ public function test_assemble_edit_with_module_appends_action_after_id() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('module'=>'mod', 'controller'=>'users', 'action'=>'edit', 'id'=>1); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['module'=>'mod', 'controller'=>'users', 'action'=>'edit', 'id'=>1]; $url = $route->assemble($params); $this->assertEquals('mod/users/1/edit', $url); } @@ -862,8 +862,8 @@ public function test_assemble_edit_with_module_appends_action_after_id() */ public function test_assemble_edit_without_module_appends_action_after_id() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('controller'=>'users', 'action'=>'edit', 'id'=>1); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['controller'=>'users', 'action'=>'edit', 'id'=>1]; $url = $route->assemble($params); $this->assertEquals('users/1/edit', $url); } @@ -873,8 +873,8 @@ public function test_assemble_edit_without_module_appends_action_after_id() */ public function test_assemble_new_with_module_appends_action() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('module'=>'mod', 'controller'=>'users', 'action'=>'new'); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['module'=>'mod', 'controller'=>'users', 'action'=>'new']; $url = $route->assemble($params); $this->assertEquals('mod/users/new', $url); } @@ -884,8 +884,8 @@ public function test_assemble_new_with_module_appends_action() */ public function test_assemble_new_without_module_appends_action() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('controller'=>'users', 'action'=>'new'); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['controller'=>'users', 'action'=>'new']; $url = $route->assemble($params); $this->assertEquals('users/new', $url); } @@ -895,8 +895,8 @@ public function test_assemble_new_without_module_appends_action() */ public function test_assemble_random_action_with_module_removes_action() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('module'=>'mod', 'controller'=>'users', 'action'=>'newbar'); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['module'=>'mod', 'controller'=>'users', 'action'=>'newbar']; $url = $route->assemble($params); $this->assertNotEquals('mod/users/newbar', $url); } @@ -906,8 +906,8 @@ public function test_assemble_random_action_with_module_removes_action() */ public function test_assemble_random_action_without_module_removes_action() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('controller'=>'users', 'action'=>'newbar'); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['controller'=>'users', 'action'=>'newbar']; $url = $route->assemble($params); $this->assertNotEquals('users/newbar', $url); } @@ -917,8 +917,8 @@ public function test_assemble_random_action_without_module_removes_action() */ public function test_assemble_with_module_honors_index_parameter_with_resource_id_and_extra_parameters() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('module'=>'mod', 'controller'=>'users', 'id' => 1, 'extra'=>'parameter', 'another' => 'parameter', 'index' => true); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['module'=>'mod', 'controller'=>'users', 'id' => 1, 'extra'=>'parameter', 'another' => 'parameter', 'index' => true]; $url = $route->assemble($params, false, false); $this->assertEquals('mod/users/index/1/extra/parameter/another/parameter', $url); } @@ -928,8 +928,8 @@ public function test_assemble_with_module_honors_index_parameter_with_resource_i */ public function test_assemble_without_module_honors_index_parameter_with_resource_id_and_extra_parameters() { - $route = new Zend_Rest_Route($this->_front, array(), array()); - $params = array('controller'=>'users', 'id' => 1, 'extra'=>'parameter', 'another' => 'parameter', 'index' => true); + $route = new Zend_Rest_Route($this->_front, [], []); + $params = ['controller'=>'users', 'id' => 1, 'extra'=>'parameter', 'another' => 'parameter', 'index' => true]; $url = $route->assemble($params, false, false); $this->assertEquals('users/index/1/extra/parameter/another/parameter', $url); } @@ -941,10 +941,10 @@ public function test_request_get_user_params() $uri = Zend_Uri::factory('http://localhost.com/user/index?a=1&b=2'); $request = new Zend_Controller_Request_Http($uri); $request->setParam('test', 5); - $config = array('mod'=>array('user')); + $config = ['mod'=>['user']]; $this->_invokeRouteMatch($request, $config); - $this->assertEquals(array("test"=>5), $request->getUserParams()); - $this->assertEquals(array("test"=>5,"a"=>1,"b"=>2), $request->getParams()); + $this->assertEquals(["test"=>5], $request->getUserParams()); + $this->assertEquals(["test"=>5,"a"=>1,"b"=>2], $request->getParams()); } @@ -955,11 +955,11 @@ private function _buildRequest($method, $uri) return $request; } - private function _invokeRouteMatch($request, $config = array(), $route = null) + private function _invokeRouteMatch($request, $config = [], $route = null) { $this->_front->setRequest($request); if ($route == null) { - $route = new Zend_Rest_Route($this->_front, array(), $config); + $route = new Zend_Rest_Route($this->_front, [], $config); } $values = $route->match($request); return $values; diff --git a/tests/Zend/Rest/ServerTest.php b/tests/Zend/Rest/ServerTest.php index 869ab14dcc..17953a3e04 100644 --- a/tests/Zend/Rest/ServerTest.php +++ b/tests/Zend/Rest/ServerTest.php @@ -87,7 +87,7 @@ public function testHandleNamedArgFunction() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc', 'who' => 'Davey')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc', 'who' => 'Davey']); $result = ob_get_clean(); $this->assertContains('Hello Daveysuccess', $result, "Bad Result"); } @@ -97,7 +97,7 @@ public function testHandleFunctionNoArgs() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc2'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc2')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc2']); $result = ob_get_clean(); $this->assertContains('Hello Worldsuccess', $result, "Bad Result"); } @@ -107,15 +107,15 @@ public function testHandleFunctionNoArgsRaisesFaultResponse() $server = new Zend_Rest_Server(); $server->returnResponse(true); $server->addFunction('Zend_Rest_Server_TestFunc'); - $result = $server->handle(array('method' => 'Zend_Rest_Server_TestFunc')); + $result = $server->handle(['method' => 'Zend_Rest_Server_TestFunc']); $this->assertContains('failed', $result); } public function testHandleFunctionNoArgsUsingRequest() { - $_REQUEST = array( + $_REQUEST = [ 'method' => 'Zend_Rest_Server_TestFunc2' - ); + ]; $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc2'); ob_start(); @@ -129,7 +129,7 @@ public function testHandleAnonymousArgFunction() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc', 'arg1' => 'Davey')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc', 'arg1' => 'Davey']); $result = ob_get_clean(); $this->assertContains('Hello Daveysuccess', $result, "Bad Result"); } @@ -141,11 +141,11 @@ public function testHandleMultipleFunction() $server->addFunction('Zend_Rest_Server_TestFunc2'); $server->addFunction('Zend_Rest_Server_TestFunc'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc2')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc2']); $result = ob_get_clean(); $this->assertContains('Hello Worldsuccess', $result, "Bad Result"); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc', 'arg1' => 'Davey')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc', 'arg1' => 'Davey']); $result = ob_get_clean(); $this->assertContains('Hello Daveysuccess', $result, "Bad Result"); } @@ -155,7 +155,7 @@ public function testHandleMethodNoArgs() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc')); + $server->handle(['method' => 'testFunc']); $result = ob_get_clean(); $this->assertContains('Hello Worldsuccess', $result, 'Bad Result'); } @@ -163,9 +163,9 @@ public function testHandleMethodNoArgs() public function testHandleMethodOfClassWithConstructor() { $server = new Zend_Rest_Server(); - $server->setClass('Zend_Rest_Server_Test2', '', array('testing args')); + $server->setClass('Zend_Rest_Server_Test2', '', ['testing args']); ob_start(); - $server->handle(array('method' => 'test2Func1')); + $server->handle(['method' => 'test2Func1']); $result = ob_get_clean(); $this->assertContains("testing args", $result, "Bad Result"); } @@ -175,7 +175,7 @@ public function testHandleAnonymousArgMethod() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc2', 'arg1' => "Davey")); + $server->handle(['method' => 'testFunc2', 'arg1' => "Davey"]); $result = ob_get_clean(); $this->assertContains('Hello Daveysuccess', $result, 'Bad Result'); } @@ -185,7 +185,7 @@ public function testHandleNamedArgMethod() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc3', 'who' => "Davey", 'when' => 'today')); + $server->handle(['method' => 'testFunc3', 'who' => "Davey", 'when' => 'today']); $result = ob_get_clean(); $this->assertContains('Hello Davey, How are you todaysuccess', $result, 'Bad Result'); } @@ -195,7 +195,7 @@ public function testHandleStaticNoArgs() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc4')); + $server->handle(['method' => 'testFunc4']); $result = ob_get_clean(); $this->assertContains('Hello Worldsuccess', $result, var_export($result, 1)); } @@ -205,7 +205,7 @@ public function testHandleAnonymousArgStatic() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc5', 'arg1' => "Davey")); + $server->handle(['method' => 'testFunc5', 'arg1' => "Davey"]); $result = ob_get_clean(); $this->assertContains('Hello Daveysuccess', $result, 'Bad Result'); } @@ -215,7 +215,7 @@ public function testHandleNamedArgStatic() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc6', 'who' => "Davey", 'when' => 'today')); + $server->handle(['method' => 'testFunc6', 'who' => "Davey", 'when' => 'today']); $result = ob_get_clean(); $this->assertContains('Hello Davey, How are you todaysuccess', $result, 'Bad Result'); } @@ -225,7 +225,7 @@ public function testHandleMultipleAnonymousArgs() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc9'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc9', 'arg1' => "Hello", 'arg2' => "Davey")); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc9', 'arg1' => "Hello", 'arg2' => "Davey"]); $result = ob_get_clean(); $this->assertContains('Hello Daveysuccess', $result, "Bad Result"); } @@ -235,7 +235,7 @@ public function testHandleReturnFalse() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc3'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc3')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc3']); $result = ob_get_clean(); $this->assertContains('0success', $result, 'Bas Response'); } @@ -245,7 +245,7 @@ public function testHandleReturnTrue() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc4'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc4')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc4']); $result = ob_get_clean(); $this->assertContains('1success', $result, 'Bas Response'); } @@ -256,7 +256,7 @@ public function testHandleReturnInteger() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc5'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc5')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc5']); $result = ob_get_clean(); $this->assertContains('123success', $result, 'Bas Response'); } @@ -266,7 +266,7 @@ public function testHandleReturnString() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc6'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc6')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc6']); $result = ob_get_clean(); $this->assertContains('stringsuccess', $result, 'Bas Response'); } @@ -276,7 +276,7 @@ public function testHandleReturnArray() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc7'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc7')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc7']); $result = ob_get_clean(); $this->assertContains('bar10123success', $result, $result); } @@ -286,7 +286,7 @@ public function testHandleReturnNestedArray() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc12'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc12')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc12']); $result = ob_get_clean(); $this->assertContains('Zend_Rest_Server_TestFunc12', $result, $result); $this->assertContains('1', $result, $result); @@ -299,7 +299,7 @@ public function testHandleMethodReturnObject() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test2'); ob_start(); - $server->handle(array('method' => 'test2Struct')); + $server->handle(['method' => 'test2Struct']); $result = ob_get_clean(); $this->assertContains('assertContains('addFunction('Zend_Rest_Server_TestFunc8'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc8')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc8']); $result = ob_get_clean(); $this->assertContains('bar11230success', $result, $result); } @@ -323,7 +323,7 @@ public function testHandleReturnSimpleXml() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test2'); ob_start(); - $server->handle(array('method' => 'test2Xml')); + $server->handle(['method' => 'test2Xml']); $result = ob_get_clean(); $this->assertContains("bar", $result, "Bad Result"); } @@ -333,7 +333,7 @@ public function testHandleReturnDomDocument() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test2'); ob_start(); - $server->handle(array('method' => 'test2DomDocument')); + $server->handle(['method' => 'test2DomDocument']); $result = ob_get_clean(); $this->assertContains("bar", $result, "Bad Result"); } @@ -343,7 +343,7 @@ public function testHandleReturnDomElement() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test2'); ob_start(); - $server->handle(array('method' => 'test2DomElement')); + $server->handle(['method' => 'test2DomElement']); $result = ob_get_clean(); $this->assertContains("bar", $result, "Bad Result"); } @@ -356,7 +356,7 @@ public function testHandleInvalidMethod() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test2'); $server->returnResponse(true); - $response = $server->handle(array('method' => 'test3DomElement')); + $response = $server->handle(['method' => 'test3DomElement']); $this->assertContains('failed', $response); $this->assertNotContains('An unknown error occured. Please try again.', $response); } @@ -389,7 +389,7 @@ public function testHandleException() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc11'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc11')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc11']); $result = ob_get_clean(); $this->assertContains("assertContains("testing rest server faults", $result); @@ -400,7 +400,7 @@ public function testHandleClassMethodException() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test2'); ob_start(); - $server->handle(array('method' => 'test2ThrowException')); + $server->handle(['method' => 'test2ThrowException']); $result = ob_get_clean(); $this->assertContains("assertContains("", $result); @@ -412,7 +412,7 @@ public function testHandleVoid() $server = new Zend_Rest_Server(); $server->addFunction('Zend_Rest_Server_TestFunc10'); ob_start(); - $server->handle(array('method' => 'Zend_Rest_Server_TestFunc10')); + $server->handle(['method' => 'Zend_Rest_Server_TestFunc10']); $result = ob_get_clean(); $this->assertContains('success', $result, $result); } @@ -422,7 +422,7 @@ public function testGetHeaders() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test2'); ob_start(); - $server->handle(array('method' => 'test2ThrowException')); + $server->handle(['method' => 'test2ThrowException']); $result = ob_get_clean(); $headers = $server->getHeaders(); $this->assertContains('HTTP/1.0 400 Bad Request', $headers); @@ -442,7 +442,7 @@ public function testReturnResponseForcesHandleToReturnResponse() $server->returnResponse(true); $server->setClass('Zend_Rest_Server_Test2'); ob_start(); - $response = $server->handle(array('method' => 'test2Xml')); + $response = $server->handle(['method' => 'test2Xml']); $result = ob_get_clean(); $this->assertTrue(empty($result)); $this->assertContains('bar', $response); @@ -454,7 +454,7 @@ public function testGeneratedXmlEncodesScalarAmpersands() $server->returnResponse(true); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $response = $server->handle(array('method' => 'testScalarEncoding')); + $response = $server->handle(['method' => 'testScalarEncoding']); $result = ob_get_clean(); $this->assertTrue(empty($result)); $this->assertContains('This string has chars & ampersands', $response); @@ -466,7 +466,7 @@ public function testGeneratedXmlEncodesStructAmpersands() $server->returnResponse(true); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $response = $server->handle(array('method' => 'testStructEncoding')); + $response = $server->handle(['method' => 'testStructEncoding']); $result = ob_get_clean(); $this->assertTrue(empty($result)); $this->assertContains('bar & baz', $response); @@ -478,7 +478,7 @@ public function testGeneratedXmlEncodesFaultAmpersands() $server->returnResponse(true); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $response = $server->handle(array('method' => 'testExceptionsEncoding')); + $response = $server->handle(['method' => 'testExceptionsEncoding']); $result = ob_get_clean(); $this->assertTrue(empty($result)); $this->assertContains('testing class method exception & encoding', $response); @@ -515,7 +515,7 @@ public function testNamesOfArgumentsShouldDetermineArgumentOrder() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc6', 'arg2' => 'today', 'arg1' => "Davey")); + $server->handle(['method' => 'testFunc6', 'arg2' => 'today', 'arg1' => "Davey"]); $result = ob_get_clean(); $this->assertContains('Hello Davey, How are you todaysuccess', $result, var_export($result, 1)); } @@ -531,7 +531,7 @@ public function testMissingArgumentsShouldResultInFaultResponse() $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc6', 'arg1' => 'Davey')); + $server->handle(['method' => 'testFunc6', 'arg1' => 'Davey']); $result = ob_get_clean(); $this->assertRegexp('#Invalid Method Call to(.*?)(Missing argument\(s\): ).*?()#', $result); $this->assertContains('failed', $result); @@ -546,7 +546,7 @@ public function testMissingAnonymousArgumentsWithDefaultsShouldNotResultInFaultR $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc7', 'arg1' => "Davey")); + $server->handle(['method' => 'testFunc7', 'arg1' => "Davey"]); $result = ob_get_clean(); $this->assertContains('success', $result, var_export($result, 1)); $this->assertContains('Hello Davey, How are you today', $result, var_export($result, 1)); @@ -560,7 +560,7 @@ public function testCallingUnknownMethodDoesNotThrowUnknownButSpecificErrorExcep $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test2'); $server->returnResponse(true); - $response = $server->handle(array('method' => 'testCallingInvalidMethod')); + $response = $server->handle(['method' => 'testCallingInvalidMethod']); $this->assertContains('failed', $response); $this->assertNotContains('An unknown error occured. Please try again.', $response); } @@ -586,7 +586,7 @@ public function testMissingZeroBasedAnonymousArgumentsWithDefaultsShouldNotResul $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc7', 'arg0' => "Davey")); + $server->handle(['method' => 'testFunc7', 'arg0' => "Davey"]); $result = ob_get_clean(); $this->assertContains('success', $result, var_export($result, 1)); $this->assertContains('Hello Davey, How are you today', $result, var_export($result, 1)); @@ -600,7 +600,7 @@ public function testMissingNamesArgumentsWithDefaultsShouldNotResultInFaultRespo $server = new Zend_Rest_Server(); $server->setClass('Zend_Rest_Server_Test'); ob_start(); - $server->handle(array('method' => 'testFunc7', 'who' => "Davey")); + $server->handle(['method' => 'testFunc7', 'who' => "Davey"]); $result = ob_get_clean(); $this->assertContains('success', $result, var_export($result, 1)); $this->assertContains('Hello Davey, How are you today', $result, var_export($result, 1)); @@ -675,7 +675,7 @@ function Zend_Rest_Server_TestFunc6() */ function Zend_Rest_Server_TestFunc7() { - return array('foo' => 'bar', 'baz' => true, 1 => false, 'bat' => 123); + return ['foo' => 'bar', 'baz' => true, 1 => false, 'bat' => 123]; } /** @@ -685,7 +685,7 @@ function Zend_Rest_Server_TestFunc7() */ function Zend_Rest_Server_TestFunc8() { - $return = (object) array('foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false); + $return = (object) ['foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false]; return $return; } @@ -729,7 +729,7 @@ function Zend_Rest_Server_TestFunc11() */ function Zend_Rest_Server_TestFunc12() { - return array('foo' => array('baz' => true, 1 => false, 'bat' => 123), 'bar' => 'baz'); + return ['foo' => ['baz' => true, 1 => false, 'bat' => 123], 'bar' => 'baz']; } @@ -824,9 +824,9 @@ public function testScalarEncoding() */ public function testStructEncoding() { - return array( + return [ 'foo' => 'bar & baz' - ); + ]; } /** @@ -890,7 +890,7 @@ public function test2ThrowException() public function test2Struct() { $o = new stdClass(); - $o->foo = array('baz' => true, 1 => false, 'bat' => 123); + $o->foo = ['baz' => true, 1 => false, 'bat' => 123]; $o->bar = 'baz'; return $o; diff --git a/tests/Zend/Search/Lucene/AnalysisTest.php b/tests/Zend/Search/Lucene/AnalysisTest.php index 39814e933f..0da753a0a2 100644 --- a/tests/Zend/Search/Lucene/AnalysisTest.php +++ b/tests/Zend/Search/Lucene/AnalysisTest.php @@ -339,7 +339,7 @@ public function testStopWords() require_once 'Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php'; $analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive(); - $stopWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_StopWords(array('word', 'and', 'or')); + $stopWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_StopWords(['word', 'and', 'or']); $analyzer->addFilter($stopWordsFilter); diff --git a/tests/Zend/Search/Lucene/DocumentTest.php b/tests/Zend/Search/Lucene/DocumentTest.php index 162aa05b9a..c1055909d7 100644 --- a/tests/Zend/Search/Lucene/DocumentTest.php +++ b/tests/Zend/Search/Lucene/DocumentTest.php @@ -92,7 +92,7 @@ public function testFields() $document->addField(Zend_Search_Lucene_Field::Text('annotation', 'Annotation')); $document->addField(Zend_Search_Lucene_Field::Text('body', 'Document body, document body, document body...')); - $fieldnamesDiffArray = array_diff($document->getFieldNames(), array('title', 'annotation', 'body')); + $fieldnamesDiffArray = array_diff($document->getFieldNames(), ['title', 'annotation', 'body']); $this->assertTrue(is_array($fieldnamesDiffArray)); $this->assertEquals(count($fieldnamesDiffArray), 0); @@ -146,10 +146,10 @@ public function testHtmlExtendedHighlighting() $this->assertTrue($doc instanceof Zend_Search_Lucene_Document_Html); $doc->highlightExtended('document', - array('Zend_Search_Lucene_DocumentTest_DocHighlightingContainer', - 'extendedHighlightingCallback'), - array('style="color:black;background-color:#ff66ff"', - '(!!!)')); + ['Zend_Search_Lucene_DocumentTest_DocHighlightingContainer', + 'extendedHighlightingCallback'], + ['style="color:black;background-color:#ff66ff"', + '(!!!)']); $this->assertTrue(strpos($doc->getHTML(), 'Document(!!!) body.') !== false); } @@ -158,7 +158,7 @@ public function testHtmlWordsHighlighting() $doc = Zend_Search_Lucene_Document_Html::loadHTML('Page titleDocument body.'); $this->assertTrue($doc instanceof Zend_Search_Lucene_Document_Html); - $doc->highlight(array('document', 'body'), '#66ffff'); + $doc->highlight(['document', 'body'], '#66ffff'); $highlightedHTML = $doc->getHTML(); $this->assertTrue(strpos($highlightedHTML, 'Document') !== false); $this->assertTrue(strpos($highlightedHTML, 'body') !== false); @@ -170,10 +170,10 @@ public function testHtmlExtendedHighlightingCorrectWrongHtml() $this->assertTrue($doc instanceof Zend_Search_Lucene_Document_Html); $doc->highlightExtended('document', - array('Zend_Search_Lucene_DocumentTest_DocHighlightingContainer', - 'extendedHighlightingCallback'), - array('style="color:black;background-color:#ff66ff"', - '

      (!!!)' /* Wrong HTML here,

      tag is not closed */)); + ['Zend_Search_Lucene_DocumentTest_DocHighlightingContainer', + 'extendedHighlightingCallback'], + ['style="color:black;background-color:#ff66ff"', + '

      (!!!)' /* Wrong HTML here,

      tag is not closed */]); $this->assertTrue(strpos($doc->getHTML(), 'Document

      (!!!)

      body.') !== false); } @@ -183,14 +183,14 @@ public function testHtmlLinksProcessing() $this->assertTrue($doc instanceof Zend_Search_Lucene_Document_Html); $this->assertTrue(array_values($doc->getHeaderLinks()) == - array('index.html', 'contributing.html', 'contributing.bugs.html', 'contributing.wishlist.html')); + ['index.html', 'contributing.html', 'contributing.bugs.html', 'contributing.wishlist.html']); $this->assertTrue(array_values($doc->getLinks()) == - array('contributing.bugs.html', + ['contributing.bugs.html', 'contributing.wishlist.html', 'developers.documentation.html', 'faq.translators-revision-tracking.html', 'index.html', - 'contributing.html')); + 'contributing.html']); } @@ -243,7 +243,7 @@ public function testHtmlAreaTags() Zend_Search_Lucene_Document_Html::setExcludeNoFollowLinks(false); $doc1 = Zend_Search_Lucene_Document_Html::loadHTML($html); $this->assertTrue($doc1 instanceof Zend_Search_Lucene_Document_Html); - $links = array('link1.html', 'link2.html', 'link3.html', 'link4.html'); + $links = ['link1.html', 'link2.html', 'link3.html', 'link4.html']; $this->assertTrue(array_values($doc1->getLinks()) == $links); } @@ -263,12 +263,12 @@ public function testHtmlNoFollowLinks() Zend_Search_Lucene_Document_Html::setExcludeNoFollowLinks(false); $doc1 = Zend_Search_Lucene_Document_Html::loadHTML($html); $this->assertTrue($doc1 instanceof Zend_Search_Lucene_Document_Html); - $this->assertTrue(array_values($doc1->getLinks()) == array('link1.html', 'link2.html')); + $this->assertTrue(array_values($doc1->getLinks()) == ['link1.html', 'link2.html']); Zend_Search_Lucene_Document_Html::setExcludeNoFollowLinks(true); $doc2 = Zend_Search_Lucene_Document_Html::loadHTML($html); $this->assertTrue($doc2 instanceof Zend_Search_Lucene_Document_Html); - $this->assertTrue(array_values($doc2->getLinks()) == array('link1.html')); + $this->assertTrue(array_values($doc2->getLinks()) == ['link1.html']); } public function testDocx() diff --git a/tests/Zend/Search/Lucene/FSMTest.php b/tests/Zend/Search/Lucene/FSMTest.php index aa1138ca5e..3607e77435 100644 --- a/tests/Zend/Search/Lucene/FSMTest.php +++ b/tests/Zend/Search/Lucene/FSMTest.php @@ -85,19 +85,19 @@ public function __construct() { $this->actionTracer = new Zend_Search_Lucene_FSM_testClass(); - $this->addStates(array(self::OPENED, self::CLOSED, self::CLOSED_AND_LOCKED)); - $this->addInputSymbols(array(self::OPEN, self::CLOSE, self::LOCK, self::UNLOCK)); + $this->addStates([self::OPENED, self::CLOSED, self::CLOSED_AND_LOCKED]); + $this->addInputSymbols([self::OPEN, self::CLOSE, self::LOCK, self::UNLOCK]); $unlockAction = new Zend_Search_Lucene_FSMAction($this->actionTracer, 'action4'); $openAction = new Zend_Search_Lucene_FSMAction($this->actionTracer, 'action6'); $closeEntryAction = new Zend_Search_Lucene_FSMAction($this->actionTracer, 'action2'); $closeExitAction = new Zend_Search_Lucene_FSMAction($this->actionTracer, 'action8'); - $this->addRules(array( array(self::OPENED, self::CLOSE, self::CLOSED), - array(self::CLOSED, self::OPEN, self::OPEN), - array(self::CLOSED, self::LOCK, self::CLOSED_AND_LOCKED), - array(self::CLOSED_AND_LOCKED, self::UNLOCK, self::CLOSED, $unlockAction), - )); + $this->addRules([ [self::OPENED, self::CLOSE, self::CLOSED], + [self::CLOSED, self::OPEN, self::OPEN], + [self::CLOSED, self::LOCK, self::CLOSED_AND_LOCKED], + [self::CLOSED_AND_LOCKED, self::UNLOCK, self::CLOSED, $unlockAction], + ]); $this->addInputAction(self::CLOSED_AND_LOCKED, self::UNLOCK, $unlockAction); diff --git a/tests/Zend/Search/Lucene/Index/SegmentInfoTest.php b/tests/Zend/Search/Lucene/Index/SegmentInfoTest.php index 13afea265f..4862090c06 100644 --- a/tests/Zend/Search/Lucene/Index/SegmentInfoTest.php +++ b/tests/Zend/Search/Lucene/Index/SegmentInfoTest.php @@ -98,8 +98,8 @@ public function testGetFields() $directory = new Zend_Search_Lucene_Storage_Directory_Filesystem(dirname(__FILE__) . '/_source/_files'); $segmentInfo = new Zend_Search_Lucene_Index_SegmentInfo($directory, '_1', 2); - $this->assertTrue($segmentInfo->getFields() == array('path' => 'path', 'modified' => 'modified', 'contents' => 'contents')); - $this->assertTrue($segmentInfo->getFields(true) == array('path' => 'path', 'modified' => 'modified', 'contents' => 'contents')); + $this->assertTrue($segmentInfo->getFields() == ['path' => 'path', 'modified' => 'modified', 'contents' => 'contents']); + $this->assertTrue($segmentInfo->getFields(true) == ['path' => 'path', 'modified' => 'modified', 'contents' => 'contents']); } public function testGetFieldInfos() @@ -177,10 +177,10 @@ public function testTermFreqs() $segmentInfo = new Zend_Search_Lucene_Index_SegmentInfo($directory, '_1', 2); $termPositions = $segmentInfo->termFreqs(new Zend_Search_Lucene_Index_Term('bgcolor', 'contents')); - $this->assertTrue($termPositions == array(0 => 3, 1 => 1)); + $this->assertTrue($termPositions == [0 => 3, 1 => 1]); $termPositions = $segmentInfo->termFreqs(new Zend_Search_Lucene_Index_Term('bgcolor', 'contents'), 10); - $this->assertTrue($termPositions == array(10 => 3, 11 => 1)); + $this->assertTrue($termPositions == [10 => 3, 11 => 1]); } public function testTermPositions() @@ -189,14 +189,14 @@ public function testTermPositions() $segmentInfo = new Zend_Search_Lucene_Index_SegmentInfo($directory, '_1', 2); $termPositions = $segmentInfo->termPositions(new Zend_Search_Lucene_Index_Term('bgcolor', 'contents')); - $this->assertTrue($termPositions == array(0 => array(69, 239, 370), - 1 => array(58) - )); + $this->assertTrue($termPositions == [0 => [69, 239, 370], + 1 => [58] + ]); $termPositions = $segmentInfo->termPositions(new Zend_Search_Lucene_Index_Term('bgcolor', 'contents'), 10); - $this->assertTrue($termPositions == array(10 => array(69, 239, 370), - 11 => array(58) - )); + $this->assertTrue($termPositions == [10 => [69, 239, 370], + 11 => [58] + ]); } public function testNorm() @@ -278,7 +278,7 @@ public function testTermStreamStyleReading() $this->assertEquals($segmentInfo->resetTermsStream(6, Zend_Search_Lucene_Index_SegmentInfo::SM_FULL_INFO), 8); - $terms = array(); + $terms = []; $terms[] = $segmentInfo->currentTerm(); $firstTermPositions = $segmentInfo->currentTermPositions(); @@ -289,15 +289,15 @@ public function testTermStreamStyleReading() $this->assertEquals(key($firstTermPositions), 7); $this->assertTrue(current($firstTermPositions) == - array(105, 113, 130, 138, 153, 168, 171, 216, 243, 253, 258, 265, 302, 324, - 331, 351, 359, 366, 370, 376, 402, 410, 418, 425, 433, 441, 460, 467)); + [105, 113, 130, 138, 153, 168, 171, 216, 243, 253, 258, 265, 302, 324, + 331, 351, 359, 366, 370, 376, 402, 410, 418, 425, 433, 441, 460, 467]); while (($term = $segmentInfo->nextTerm()) != null) { $terms[] = $term; } $this->assertTrue($terms == - array(new Zend_Search_Lucene_Index_Term('a', 'contents'), + [new Zend_Search_Lucene_Index_Term('a', 'contents'), new Zend_Search_Lucene_Index_Term('about', 'contents'), new Zend_Search_Lucene_Index_Term('accesskey', 'contents'), new Zend_Search_Lucene_Index_Term('align', 'contents'), @@ -458,7 +458,7 @@ public function testTermStreamStyleReading() new Zend_Search_Lucene_Index_Term('html', 'path'), new Zend_Search_Lucene_Index_Term('indexsource', 'path'), new Zend_Search_Lucene_Index_Term('newpackage', 'path'), - )); + ]); unset($segmentInfo); @@ -477,7 +477,7 @@ public function testTermStreamStyleReadingSkipTo() $segmentInfo->skipTo(new Zend_Search_Lucene_Index_Term('prefetch', 'contents')); - $terms = array(); + $terms = []; $terms[] = $segmentInfo->currentTerm(); $firstTermPositions = $segmentInfo->currentTermPositions(); @@ -486,14 +486,14 @@ public function testTermStreamStyleReadingSkipTo() reset($firstTermPositions); // go to the first element $this->assertEquals(key($firstTermPositions), 7); - $this->assertTrue(current($firstTermPositions) == array(112, 409)); + $this->assertTrue(current($firstTermPositions) == [112, 409]); while (($term = $segmentInfo->nextTerm()) != null) { $terms[] = $term; } $this->assertTrue($terms == - array(new Zend_Search_Lucene_Index_Term('prev', 'contents'), + [new Zend_Search_Lucene_Index_Term('prev', 'contents'), new Zend_Search_Lucene_Index_Term('previous', 'contents'), new Zend_Search_Lucene_Index_Term('proper', 'contents'), new Zend_Search_Lucene_Index_Term('quote', 'contents'), @@ -550,7 +550,7 @@ public function testTermStreamStyleReadingSkipTo() new Zend_Search_Lucene_Index_Term('html', 'path'), new Zend_Search_Lucene_Index_Term('indexsource', 'path'), new Zend_Search_Lucene_Index_Term('newpackage', 'path'), - )); + ]); unset($segmentInfo); diff --git a/tests/Zend/Search/Lucene/Index/SegmentMergerTest.php b/tests/Zend/Search/Lucene/Index/SegmentMergerTest.php index ccfaf4b4bc..a79ecba682 100644 --- a/tests/Zend/Search/Lucene/Index/SegmentMergerTest.php +++ b/tests/Zend/Search/Lucene/Index/SegmentMergerTest.php @@ -50,7 +50,7 @@ public function testMerge() { $segmentsDirectory = new Zend_Search_Lucene_Storage_Directory_Filesystem(dirname(__FILE__) . '/_source/_files'); $outputDirectory = new Zend_Search_Lucene_Storage_Directory_Filesystem(dirname(__FILE__) . '/_files'); - $segmentsList = array('_0', '_1', '_2', '_3', '_4'); + $segmentsList = ['_0', '_1', '_2', '_3', '_4']; $segmentMerger = new Zend_Search_Lucene_Index_SegmentMerger($outputDirectory, 'mergedSegment'); diff --git a/tests/Zend/Search/Lucene/Index/TermsPriorityQueueTest.php b/tests/Zend/Search/Lucene/Index/TermsPriorityQueueTest.php index f259183786..a525069080 100644 --- a/tests/Zend/Search/Lucene/Index/TermsPriorityQueueTest.php +++ b/tests/Zend/Search/Lucene/Index/TermsPriorityQueueTest.php @@ -48,7 +48,7 @@ class Zend_Search_Lucene_Index_TermsPriorityQueueTest extends PHPUnit_Framework_ public function testQueue() { $directory = new Zend_Search_Lucene_Storage_Directory_Filesystem(dirname(__FILE__) . '/_source/_files'); - $segmentsList = array('_0', '_1', '_2', '_3', '_4'); + $segmentsList = ['_0', '_1', '_2', '_3', '_4']; $segmentInfoQueue = new Zend_Search_Lucene_Index_TermsPriorityQueue(); @@ -62,7 +62,7 @@ public function testQueue() } } - $result = array(); + $result = []; while (($segmentInfo = $segmentInfoQueue->pop()) !== null) { if ($segmentInfoQueue->top() === null || $segmentInfoQueue->top()->currentTerm()->key() != @@ -80,7 +80,7 @@ public function testQueue() } $this->assertTrue($result == - array(new Zend_Search_Lucene_Index_Term('a', 'contents'), + [new Zend_Search_Lucene_Index_Term('a', 'contents'), new Zend_Search_Lucene_Index_Term('about', 'contents'), new Zend_Search_Lucene_Index_Term('above', 'contents'), new Zend_Search_Lucene_Index_Term('absolutely', 'contents'), @@ -687,7 +687,7 @@ public function testQueue() new Zend_Search_Lucene_Index_Term('patches', 'path'), new Zend_Search_Lucene_Index_Term('pear', 'path'), new Zend_Search_Lucene_Index_Term('wishlist', 'path') - )); + ]); } } diff --git a/tests/Zend/Search/Lucene/LuceneTest.php b/tests/Zend/Search/Lucene/LuceneTest.php index 4c8408112e..aeff0dcfc0 100644 --- a/tests/Zend/Search/Lucene/LuceneTest.php +++ b/tests/Zend/Search/Lucene/LuceneTest.php @@ -177,7 +177,7 @@ public function testGetFieldNames() { $index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_indexSample/_files'); - $this->assertTrue(array_values($index->getFieldNames()) == array('path', 'modified', 'contents')); + $this->assertTrue(array_values($index->getFieldNames()) == ['path', 'modified', 'contents']); } public function testGetDocument() @@ -203,7 +203,7 @@ public function testTermDocs() $index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_indexSample/_files'); $this->assertTrue(array_values( $index->termDocs(new Zend_Search_Lucene_Index_Term('packages', 'contents')) ) == - array(0, 2, 6, 7, 8)); + [0, 2, 6, 7, 8]); } public function testTermPositions() @@ -211,11 +211,11 @@ public function testTermPositions() $index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_indexSample/_files'); $this->assertTrue($index->termPositions(new Zend_Search_Lucene_Index_Term('packages', 'contents')) == - array(0 => array(174), - 2 => array(40, 742), - 6 => array(6, 156, 163), - 7 => array(194), - 8 => array(55, 190, 405))); + [0 => [174], + 2 => [40, 742], + 6 => [6, 156, 163], + 7 => [194], + 8 => [55, 190, 405]]); } public function testDocFreq() @@ -398,7 +398,7 @@ public function testTermsStreamInterface() { $index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_indexSample/_files'); - $terms = array(); + $terms = []; $index->resetTermsStream(); while ($index->currentTerm() !== null) { @@ -413,7 +413,7 @@ public function testTermsStreamInterfaceSkipTo() { $index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_indexSample/_files'); - $terms = array(); + $terms = []; $index->resetTermsStream(); $index->skipTo(new Zend_Search_Lucene_Index_Term('one', 'contents')); @@ -430,7 +430,7 @@ public function testTermsStreamInterfaceSkipToTermsRetrieving() { $index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_indexSample/_files'); - $terms = array(); + $terms = []; $index->resetTermsStream(); $index->skipTo(new Zend_Search_Lucene_Index_Term('one', 'contents')); @@ -442,10 +442,10 @@ public function testTermsStreamInterfaceSkipToTermsRetrieving() $index->closeTermsStream(); $this->assertTrue($terms == - array(new Zend_Search_Lucene_Index_Term('one', 'contents'), + [new Zend_Search_Lucene_Index_Term('one', 'contents'), new Zend_Search_Lucene_Index_Term('only', 'contents'), new Zend_Search_Lucene_Index_Term('open', 'contents'), - )); + ]); } public function testTermsStreamInterfaceSkipToTermsRetrievingZeroTermsCase() diff --git a/tests/Zend/Search/Lucene/Search23Test.php b/tests/Zend/Search/Lucene/Search23Test.php index e10dee1d82..8451878fe0 100755 --- a/tests/Zend/Search/Lucene/Search23Test.php +++ b/tests/Zend/Search/Lucene/Search23Test.php @@ -43,7 +43,7 @@ public function testQueryParser() $defaultPrefixLength = Zend_Search_Lucene_Search_Query_Fuzzy::getDefaultPrefixLength(); Zend_Search_Lucene_Search_Query_Fuzzy::setDefaultPrefixLength(0); - $queries = array('title:"The Right Way" AND text:go', + $queries = ['title:"The Right Way" AND text:go', 'title:"Do it right" AND right', 'title:Do it right', 'te?t', @@ -78,9 +78,9 @@ public function testQueryParser() '+contents:apache +type:1 +id:5', 'contents:apache AND type:1 AND id:5', 'f1:word1 f1:word2 and f1:word3', - 'f1:word1 not f1:word2 and f1:word3'); + 'f1:word1 not f1:word2 and f1:word3']; - $rewrittenQueries = array('+(title:"the right way") +(text:go)', + $rewrittenQueries = ['+(title:"the right way") +(text:go)', '+(title:"do it right") +(pathkeyword:right path:right modified:right contents:right)', '(title:do) (pathkeyword:it path:it modified:it contents:it) (pathkeyword:right path:right modified:right contents:right)', '(contents:test contents:text)', @@ -115,7 +115,7 @@ public function testQueryParser() '+(contents:apache) +() +()', '+(contents:apache) +() +()', '(f1:word) (+(f1:word) +(f1:word))', - '(f1:word) (-(f1:word) +(f1:word))'); + '(f1:word) (-(f1:word) +(f1:word))']; $index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_index23Sample/_files'); @@ -175,9 +175,9 @@ public function testTermQuery() $hits = $index->find('submitting'); $this->assertEquals(count($hits), 3); - $expectedResultset = array(array(2, 0.114555, 'IndexSource/contributing.patches.html'), - array(7, 0.112241, 'IndexSource/contributing.bugs.html'), - array(8, 0.112241, 'IndexSource/contributing.html')); + $expectedResultset = [[2, 0.114555, 'IndexSource/contributing.patches.html'], + [7, 0.112241, 'IndexSource/contributing.bugs.html'], + [8, 0.112241, 'IndexSource/contributing.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -206,10 +206,10 @@ public function testPraseQuery() $hits = $index->find('"reporting bugs"'); $this->assertEquals(count($hits), 4); - $expectedResultset = array(array(0, 0.247795, 'IndexSource/contributing.documentation.html'), - array(7, 0.212395, 'IndexSource/contributing.bugs.html'), - array(8, 0.212395, 'IndexSource/contributing.html'), - array(2, 0.176996, 'IndexSource/contributing.patches.html')); + $expectedResultset = [[0, 0.247795, 'IndexSource/contributing.documentation.html'], + [7, 0.212395, 'IndexSource/contributing.bugs.html'], + [8, 0.212395, 'IndexSource/contributing.html'], + [2, 0.176996, 'IndexSource/contributing.patches.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -234,7 +234,7 @@ public function testQueryParserKeywordsHandlingPhrase() $hits = $index->find('"IndexSource/contributing.bugs.html"'); $this->assertEquals(count($hits), 1); - $expectedResultset = array(array(7, 1, 'IndexSource/contributing.bugs.html')); + $expectedResultset = [[7, 1, 'IndexSource/contributing.bugs.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -259,15 +259,15 @@ public function testQueryParserKeywordsHandlingTerm() $hits = $index->find('IndexSource\/contributing\.wishlist\.html AND Home'); $this->assertEquals(count($hits), 9); - $expectedResultset = array(array(1, 1.000000, 'IndexSource/contributing.wishlist.html'), - array(8, 0.167593, 'IndexSource/contributing.html'), - array(0, 0.154047, 'IndexSource/contributing.documentation.html'), - array(7, 0.108574, 'IndexSource/contributing.bugs.html'), - array(2, 0.104248, 'IndexSource/contributing.patches.html'), - array(3, 0.048998, 'IndexSource/about-pear.html'), - array(9, 0.039942, 'IndexSource/core.html'), - array(5, 0.038530, 'IndexSource/authors.html'), - array(4, 0.036261, 'IndexSource/copyright.html')); + $expectedResultset = [[1, 1.000000, 'IndexSource/contributing.wishlist.html'], + [8, 0.167593, 'IndexSource/contributing.html'], + [0, 0.154047, 'IndexSource/contributing.documentation.html'], + [7, 0.108574, 'IndexSource/contributing.bugs.html'], + [2, 0.104248, 'IndexSource/contributing.patches.html'], + [3, 0.048998, 'IndexSource/about-pear.html'], + [9, 0.039942, 'IndexSource/core.html'], + [5, 0.038530, 'IndexSource/authors.html'], + [4, 0.036261, 'IndexSource/copyright.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -283,8 +283,8 @@ public function testBooleanQuery() $hits = $index->find('submitting AND (wishlists OR requirements)'); $this->assertEquals(count($hits), 2); - $expectedResultset = array(array(7, 0.095697, 'IndexSource/contributing.bugs.html'), - array(8, 0.075573, 'IndexSource/contributing.html')); + $expectedResultset = [[7, 0.095697, 'IndexSource/contributing.bugs.html'], + [8, 0.075573, 'IndexSource/contributing.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -300,7 +300,7 @@ public function testBooleanQueryWithPhraseSubquery() $hits = $index->find('"PEAR developers" AND Home'); $this->assertEquals(count($hits), 1); - $expectedResultset = array(array(1, 0.168270, 'IndexSource/contributing.wishlist.html')); + $expectedResultset = [[1, 0.168270, 'IndexSource/contributing.wishlist.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -331,7 +331,7 @@ public function testFilteredTokensQueryParserProcessing() $hits = $index->find('"PEAR developers" AND Home AND 123456787654321'); $this->assertEquals(count($hits), 1); - $expectedResultset = array(array(1, 0.168270, 'IndexSource/contributing.wishlist.html')); + $expectedResultset = [[1, 0.168270, 'IndexSource/contributing.wishlist.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -350,15 +350,15 @@ public function testWildcardQuery() $hits = $index->find('*cont*'); $this->assertEquals(count($hits), 9); - $expectedResultset = array(array(8, 0.328087, 'IndexSource/contributing.html'), - array(2, 0.318592, 'IndexSource/contributing.patches.html'), - array(7, 0.260137, 'IndexSource/contributing.bugs.html'), - array(0, 0.203372, 'IndexSource/contributing.documentation.html'), - array(1, 0.202366, 'IndexSource/contributing.wishlist.html'), - array(4, 0.052931, 'IndexSource/copyright.html'), - array(3, 0.017070, 'IndexSource/about-pear.html'), - array(5, 0.010150, 'IndexSource/authors.html'), - array(9, 0.003504, 'IndexSource/core.html')); + $expectedResultset = [[8, 0.328087, 'IndexSource/contributing.html'], + [2, 0.318592, 'IndexSource/contributing.patches.html'], + [7, 0.260137, 'IndexSource/contributing.bugs.html'], + [0, 0.203372, 'IndexSource/contributing.documentation.html'], + [1, 0.202366, 'IndexSource/contributing.wishlist.html'], + [4, 0.052931, 'IndexSource/copyright.html'], + [3, 0.017070, 'IndexSource/about-pear.html'], + [5, 0.010150, 'IndexSource/authors.html'], + [9, 0.003504, 'IndexSource/core.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -379,15 +379,15 @@ public function testFuzzyQuery() $hits = $index->find('tesd~0.4'); $this->assertEquals(count($hits), 9); - $expectedResultset = array(array(2, 0.037139, 'IndexSource/contributing.patches.html'), - array(0, 0.008735, 'IndexSource/contributing.documentation.html'), - array(7, 0.002449, 'IndexSource/contributing.bugs.html'), - array(1, 0.000483, 'IndexSource/contributing.wishlist.html'), - array(3, 0.000483, 'IndexSource/about-pear.html'), - array(9, 0.000483, 'IndexSource/core.html'), - array(5, 0.000414, 'IndexSource/authors.html'), - array(8, 0.000414, 'IndexSource/contributing.html'), - array(4, 0.000345, 'IndexSource/copyright.html')); + $expectedResultset = [[2, 0.037139, 'IndexSource/contributing.patches.html'], + [0, 0.008735, 'IndexSource/contributing.documentation.html'], + [7, 0.002449, 'IndexSource/contributing.bugs.html'], + [1, 0.000483, 'IndexSource/contributing.wishlist.html'], + [3, 0.000483, 'IndexSource/about-pear.html'], + [9, 0.000483, 'IndexSource/core.html'], + [5, 0.000414, 'IndexSource/authors.html'], + [8, 0.000414, 'IndexSource/contributing.html'], + [4, 0.000345, 'IndexSource/copyright.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -405,11 +405,11 @@ public function testInclusiveRangeQuery() $hits = $index->find('[xml TO zzzzz]'); $this->assertEquals(count($hits), 5); - $expectedResultset = array(array(4, 0.156366, 'IndexSource/copyright.html'), - array(2, 0.080458, 'IndexSource/contributing.patches.html'), - array(7, 0.060214, 'IndexSource/contributing.bugs.html'), - array(1, 0.009687, 'IndexSource/contributing.wishlist.html'), - array(5, 0.005871, 'IndexSource/authors.html')); + $expectedResultset = [[4, 0.156366, 'IndexSource/copyright.html'], + [2, 0.080458, 'IndexSource/contributing.patches.html'], + [7, 0.060214, 'IndexSource/contributing.bugs.html'], + [1, 0.009687, 'IndexSource/contributing.wishlist.html'], + [5, 0.005871, 'IndexSource/authors.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -425,11 +425,11 @@ public function testNonInclusiveRangeQuery() $hits = $index->find('{xml TO zzzzz}'); $this->assertEquals(count($hits), 5); - $expectedResultset = array(array(2, 0.1308671, 'IndexSource/contributing.patches.html'), - array(7, 0.0979391, 'IndexSource/contributing.bugs.html'), - array(4, 0.0633930, 'IndexSource/copyright.html'), - array(1, 0.0157556, 'IndexSource/contributing.wishlist.html'), - array(5, 0.0095493, 'IndexSource/authors.html')); + $expectedResultset = [[2, 0.1308671, 'IndexSource/contributing.patches.html'], + [7, 0.0979391, 'IndexSource/contributing.bugs.html'], + [4, 0.0633930, 'IndexSource/copyright.html'], + [1, 0.0157556, 'IndexSource/contributing.wishlist.html'], + [5, 0.0095493, 'IndexSource/authors.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -448,11 +448,11 @@ public function testDefaultSearchField() $hits = $index->find('contributing'); $this->assertEquals(count($hits), 5); - $expectedResultset = array(array(8, 0.847922, 'IndexSource/contributing.html'), - array(0, 0.678337, 'IndexSource/contributing.documentation.html'), - array(1, 0.678337, 'IndexSource/contributing.wishlist.html'), - array(2, 0.678337, 'IndexSource/contributing.patches.html'), - array(7, 0.678337, 'IndexSource/contributing.bugs.html')); + $expectedResultset = [[8, 0.847922, 'IndexSource/contributing.html'], + [0, 0.678337, 'IndexSource/contributing.documentation.html'], + [1, 0.678337, 'IndexSource/contributing.wishlist.html'], + [2, 0.678337, 'IndexSource/contributing.patches.html'], + [7, 0.678337, 'IndexSource/contributing.bugs.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -508,10 +508,10 @@ public function testSortingResult() $hits = $index->find('"reporting bugs"', 'path'); $this->assertEquals(count($hits), 4); - $expectedResultset = array(array(7, 0.212395, 'IndexSource/contributing.bugs.html'), - array(0, 0.247795, 'IndexSource/contributing.documentation.html'), - array(8, 0.212395, 'IndexSource/contributing.html'), - array(2, 0.176996, 'IndexSource/contributing.patches.html')); + $expectedResultset = [[7, 0.212395, 'IndexSource/contributing.bugs.html'], + [0, 0.247795, 'IndexSource/contributing.documentation.html'], + [8, 0.212395, 'IndexSource/contributing.html'], + [2, 0.176996, 'IndexSource/contributing.patches.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -527,10 +527,10 @@ public function testSortingResultByScore() $hits = $index->find('"reporting bugs"', 'score', SORT_NUMERIC, SORT_ASC, 'path', SORT_STRING, SORT_ASC); $this->assertEquals(count($hits), 4); - $expectedResultset = array(array(2, 0.176996, 'IndexSource/contributing.patches.html'), - array(7, 0.212395, 'IndexSource/contributing.bugs.html'), - array(8, 0.212395, 'IndexSource/contributing.html'), - array(0, 0.247795, 'IndexSource/contributing.documentation.html')); + $expectedResultset = [[2, 0.176996, 'IndexSource/contributing.patches.html'], + [7, 0.212395, 'IndexSource/contributing.bugs.html'], + [8, 0.212395, 'IndexSource/contributing.html'], + [0, 0.247795, 'IndexSource/contributing.documentation.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -541,10 +541,10 @@ public function testSortingResultByScore() $hits = $index->find('"reporting bugs"', 'score', SORT_NUMERIC, SORT_ASC, 'path', SORT_STRING, SORT_DESC); $this->assertEquals(count($hits), 4); - $expectedResultset = array(array(2, 0.176996, 'IndexSource/contributing.patches.html'), - array(8, 0.212395, 'IndexSource/contributing.html'), - array(7, 0.212395, 'IndexSource/contributing.bugs.html'), - array(0, 0.247795, 'IndexSource/contributing.documentation.html')); + $expectedResultset = [[2, 0.176996, 'IndexSource/contributing.patches.html'], + [8, 0.212395, 'IndexSource/contributing.html'], + [7, 0.212395, 'IndexSource/contributing.bugs.html'], + [0, 0.247795, 'IndexSource/contributing.documentation.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -564,9 +564,9 @@ public function testLimitingResult() $hits = $index->find('"reporting bugs"', 'path'); $this->assertEquals(count($hits), 3); - $expectedResultset = array(array(7, 0.212395, 'IndexSource/contributing.bugs.html'), - array(0, 0.247795, 'IndexSource/contributing.documentation.html'), - array(2, 0.176996, 'IndexSource/contributing.patches.html')); + $expectedResultset = [[7, 0.212395, 'IndexSource/contributing.bugs.html'], + [0, 0.247795, 'IndexSource/contributing.documentation.html'], + [2, 0.176996, 'IndexSource/contributing.patches.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); diff --git a/tests/Zend/Search/Lucene/SearchTest.php b/tests/Zend/Search/Lucene/SearchTest.php index 6dd9f952f5..94fe5b85b4 100644 --- a/tests/Zend/Search/Lucene/SearchTest.php +++ b/tests/Zend/Search/Lucene/SearchTest.php @@ -43,7 +43,7 @@ public function testQueryParser() $defaultPrefixLength = Zend_Search_Lucene_Search_Query_Fuzzy::getDefaultPrefixLength(); Zend_Search_Lucene_Search_Query_Fuzzy::setDefaultPrefixLength(0); - $queries = array('title:"The Right Way" AND text:go', + $queries = ['title:"The Right Way" AND text:go', 'title:"Do it right" AND right', 'title:Do it right', 'te?t', @@ -79,9 +79,9 @@ public function testQueryParser() 'contents:apache AND type:1 AND id:5', 'f1:word1 f1:word2 and f1:word3', 'f1:word1 not f1:word2 and f1:word3' - ); + ]; - $rewrittenQueries = array('+(title:"the right way") +(text:go)', + $rewrittenQueries = ['+(title:"the right way") +(text:go)', '+(title:"do it right") +(path:right modified:right contents:right)', '(title:do) (path:it modified:it contents:it) (path:right modified:right contents:right)', '(contents:test contents:text)', @@ -116,7 +116,7 @@ public function testQueryParser() '+(contents:apache) +() +()', '+(contents:apache) +() +()', '(f1:word) (+(f1:word) +(f1:word))', - '(f1:word) (-(f1:word) +(f1:word))'); + '(f1:word) (-(f1:word) +(f1:word))']; $index = Zend_Search_Lucene::open(dirname(__FILE__) . '/_indexSample/_files'); @@ -176,9 +176,9 @@ public function testTermQuery() $hits = $index->find('submitting'); $this->assertEquals(count($hits), 3); - $expectedResultset = array(array(2, 0.114555, 'IndexSource/contributing.patches.html'), - array(7, 0.112241, 'IndexSource/contributing.bugs.html'), - array(8, 0.112241, 'IndexSource/contributing.html')); + $expectedResultset = [[2, 0.114555, 'IndexSource/contributing.patches.html'], + [7, 0.112241, 'IndexSource/contributing.bugs.html'], + [8, 0.112241, 'IndexSource/contributing.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -207,10 +207,10 @@ public function testPraseQuery() $hits = $index->find('"reporting bugs"'); $this->assertEquals(count($hits), 4); - $expectedResultset = array(array(0, 0.247795, 'IndexSource/contributing.documentation.html'), - array(7, 0.212395, 'IndexSource/contributing.bugs.html'), - array(8, 0.212395, 'IndexSource/contributing.html'), - array(2, 0.176996, 'IndexSource/contributing.patches.html')); + $expectedResultset = [[0, 0.247795, 'IndexSource/contributing.documentation.html'], + [7, 0.212395, 'IndexSource/contributing.bugs.html'], + [8, 0.212395, 'IndexSource/contributing.html'], + [2, 0.176996, 'IndexSource/contributing.patches.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -226,8 +226,8 @@ public function testBooleanQuery() $hits = $index->find('submitting AND (wishlists OR requirements)'); $this->assertEquals(count($hits), 2); - $expectedResultset = array(array(7, 0.095697, 'IndexSource/contributing.bugs.html'), - array(8, 0.075573, 'IndexSource/contributing.html')); + $expectedResultset = [[7, 0.095697, 'IndexSource/contributing.bugs.html'], + [8, 0.075573, 'IndexSource/contributing.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -243,7 +243,7 @@ public function testBooleanQueryWithPhraseSubquery() $hits = $index->find('"PEAR developers" AND Home'); $this->assertEquals(count($hits), 1); - $expectedResultset = array(array(1, 0.168270, 'IndexSource/contributing.wishlist.html')); + $expectedResultset = [[1, 0.168270, 'IndexSource/contributing.wishlist.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -274,7 +274,7 @@ public function testFilteredTokensQueryParserProcessing() $hits = $index->find('"PEAR developers" AND Home AND 123456787654321'); $this->assertEquals(count($hits), 1); - $expectedResultset = array(array(1, 0.168270, 'IndexSource/contributing.wishlist.html')); + $expectedResultset = [[1, 0.168270, 'IndexSource/contributing.wishlist.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -293,15 +293,15 @@ public function testWildcardQuery() $hits = $index->find('*cont*'); $this->assertEquals(count($hits), 9); - $expectedResultset = array(array(8, 0.125253, 'IndexSource/contributing.html'), - array(4, 0.112122, 'IndexSource/copyright.html'), - array(2, 0.108491, 'IndexSource/contributing.patches.html'), - array(7, 0.077716, 'IndexSource/contributing.bugs.html'), - array(0, 0.050760, 'IndexSource/contributing.documentation.html'), - array(1, 0.049163, 'IndexSource/contributing.wishlist.html'), - array(3, 0.036159, 'IndexSource/about-pear.html'), - array(5, 0.021500, 'IndexSource/authors.html'), - array(9, 0.007422, 'IndexSource/core.html')); + $expectedResultset = [[8, 0.125253, 'IndexSource/contributing.html'], + [4, 0.112122, 'IndexSource/copyright.html'], + [2, 0.108491, 'IndexSource/contributing.patches.html'], + [7, 0.077716, 'IndexSource/contributing.bugs.html'], + [0, 0.050760, 'IndexSource/contributing.documentation.html'], + [1, 0.049163, 'IndexSource/contributing.wishlist.html'], + [3, 0.036159, 'IndexSource/about-pear.html'], + [5, 0.021500, 'IndexSource/authors.html'], + [9, 0.007422, 'IndexSource/core.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -322,15 +322,15 @@ public function testFuzzyQuery() $hits = $index->find('tesd~0.4'); $this->assertEquals(count($hits), 9); - $expectedResultset = array(array(2, 0.037139, 'IndexSource/contributing.patches.html'), - array(0, 0.008735, 'IndexSource/contributing.documentation.html'), - array(7, 0.002449, 'IndexSource/contributing.bugs.html'), - array(1, 0.000483, 'IndexSource/contributing.wishlist.html'), - array(3, 0.000483, 'IndexSource/about-pear.html'), - array(9, 0.000483, 'IndexSource/core.html'), - array(5, 0.000414, 'IndexSource/authors.html'), - array(8, 0.000414, 'IndexSource/contributing.html'), - array(4, 0.000345, 'IndexSource/copyright.html')); + $expectedResultset = [[2, 0.037139, 'IndexSource/contributing.patches.html'], + [0, 0.008735, 'IndexSource/contributing.documentation.html'], + [7, 0.002449, 'IndexSource/contributing.bugs.html'], + [1, 0.000483, 'IndexSource/contributing.wishlist.html'], + [3, 0.000483, 'IndexSource/about-pear.html'], + [9, 0.000483, 'IndexSource/core.html'], + [5, 0.000414, 'IndexSource/authors.html'], + [8, 0.000414, 'IndexSource/contributing.html'], + [4, 0.000345, 'IndexSource/copyright.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -348,11 +348,11 @@ public function testInclusiveRangeQuery() $hits = $index->find('[xml TO zzzzz]'); $this->assertEquals(count($hits), 5); - $expectedResultset = array(array(4, 0.156366, 'IndexSource/copyright.html'), - array(2, 0.080458, 'IndexSource/contributing.patches.html'), - array(7, 0.060214, 'IndexSource/contributing.bugs.html'), - array(1, 0.009687, 'IndexSource/contributing.wishlist.html'), - array(5, 0.005871, 'IndexSource/authors.html')); + $expectedResultset = [[4, 0.156366, 'IndexSource/copyright.html'], + [2, 0.080458, 'IndexSource/contributing.patches.html'], + [7, 0.060214, 'IndexSource/contributing.bugs.html'], + [1, 0.009687, 'IndexSource/contributing.wishlist.html'], + [5, 0.005871, 'IndexSource/authors.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -368,11 +368,11 @@ public function testNonInclusiveRangeQuery() $hits = $index->find('{xml TO zzzzz}'); $this->assertEquals(count($hits), 5); - $expectedResultset = array(array(2, 0.1308671, 'IndexSource/contributing.patches.html'), - array(7, 0.0979391, 'IndexSource/contributing.bugs.html'), - array(4, 0.0633930, 'IndexSource/copyright.html'), - array(1, 0.0157556, 'IndexSource/contributing.wishlist.html'), - array(5, 0.0095493, 'IndexSource/authors.html')); + $expectedResultset = [[2, 0.1308671, 'IndexSource/contributing.patches.html'], + [7, 0.0979391, 'IndexSource/contributing.bugs.html'], + [4, 0.0633930, 'IndexSource/copyright.html'], + [1, 0.0157556, 'IndexSource/contributing.wishlist.html'], + [5, 0.0095493, 'IndexSource/authors.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -391,11 +391,11 @@ public function testDefaultSearchField() $hits = $index->find('contributing'); $this->assertEquals(count($hits), 5); - $expectedResultset = array(array(8, 0.847922, 'IndexSource/contributing.html'), - array(0, 0.678337, 'IndexSource/contributing.documentation.html'), - array(1, 0.678337, 'IndexSource/contributing.wishlist.html'), - array(2, 0.678337, 'IndexSource/contributing.patches.html'), - array(7, 0.678337, 'IndexSource/contributing.bugs.html')); + $expectedResultset = [[8, 0.847922, 'IndexSource/contributing.html'], + [0, 0.678337, 'IndexSource/contributing.documentation.html'], + [1, 0.678337, 'IndexSource/contributing.wishlist.html'], + [2, 0.678337, 'IndexSource/contributing.patches.html'], + [7, 0.678337, 'IndexSource/contributing.bugs.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -451,10 +451,10 @@ public function testSortingResult() $hits = $index->find('"reporting bugs"', 'path'); $this->assertEquals(count($hits), 4); - $expectedResultset = array(array(7, 0.212395, 'IndexSource/contributing.bugs.html'), - array(0, 0.247795, 'IndexSource/contributing.documentation.html'), - array(8, 0.212395, 'IndexSource/contributing.html'), - array(2, 0.176996, 'IndexSource/contributing.patches.html')); + $expectedResultset = [[7, 0.212395, 'IndexSource/contributing.bugs.html'], + [0, 0.247795, 'IndexSource/contributing.documentation.html'], + [8, 0.212395, 'IndexSource/contributing.html'], + [2, 0.176996, 'IndexSource/contributing.patches.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); @@ -474,9 +474,9 @@ public function testLimitingResult() $hits = $index->find('"reporting bugs"', 'path'); $this->assertEquals(count($hits), 3); - $expectedResultset = array(array(7, 0.212395, 'IndexSource/contributing.bugs.html'), - array(0, 0.247795, 'IndexSource/contributing.documentation.html'), - array(2, 0.176996, 'IndexSource/contributing.patches.html')); + $expectedResultset = [[7, 0.212395, 'IndexSource/contributing.bugs.html'], + [0, 0.247795, 'IndexSource/contributing.documentation.html'], + [2, 0.176996, 'IndexSource/contributing.patches.html']]; foreach ($hits as $resId => $hit) { $this->assertEquals($hit->id, $expectedResultset[$resId][0]); diff --git a/tests/Zend/Search/Lucene/Storage/DirectoryTest.php b/tests/Zend/Search/Lucene/Storage/DirectoryTest.php index eba6754a75..b35b28d4df 100644 --- a/tests/Zend/Search/Lucene/Storage/DirectoryTest.php +++ b/tests/Zend/Search/Lucene/Storage/DirectoryTest.php @@ -60,7 +60,7 @@ public function testFilesystem() unset($fileObject); $this->assertEquals($directory->fileLength('file1'), 0); - $this->assertEquals(count(array_diff($directory->fileList(), array('file1'))), 0); + $this->assertEquals(count(array_diff($directory->fileList(), ['file1'])), 0); $directory->deleteFile('file1'); $this->assertEquals(count($directory->fileList()), 0); @@ -74,7 +74,7 @@ public function testFilesystem() $this->assertEquals($directory->fileLength('file2'), 10); $directory->renameFile('file2', 'file3'); - $this->assertEquals(count(array_diff($directory->fileList(), array('file3'))), 0); + $this->assertEquals(count(array_diff($directory->fileList(), ['file3'])), 0); $modifiedAt1 = $directory->fileModified('file3'); clearstatcache(); diff --git a/tests/Zend/Serializer/Adapter/JsonTest.php b/tests/Zend/Serializer/Adapter/JsonTest.php index 2267bb0507..4af1a62ece 100644 --- a/tests/Zend/Serializer/Adapter/JsonTest.php +++ b/tests/Zend/Serializer/Adapter/JsonTest.php @@ -131,7 +131,7 @@ public function testUnserializeNumeric() public function testUnserializeAsArray() { $value = '{"test":"test"}'; - $expected = array('test' => 'test'); + $expected = ['test' => 'test']; $data = $this->_adapter->unserialize($value); $this->assertEquals($expected, $data); @@ -143,7 +143,7 @@ public function testUnserializeAsObject() $expected = new stdClass(); $expected->test = 'test'; - $data = $this->_adapter->unserialize($value, array('objectDecodeType' => Zend_Json::TYPE_OBJECT)); + $data = $this->_adapter->unserialize($value, ['objectDecodeType' => Zend_Json::TYPE_OBJECT]); $this->assertEquals($expected, $data); } diff --git a/tests/Zend/Serializer/Adapter/PythonPickleSerializeProtocol0Test.php b/tests/Zend/Serializer/Adapter/PythonPickleSerializeProtocol0Test.php index 5370d33ba2..d4419d0537 100644 --- a/tests/Zend/Serializer/Adapter/PythonPickleSerializeProtocol0Test.php +++ b/tests/Zend/Serializer/Adapter/PythonPickleSerializeProtocol0Test.php @@ -39,7 +39,7 @@ class Zend_Serializer_Adapter_PythonPickleSerializeProtocol0Test extends PHPUnit public function setUp() { - $this->_adapter = new Zend_Serializer_Adapter_PythonPickle(array('protocol' => 0)); + $this->_adapter = new Zend_Serializer_Adapter_PythonPickle(['protocol' => 0]); } public function tearDown() @@ -117,7 +117,7 @@ public function testSerializeStringWithSpecialChars() public function testSerializeArrayList() { - $value = array('1', '2', 'test'); + $value = ['1', '2', 'test']; $expected = "(lp0\r\n" . "S'1'\r\n" . "p1\r\n" @@ -133,7 +133,7 @@ public function testSerializeArrayList() public function testSerializeArrayDict() { - $value = array('1', '2', 'three' => 'test'); + $value = ['1', '2', 'three' => 'test']; $expected = "(dp0\r\n" . "I0\r\n" . "S'1'\r\n" diff --git a/tests/Zend/Serializer/Adapter/PythonPickleSerializeProtocol1Test.php b/tests/Zend/Serializer/Adapter/PythonPickleSerializeProtocol1Test.php index f25b37f88a..54549231ea 100644 --- a/tests/Zend/Serializer/Adapter/PythonPickleSerializeProtocol1Test.php +++ b/tests/Zend/Serializer/Adapter/PythonPickleSerializeProtocol1Test.php @@ -39,7 +39,7 @@ class Zend_Serializer_Adapter_PythonPickleSerializeProtocol1Test extends PHPUnit public function setUp() { - $this->_adapter = new Zend_Serializer_Adapter_PythonPickle(array('protocol' => 1)); + $this->_adapter = new Zend_Serializer_Adapter_PythonPickle(['protocol' => 1]); } public function tearDown() diff --git a/tests/Zend/Serializer/Adapter/PythonPickleUnserializeTest.php b/tests/Zend/Serializer/Adapter/PythonPickleUnserializeTest.php index 503270335d..6727cfecc5 100644 --- a/tests/Zend/Serializer/Adapter/PythonPickleUnserializeTest.php +++ b/tests/Zend/Serializer/Adapter/PythonPickleUnserializeTest.php @@ -290,7 +290,7 @@ public function testUnserializeListAppend() . "aI2\r\n" . "aI3\r\n" . "a."; - $expected = array(1,2,3); + $expected = [1,2,3]; $data = $this->_adapter->unserialize($value); $this->assertEquals($expected, $data); @@ -299,7 +299,7 @@ public function testUnserializeListAppend() public function testUnserializeEmptyListAppends() { $value = "\x80\x02]q\x00(K\x01K\x02K\x03e."; - $expected = array(1,2,3); + $expected = [1,2,3]; $data = $this->_adapter->unserialize($value); $this->assertEquals($expected, $data); @@ -317,7 +317,7 @@ public function testUnserializeDictSetItem() . "p2\r\n" . "g2\r\n" . "s."; - $expected = array('test1' => 1, 0 => 2, 'test3' => 'test3'); + $expected = ['test1' => 1, 0 => 2, 'test3' => 'test3']; $data = $this->_adapter->unserialize($value); $this->assertEquals($expected, $data); @@ -326,7 +326,7 @@ public function testUnserializeDictSetItem() public function testUnserializeEmptyDictSetItems() { $value = "\x80\x02}q\x00(U\x05test1q\x01K\x01K\x00K\x02U\x05test3q\x02h\x02u."; - $expected = array('test1' => 1, 0 => 2, 'test3' => 'test3'); + $expected = ['test1' => 1, 0 => 2, 'test3' => 'test3']; $data = $this->_adapter->unserialize($value); $this->assertEquals($expected, $data); @@ -339,7 +339,7 @@ public function testUnserializeTuple() . "I3\r\n" . "tp0\r\n" . "."; - $expected = array(1,2,3); + $expected = [1,2,3]; $data = $this->_adapter->unserialize($value); $this->assertEquals($expected, $data); @@ -348,7 +348,7 @@ public function testUnserializeTuple() public function testUnserializeTuple1() { $value = "\x80\x02K\x01\x85q\x00."; - $expected = array(1); + $expected = [1]; $data = $this->_adapter->unserialize($value); $this->assertEquals($expected, $data); @@ -357,7 +357,7 @@ public function testUnserializeTuple1() public function testUnserializeTuple2() { $value = "\x80\x02K\x01K\x02\x86q\x00."; - $expected = array(1,2); + $expected = [1,2]; $data = $this->_adapter->unserialize($value); $this->assertEquals($expected, $data); @@ -366,7 +366,7 @@ public function testUnserializeTuple2() public function testUnserializeTuple3() { $value = "\x80\x02K\x01K\x02K\x03\x87q\x00."; - $expected = array(1,2,3); + $expected = [1,2,3]; $data = $this->_adapter->unserialize($value); $this->assertEquals($expected, $data); diff --git a/tests/Zend/Serializer/Adapter/WddxTest.php b/tests/Zend/Serializer/Adapter/WddxTest.php index 48f6fdf0c6..b622194e91 100644 --- a/tests/Zend/Serializer/Adapter/WddxTest.php +++ b/tests/Zend/Serializer/Adapter/WddxTest.php @@ -63,7 +63,7 @@ public function testSerializeStringWithComment() $expected = '
      a test comment
      ' . 'test
      '; - $data = $this->_adapter->serialize($value, array('comment' => 'a test comment')); + $data = $this->_adapter->serialize($value, ['comment' => 'a test comment']); $this->assertEquals($expected, $data); } diff --git a/tests/Zend/Serializer/SerializerTest.php b/tests/Zend/Serializer/SerializerTest.php index b4230a55ae..0ff7f756bd 100644 --- a/tests/Zend/Serializer/SerializerTest.php +++ b/tests/Zend/Serializer/SerializerTest.php @@ -71,7 +71,7 @@ public function testFactoryUnknownAdapter() public function testFactoryOnADummyClassAdapter() { $this->setExpectedException('Zend_Serializer_Exception','must implement Zend_Serializer_Adapter_AdapterInterface'); - Zend_Serializer::setAdapterLoader(new Zend_Loader_PluginLoader(array('Zend_Serializer_Adapter' => dirname(__FILE__) . '/_files'))); + Zend_Serializer::setAdapterLoader(new Zend_Loader_PluginLoader(['Zend_Serializer_Adapter' => dirname(__FILE__) . '/_files'])); Zend_Serializer::factory('dummy'); } @@ -109,7 +109,7 @@ public function testSerializeSpecificAdapter() $value = 'test'; $adapter = new Zend_Serializer_Adapter_Json(); $expected = $adapter->serialize($value); - $this->assertEquals($expected, Zend_Serializer::serialize($value, array('adapter' => $adapter))); + $this->assertEquals($expected, Zend_Serializer::serialize($value, ['adapter' => $adapter])); } public function testUnserializeDefaultAdapter() @@ -126,7 +126,7 @@ public function testUnserializeSpecificAdapter() $adapter = new Zend_Serializer_Adapter_Json(); $value = '"test"'; $expected = $adapter->unserialize($value); - $this->assertEquals($expected, Zend_Serializer::unserialize($value, array('adapter' => $adapter))); + $this->assertEquals($expected, Zend_Serializer::unserialize($value, ['adapter' => $adapter])); } } diff --git a/tests/Zend/Server/DefinitionTest.php b/tests/Zend/Server/DefinitionTest.php index d918e7e295..1f27d5739d 100644 --- a/tests/Zend/Server/DefinitionTest.php +++ b/tests/Zend/Server/DefinitionTest.php @@ -90,7 +90,7 @@ public function testMethodsShouldBeEmptyArrayByDefault() public function testDefinitionShouldAllowAddingSingleMethods() { - $method = new Zend_Server_Method_Definition(array('name' => 'foo')); + $method = new Zend_Server_Method_Definition(['name' => 'foo']); $this->definition->addMethod($method); $methods = $this->definition->getMethods(); $this->assertEquals(1, count($methods)); @@ -100,9 +100,9 @@ public function testDefinitionShouldAllowAddingSingleMethods() public function testDefinitionShouldAllowAddingMultipleMethods() { - $method1 = new Zend_Server_Method_Definition(array('name' => 'foo')); - $method2 = new Zend_Server_Method_Definition(array('name' => 'bar')); - $this->definition->addMethods(array($method1, $method2)); + $method1 = new Zend_Server_Method_Definition(['name' => 'foo']); + $method2 = new Zend_Server_Method_Definition(['name' => 'bar']); + $this->definition->addMethods([$method1, $method2]); $methods = $this->definition->getMethods(); $this->assertEquals(2, count($methods)); $this->assertSame($method1, $methods['foo']); @@ -114,9 +114,9 @@ public function testDefinitionShouldAllowAddingMultipleMethods() public function testSetMethodsShouldOverwriteExistingMethods() { $this->testDefinitionShouldAllowAddingMultipleMethods(); - $method1 = new Zend_Server_Method_Definition(array('name' => 'foo')); - $method2 = new Zend_Server_Method_Definition(array('name' => 'bar')); - $methods = array($method1, $method2); + $method1 = new Zend_Server_Method_Definition(['name' => 'foo']); + $method2 = new Zend_Server_Method_Definition(['name' => 'bar']); + $methods = [$method1, $method2]; $this->assertNotEquals($methods, $this->definition->getMethods()); $this->definition->setMethods($methods); $test = $this->definition->getMethods(); @@ -152,21 +152,21 @@ public function testDefinitionShouldAllowClearingAllMethods() public function testDefinitionShouldSerializeToArray() { - $method = array( + $method = [ 'name' => 'foo.bar', - 'callback' => array( + 'callback' => [ 'type' => 'function', 'function' => 'bar', - ), - 'prototypes' => array( - array( + ], + 'prototypes' => [ + [ 'returnType' => 'string', - 'parameters' => array('string'), - ), - ), + 'parameters' => ['string'], + ], + ], 'methodHelp' => 'Foo Bar!', - 'invokeArguments' => array('foo'), - ); + 'invokeArguments' => ['foo'], + ]; $definition = new Zend_Server_Definition(); $definition->addMethod($method); $test = $definition->toArray(); @@ -180,22 +180,22 @@ public function testDefinitionShouldSerializeToArray() public function testPassingOptionsToConstructorShouldSetObjectState() { - $method = array( + $method = [ 'name' => 'foo.bar', - 'callback' => array( + 'callback' => [ 'type' => 'function', 'function' => 'bar', - ), - 'prototypes' => array( - array( + ], + 'prototypes' => [ + [ 'returnType' => 'string', - 'parameters' => array('string'), - ), - ), + 'parameters' => ['string'], + ], + ], 'methodHelp' => 'Foo Bar!', - 'invokeArguments' => array('foo'), - ); - $options = array($method); + 'invokeArguments' => ['foo'], + ]; + $options = [$method]; $definition = new Zend_Server_Definition($options); $test = $definition->toArray(); $this->assertEquals(1, count($test)); diff --git a/tests/Zend/Server/Method/CallbackTest.php b/tests/Zend/Server/Method/CallbackTest.php index 4b7a0ba740..4f24b4ac38 100644 --- a/tests/Zend/Server/Method/CallbackTest.php +++ b/tests/Zend/Server/Method/CallbackTest.php @@ -142,11 +142,11 @@ public function testCallbackShouldSerializeToArray() public function testConstructorShouldSetStateFromOptions() { - $options = array( + $options = [ 'type' => 'static', 'class' => 'Foo', 'method' => 'bar', - ); + ]; $callback = new Zend_Server_Method_Callback($options); $test = $callback->toArray(); $this->assertSame($options, $test); diff --git a/tests/Zend/Server/Method/DefinitionTest.php b/tests/Zend/Server/Method/DefinitionTest.php index f494c0bf97..b06b5a240d 100644 --- a/tests/Zend/Server/Method/DefinitionTest.php +++ b/tests/Zend/Server/Method/DefinitionTest.php @@ -93,10 +93,10 @@ public function testSetCallbackShouldAcceptMethodCallback() public function testSetCallbackShouldAcceptArray() { - $callback = array( + $callback = [ 'type' => 'function', 'function' => 'foo', - ); + ]; $this->definition->setCallback($callback); $test = $this->definition->getCallback()->toArray(); $this->assertSame($callback, $test); @@ -157,7 +157,7 @@ public function testInvokeArgumentsShouldBeEmptyArrayByDefault() public function testInvokeArgumentsShouldBeMutable() { $this->testInvokeArgumentsShouldBeEmptyArrayByDefault(); - $args = array('foo', array('bar', 'baz'), new stdClass); + $args = ['foo', ['bar', 'baz'], new stdClass]; $this->definition->setInvokeArguments($args); $this->assertSame($args, $this->definition->getInvokeArguments()); } @@ -188,7 +188,7 @@ public function testDefinitionShouldAllowAddingMultiplePrototypes() { $prototype1 = new Zend_Server_Method_Prototype; $prototype2 = new Zend_Server_Method_Prototype; - $prototypes = array($prototype1, $prototype2); + $prototypes = [$prototype1, $prototype2]; $this->definition->addPrototypes($prototypes); $this->assertSame($prototypes, $this->definition->getPrototypes()); } @@ -199,7 +199,7 @@ public function testSetPrototypesShouldOverwriteExistingPrototypes() $prototype1 = new Zend_Server_Method_Prototype; $prototype2 = new Zend_Server_Method_Prototype; - $prototypes = array($prototype1, $prototype2); + $prototypes = [$prototype1, $prototype2]; $this->assertNotSame($prototypes, $this->definition->getPrototypes()); $this->definition->setPrototypes($prototypes); $this->assertSame($prototypes, $this->definition->getPrototypes()); @@ -208,11 +208,11 @@ public function testSetPrototypesShouldOverwriteExistingPrototypes() public function testDefintionShouldSerializeToArray() { $name = 'foo.bar'; - $callback = array('function' => 'foo', 'type' => 'function'); - $prototypes = array(array('returnType' => 'struct', 'parameters' => array('string', 'array'))); + $callback = ['function' => 'foo', 'type' => 'function']; + $prototypes = [['returnType' => 'struct', 'parameters' => ['string', 'array']]]; $methodHelp = 'foo bar'; $object = new stdClass; - $invokeArgs = array('foo', array('bar', 'baz')); + $invokeArgs = ['foo', ['bar', 'baz']]; $this->definition->setName($name) ->setCallback($callback) ->setPrototypes($prototypes) @@ -230,14 +230,14 @@ public function testDefintionShouldSerializeToArray() public function testPassingOptionsToConstructorShouldSetObjectState() { - $options = array( + $options = [ 'name' => 'foo.bar', - 'callback' => array('function' => 'foo', 'type' => 'function'), - 'prototypes' => array(array('returnType' => 'struct', 'parameters' => array('string', 'array'))), + 'callback' => ['function' => 'foo', 'type' => 'function'], + 'prototypes' => [['returnType' => 'struct', 'parameters' => ['string', 'array']]], 'methodHelp' => 'foo bar', 'object' => new stdClass, - 'invokeArguments' => array('foo', array('bar', 'baz')), - ); + 'invokeArguments' => ['foo', ['bar', 'baz']], + ]; $definition = new Zend_Server_Method_Definition($options); $test = $definition->toArray(); $this->assertEquals($options['name'], $test['name']); diff --git a/tests/Zend/Server/Method/PrototypeTest.php b/tests/Zend/Server/Method/PrototypeTest.php index 43fd32ebe9..842296e7c3 100644 --- a/tests/Zend/Server/Method/PrototypeTest.php +++ b/tests/Zend/Server/Method/PrototypeTest.php @@ -109,20 +109,20 @@ public function testPrototypeShouldAllowAddingSingleParameters() public function testPrototypeShouldAllowAddingParameterObjects() { - $parameter = new Zend_Server_Method_Parameter(array( + $parameter = new Zend_Server_Method_Parameter([ 'type' => 'string', 'name' => 'foo', - )); + ]); $this->prototype->addParameter($parameter); $this->assertSame($parameter, $this->prototype->getParameter('foo')); } public function testPrototypeShouldAllowFetchingParameterByNameOrIndex() { - $parameter = new Zend_Server_Method_Parameter(array( + $parameter = new Zend_Server_Method_Parameter([ 'type' => 'string', 'name' => 'foo', - )); + ]); $this->prototype->addParameter($parameter); $test1 = $this->prototype->getParameter('foo'); $test2 = $this->prototype->getParameter(0); @@ -133,7 +133,7 @@ public function testPrototypeShouldAllowFetchingParameterByNameOrIndex() public function testPrototypeShouldAllowRetrievingParameterObjects() { - $this->prototype->addParameters(array('string', 'array')); + $this->prototype->addParameters(['string', 'array']); $parameters = $this->prototype->getParameterObjects(); foreach ($parameters as $parameter) { $this->assertTrue($parameter instanceof Zend_Server_Method_Parameter); @@ -143,10 +143,10 @@ public function testPrototypeShouldAllowRetrievingParameterObjects() public function testPrototypeShouldAllowAddingMultipleParameters() { $this->testParametersShouldBeEmptyArrayByDefault(); - $params = array( + $params = [ 'string', 'array', - ); + ]; $this->prototype->addParameters($params); $test = $this->prototype->getParameters(); $this->assertSame($params, $test); @@ -155,11 +155,11 @@ public function testPrototypeShouldAllowAddingMultipleParameters() public function testSetParametersShouldOverwriteParameters() { $this->testPrototypeShouldAllowAddingMultipleParameters(); - $params = array( + $params = [ 'bool', 'base64', 'struct', - ); + ]; $this->prototype->setParameters($params); $test = $this->prototype->getParameters(); $this->assertSame($params, $test); @@ -168,11 +168,11 @@ public function testSetParametersShouldOverwriteParameters() public function testPrototypeShouldSerializeToArray() { $return = 'string'; - $params = array( + $params = [ 'bool', 'base64', 'struct', - ); + ]; $this->prototype->setReturnType($return) ->setParameters($params); $test = $this->prototype->toArray(); @@ -182,14 +182,14 @@ public function testPrototypeShouldSerializeToArray() public function testConstructorShouldSetObjectStateFromOptions() { - $options = array( + $options = [ 'returnType' => 'string', - 'parameters' => array( + 'parameters' => [ 'bool', 'base64', 'struct', - ), - ); + ], + ]; $prototype = new Zend_Server_Method_Prototype($options); $test = $prototype->toArray(); $this->assertSame($options, $test); diff --git a/tests/Zend/Server/Reflection/FunctionTest.php b/tests/Zend/Server/Reflection/FunctionTest.php index 80ce9c640c..2cad557261 100644 --- a/tests/Zend/Server/Reflection/FunctionTest.php +++ b/tests/Zend/Server/Reflection/FunctionTest.php @@ -51,7 +51,7 @@ public function test__construct() $r = new Zend_Server_Reflection_Function($function, 'namespace'); $this->assertEquals('namespace', $r->getNamespace()); - $argv = array('string1', 'string2'); + $argv = ['string1', 'string2']; $r = new Zend_Server_Reflection_Function($function, 'namespace', $argv); $this->assertTrue(is_array($r->getInvokeArguments())); $this->assertTrue($argv === $r->getInvokeArguments()); @@ -128,7 +128,7 @@ public function testGetInvokeArguments() $this->assertTrue(is_array($args)); $this->assertEquals(0, count($args)); - $argv = array('string1', 'string2'); + $argv = ['string1', 'string2']; $r = new Zend_Server_Reflection_Function($function, null, $argv); $args = $r->getInvokeArguments(); $this->assertTrue(is_array($args)); diff --git a/tests/Zend/Server/Reflection/NodeTest.php b/tests/Zend/Server/Reflection/NodeTest.php index 2990b74fad..977373622c 100644 --- a/tests/Zend/Server/Reflection/NodeTest.php +++ b/tests/Zend/Server/Reflection/NodeTest.php @@ -107,7 +107,7 @@ public function testGetChildren() $child = $parent->createChild('array'); $children = $parent->getChildren(); - $types = array(); + $types = []; foreach ($children as $c) { $types[] = $c->getValue(); } @@ -176,18 +176,18 @@ public function testGetEndPoints() $child2grand2great2 = $child2grand2->createChild('child2grand2great2'); $endPoints = $root->getEndPoints(); - $endPointsArray = array(); + $endPointsArray = []; foreach ($endPoints as $endPoint) { $endPointsArray[] = $endPoint->getValue(); } - $test = array( + $test = [ 'child1', 'child1grand2', 'child2grand1', 'child2grand2', 'child2grand2great2' - ); + ]; $this->assertTrue($test === $endPointsArray, 'Test was [' . var_export($test, 1) . ']; endPoints were [' . var_export($endPointsArray, 1) . ']'); } diff --git a/tests/Zend/Server/Reflection/PrototypeTest.php b/tests/Zend/Server/Reflection/PrototypeTest.php index 79568c5811..d6a8a3aa14 100644 --- a/tests/Zend/Server/Reflection/PrototypeTest.php +++ b/tests/Zend/Server/Reflection/PrototypeTest.php @@ -66,7 +66,7 @@ public function setUp() $parameters = $method->getParameters(); $this->_parametersRaw = $parameters; - $fParameters = array(); + $fParameters = []; foreach ($parameters as $p) { $fParameters[] = new Zend_Server_Reflection_Parameter($p); } diff --git a/tests/Zend/Service/AkismetTest.php b/tests/Zend/Service/AkismetTest.php index ac176457d6..2c93270d23 100644 --- a/tests/Zend/Service/AkismetTest.php +++ b/tests/Zend/Service/AkismetTest.php @@ -45,18 +45,18 @@ public function setUp() { $this->akismet = new Zend_Service_Akismet('somebogusapikey', 'http://framework.zend.com/wiki/'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Akismet::setHttpClient($client); - $this->comment = array( + $this->comment = [ 'user_ip' => '71.161.221.76', 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1)', 'comment_type' => 'comment', 'comment_content' => 'spam check' - ); + ]; } public function testBlogUrl() diff --git a/tests/Zend/Service/Amazon/Authentication/S3Test.php b/tests/Zend/Service/Amazon/Authentication/S3Test.php index 302b52ef2e..aaa6b89a6c 100644 --- a/tests/Zend/Service/Amazon/Authentication/S3Test.php +++ b/tests/Zend/Service/Amazon/Authentication/S3Test.php @@ -69,7 +69,7 @@ protected function tearDown() public function testGetGeneratesCorrectSignature() { - $headers = array(); + $headers = []; $headers['Date'] = "Tue, 27 Mar 2007 19:36:42 +0000"; $ret = $this->Zend_Service_Amazon_Authentication_S3->generateSignature('GET', 'http://s3.amazonaws.com/johnsmith/photos/puppy.jpg', $headers); @@ -84,7 +84,7 @@ public function testGetGeneratesCorrectSignature() public function testPutGeneratesCorrectSignature() { - $headers = array(); + $headers = []; $headers['Date'] = "Tue, 27 Mar 2007 21:15:45 +0000"; $headers['Content-Type'] = "image/jpeg"; $headers['Content-Length'] = 94328; @@ -101,7 +101,7 @@ public function testPutGeneratesCorrectSignature() public function testListGeneratesCorrectSignature() { - $headers = array(); + $headers = []; $headers['Date'] = "Tue, 27 Mar 2007 19:42:41 +0000"; $ret = $this->Zend_Service_Amazon_Authentication_S3->generateSignature('GET', 'http://s3.amazonaws.com/johnsmith/?prefix=photos&max-keys=50&marker=puppy', $headers); @@ -116,7 +116,7 @@ public function testListGeneratesCorrectSignature() public function testFetchGeneratesCorrectSignature() { - $headers = array(); + $headers = []; $headers['Date'] = "Tue, 27 Mar 2007 19:44:46 +0000"; $ret = $this->Zend_Service_Amazon_Authentication_S3->generateSignature('GET', 'http://s3.amazonaws.com/johnsmith/?acl', $headers); @@ -132,7 +132,7 @@ public function testFetchGeneratesCorrectSignature() public function testDeleteGeneratesCorrectSignature() { - $headers = array(); + $headers = []; $headers['x-amz-date'] = "Tue, 27 Mar 2007 21:20:26 +0000"; $ret = $this->Zend_Service_Amazon_Authentication_S3->generateSignature('DELETE', 'http://s3.amazonaws.com/johnsmith/photos/puppy.jpg', $headers); @@ -148,7 +148,7 @@ public function testDeleteGeneratesCorrectSignature() public function testUploadGeneratesCorrectSignature() { - $headers = array(); + $headers = []; $headers['Date'] = "Tue, 27 Mar 2007 21:06:08 +0000"; $headers['x-amz-acl'] = "public-read"; $headers['content-type'] = "application/x-download"; diff --git a/tests/Zend/Service/Amazon/Authentication/V1Test.php b/tests/Zend/Service/Amazon/Authentication/V1Test.php index 573753cdd0..5d3720ab1f 100644 --- a/tests/Zend/Service/Amazon/Authentication/V1Test.php +++ b/tests/Zend/Service/Amazon/Authentication/V1Test.php @@ -65,7 +65,7 @@ protected function tearDown() public function testGenerateDevPaySignature() { $url = "https://ls.amazonaws.com/"; - $params = array(); + $params = []; $params['Action'] = "ActivateHostedProduct"; $params['Timestamp'] = "2009-11-11T13:52:38Z"; diff --git a/tests/Zend/Service/Amazon/Authentication/V2Test.php b/tests/Zend/Service/Amazon/Authentication/V2Test.php index f8388864e6..9199439205 100644 --- a/tests/Zend/Service/Amazon/Authentication/V2Test.php +++ b/tests/Zend/Service/Amazon/Authentication/V2Test.php @@ -65,7 +65,7 @@ protected function tearDown() public function testGenerateEc2PostSignature() { $url = "https://ec2.amazonaws.com/"; - $params = array(); + $params = []; $params['Action'] = "DescribeImages"; $params['ImageId.1'] = "ami-2bb65342"; $params['Timestamp'] = "2009-11-11T13:52:38Z"; @@ -79,7 +79,7 @@ public function testGenerateEc2PostSignature() public function testGenerateSqsGetSignature() { $url = "https://queue.amazonaws.com/770098461991/queue2"; - $params = array(); + $params = []; $params['Action'] = "SetQueueAttributes"; $params['Attribute.Name'] = "VisibilityTimeout"; $params['Attribute.Value'] = "90"; diff --git a/tests/Zend/Service/Amazon/Ec2/AbstractTest.php b/tests/Zend/Service/Amazon/Ec2/AbstractTest.php index d8f539fc85..ec365fabb3 100644 --- a/tests/Zend/Service/Amazon/Ec2/AbstractTest.php +++ b/tests/Zend/Service/Amazon/Ec2/AbstractTest.php @@ -81,7 +81,7 @@ public function testSetInvalidRegionThrowsException() public function testSignParamsWithSpaceEncodesWithPercentInsteadOfPlus() { $class = new TestAmamzonEc2Abstract('TestAccessKey', 'TestSecretKey'); - $ret = $class->testSign(array('Action' => 'Space Test')); + $ret = $class->testSign(['Action' => 'Space Test']); // this is the encode signuature with urlencode - It's Invalid! $invalidSignature = 'EeHAfo7cMcLyvH4SW4fEpjo51xJJ4ES1gdjRPxZTlto='; diff --git a/tests/Zend/Service/Amazon/Ec2/AvailabilityzonesTest.php b/tests/Zend/Service/Amazon/Ec2/AvailabilityzonesTest.php index f1773c1ecd..e069281ed9 100644 --- a/tests/Zend/Service/Amazon/Ec2/AvailabilityzonesTest.php +++ b/tests/Zend/Service/Amazon/Ec2/AvailabilityzonesTest.php @@ -54,9 +54,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Availabilityzones = new Zend_Service_Amazon_Ec2_Availabilityzones('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Availabilityzones::setHttpClient($client); @@ -134,7 +134,7 @@ public function testDescribeMultipleAvailabilityZones() $this->assertTrue(is_array($response)); - $arrExpected = array('us-east-1a', 'us-east-1b', 'us-east-1c'); + $arrExpected = ['us-east-1a', 'us-east-1b', 'us-east-1c']; foreach ($response as $k => $node) { $this->assertEquals($arrExpected[$k], $node['zoneName']); } diff --git a/tests/Zend/Service/Amazon/Ec2/CloudWatchTest.php b/tests/Zend/Service/Amazon/Ec2/CloudWatchTest.php index 85a9c34f0a..597cda65bd 100644 --- a/tests/Zend/Service/Amazon/Ec2/CloudWatchTest.php +++ b/tests/Zend/Service/Amazon/Ec2/CloudWatchTest.php @@ -52,9 +52,9 @@ protected function setUp() parent::setUp(); $this->Zend_Service_Amazon_Ec2_CloudWatch = new Zend_Service_Amazon_Ec2_CloudWatch('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_CloudWatch::setHttpClient($client); } @@ -105,25 +105,25 @@ public function testGetMetricStatistics() ."\r\n"; $this->adapter->setResponse($rawHttpResponse); - $return = $this->Zend_Service_Amazon_Ec2_CloudWatch->getMetricStatistics(array('MeasureName' => 'NetworkIn', 'Statistics' => array('Average'))); + $return = $this->Zend_Service_Amazon_Ec2_CloudWatch->getMetricStatistics(['MeasureName' => 'NetworkIn', 'Statistics' => ['Average']]); - $arrReturn = array( + $arrReturn = [ 'label' => 'NetworkIn', - 'datapoints' => array( - array( + 'datapoints' => [ + [ 'Timestamp' => '2009-06-16T23:57:00Z', 'Unit' => 'Bytes', 'Samples' => '1.0', 'Average' => '14838.0', - ), - array( + ], + [ 'Timestamp' => '2009-06-17T00:16:00Z', 'Unit' => 'Bytes', 'Samples' => '1.0', 'Average' => '18251.0', - ) - ) - ); + ] + ] + ]; $this->assertSame($arrReturn, $return); @@ -178,29 +178,29 @@ public function testListMetrics() $return = $this->Zend_Service_Amazon_Ec2_CloudWatch->listMetrics(); - $arrReturn = array( - array( + $arrReturn = [ + [ 'MeasureName' => 'NetworkIn', 'Namespace' => 'AWS/EC2', - 'Deminsions' => array( + 'Deminsions' => [ 'name' => 'InstanceId', 'value' => 'i-bec576d7' - ) - ), - array( + ] + ], + [ 'MeasureName' => 'CPUUtilization', 'Namespace' => 'AWS/EC2', - 'Deminsions' => array( + 'Deminsions' => [ 'name' => 'InstanceId', 'value' => 'i-bec576d7' - ) - ), - array( + ] + ], + [ 'MeasureName' => 'NetworkIn', 'Namespace' => 'AWS/EC2', - 'Deminsions' => array() - ) - ); + 'Deminsions' => [] + ] + ]; $this->assertSame($arrReturn, $return); } @@ -260,56 +260,56 @@ public function testZF8149() $this->adapter->setResponse($rawHttpResponse); $return = $this->Zend_Service_Amazon_Ec2_CloudWatch->getMetricStatistics( - array( + [ 'MeasureName' => 'CPUUtilization', - 'Statistics' => array('Average'), - 'Dimensions'=> array('InstanceId'=>'i-93ba31fa'), + 'Statistics' => ['Average'], + 'Dimensions'=> ['InstanceId'=>'i-93ba31fa'], 'StartTime'=> '2009-11-19T21:51:57+00:00', 'EndTime'=> '2009-11-19T21:56:57+00:00' - ) + ] ); - $arrReturn = array ( + $arrReturn = [ 'label' => 'CPUUtilization', 'datapoints' => - array ( + [ 0 => - array ( + [ 'Timestamp' => '2009-11-19T21:52:00Z', 'Unit' => 'Percent', 'Samples' => '1.0', 'Average' => '0.09', - ), + ], 1 => - array ( + [ 'Timestamp' => '2009-11-19T21:55:00Z', 'Unit' => 'Percent', 'Samples' => '1.0', 'Average' => '0.18', - ), + ], 2 => - array ( + [ 'Timestamp' => '2009-11-19T21:54:00Z', 'Unit' => 'Percent', 'Samples' => '1.0', 'Average' => '0.09', - ), + ], 3 => - array ( + [ 'Timestamp' => '2009-11-19T21:51:00Z', 'Unit' => 'Percent', 'Samples' => '1.0', 'Average' => '0.18', - ), + ], 4 => - array ( + [ 'Timestamp' => '2009-11-19T21:53:00Z', 'Unit' => 'Percent', 'Samples' => '1.0', 'Average' => '0.09', - ), - ), - ); + ], + ], + ]; $this->assertSame($arrReturn, $return); } diff --git a/tests/Zend/Service/Amazon/Ec2/EbsTest.php b/tests/Zend/Service/Amazon/Ec2/EbsTest.php index ddd6a0d415..6af44c4a46 100644 --- a/tests/Zend/Service/Amazon/Ec2/EbsTest.php +++ b/tests/Zend/Service/Amazon/Ec2/EbsTest.php @@ -53,9 +53,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Ebs = new Zend_Service_Amazon_Ec2_Ebs('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Ebs::setHttpClient($client); } @@ -93,13 +93,13 @@ public function testAttachVolume() $return = $this->Zend_Service_Amazon_Ec2_Ebs->attachVolume('vol-4d826724', 'i-6058a509', '/dev/sdh'); - $arrAttach = array( + $arrAttach = [ 'volumeId' => 'vol-4d826724', 'instanceId' => 'i-6058a509', 'device' => '/dev/sdh', 'status' => 'attaching', 'attachTime' => '2008-05-07T11:51:50.000Z' - ); + ]; $this->assertSame($arrAttach, $return); } @@ -127,13 +127,13 @@ public function testCreateSnapshot() $return = $this->Zend_Service_Amazon_Ec2_Ebs->createSnapshot('vol-4d826724'); - $arrCreateSnapShot = array( + $arrCreateSnapShot = [ 'snapshotId' => 'snap-78a54011', 'volumeId' => 'vol-4d826724', 'status' => 'pending', 'startTime' => '2008-05-07T11:51:50.000Z', 'progress' => '' - ); + ]; $this->assertSame($arrCreateSnapShot, $return); @@ -162,13 +162,13 @@ public function testCreateNewVolume() $return = $this->Zend_Service_Amazon_Ec2_Ebs->createNewVolume(400, 'us-east-1a'); - $arrCreateNewVolume = array( + $arrCreateNewVolume = [ 'volumeId' => 'vol-4d826724', 'size' => '400', 'status' => 'creating', 'createTime' => '2008-05-07T11:51:50.000Z', 'availabilityZone' => 'us-east-1a' - ); + ]; $this->assertSame($arrCreateNewVolume, $return); @@ -197,14 +197,14 @@ public function testCreateVolumeFromSnapshot() $return = $this->Zend_Service_Amazon_Ec2_Ebs->createVolumeFromSnapshot('snap-78a54011', 'us-east-1a'); - $arrCreateNewVolume = array( + $arrCreateNewVolume = [ 'volumeId' => 'vol-4d826724', 'size' => '400', 'status' => 'creating', 'createTime' => '2008-05-07T11:51:50.000Z', 'availabilityZone' => 'us-east-1a', 'snapshotId' => 'snap-78a54011' - ); + ]; $this->assertSame($arrCreateNewVolume, $return); @@ -283,13 +283,13 @@ public function testDescribeSingleSnapshot() $return = $this->Zend_Service_Amazon_Ec2_Ebs->describeSnapshot('snap-78a54011'); - $arrSnapshot = array(array( + $arrSnapshot = [[ 'snapshotId' => 'snap-78a54011', 'volumeId' => 'vol-4d826724', 'status' => 'pending', 'startTime' => '2008-05-07T12:51:50.000Z', 'progress' => '80%' - )); + ]]; $this->assertSame($arrSnapshot, $return); @@ -327,24 +327,24 @@ public function testDescribeMultipleSnapshots() . ""; $this->adapter->setResponse($rawHttpResponse); - $return = $this->Zend_Service_Amazon_Ec2_Ebs->describeSnapshot(array('snap-78a54011', 'snap-78a54012')); + $return = $this->Zend_Service_Amazon_Ec2_Ebs->describeSnapshot(['snap-78a54011', 'snap-78a54012']); - $arrSnapshots = array( - array( + $arrSnapshots = [ + [ 'snapshotId' => 'snap-78a54011', 'volumeId' => 'vol-4d826724', 'status' => 'pending', 'startTime' => '2008-05-07T12:51:50.000Z', 'progress' => '80%', - ), - array( + ], + [ 'snapshotId' => 'snap-78a54012', 'volumeId' => 'vol-4d826725', 'status' => 'pending', 'startTime' => '2008-08-07T12:51:50.000Z', 'progress' => '65%', - ) - ); + ] + ]; $this->assertSame($arrSnapshots, $return); @@ -390,21 +390,21 @@ public function testDescribeSingleVolume() $return = $this->Zend_Service_Amazon_Ec2_Ebs->describeVolume('vol-4282672b'); - $arrVolumes = array( - array( + $arrVolumes = [ + [ 'volumeId' => 'vol-4282672b', 'size' => '800', 'status' => 'in-use', 'createTime' => '2008-05-07T11:51:50.000Z', - 'attachmentSet' => array( + 'attachmentSet' => [ 'volumeId' => 'vol-4282672b', 'instanceId' => 'i-6058a509', 'device' => '/dev/sdh', 'status' => 'attached', 'attachTime' => '2008-05-07T12:51:50.000Z', - ) - ) - ); + ] + ] + ]; $this->assertSame($arrVolumes, $return); @@ -451,29 +451,29 @@ public function testDescribeMultipleVolume() . ""; $this->adapter->setResponse($rawHttpResponse); - $return = $this->Zend_Service_Amazon_Ec2_Ebs->describeVolume(array('vol-4282672b', 'vol-42826775')); + $return = $this->Zend_Service_Amazon_Ec2_Ebs->describeVolume(['vol-4282672b', 'vol-42826775']); - $arrVolumes = array( - array( + $arrVolumes = [ + [ 'volumeId' => 'vol-4282672b', 'size' => '800', 'status' => 'in-use', 'createTime' => '2008-05-07T11:51:50.000Z', - 'attachmentSet' => array( + 'attachmentSet' => [ 'volumeId' => 'vol-4282672b', 'instanceId' => 'i-6058a509', 'device' => '/dev/sdh', 'status' => 'attached', 'attachTime' => '2008-05-07T12:51:50.000Z', - ) - ), - array( + ] + ], + [ 'volumeId' => 'vol-42826775', 'size' => '40', 'status' => 'available', 'createTime' => '2008-08-07T11:51:50.000Z' - ) - ); + ] + ]; $this->assertSame($arrVolumes, $return); } @@ -521,21 +521,21 @@ public function testDescribeAttachedVolumes() $return = $this->Zend_Service_Amazon_Ec2_Ebs->describeAttachedVolumes('i-6058a509'); - $arrVolumes = array( - array( + $arrVolumes = [ + [ 'volumeId' => 'vol-4282672b', 'size' => '800', 'status' => 'in-use', 'createTime' => '2008-05-07T11:51:50.000Z', - 'attachmentSet' => array( + 'attachmentSet' => [ 'volumeId' => 'vol-4282672b', 'instanceId' => 'i-6058a509', 'device' => '/dev/sdh', 'status' => 'attached', 'attachTime' => '2008-05-07T12:51:50.000Z', - ) - ) - ); + ] + ] + ]; $this->assertSame($arrVolumes, $return); } @@ -565,13 +565,13 @@ public function testDetachVolume() $return = $this->Zend_Service_Amazon_Ec2_Ebs->detachVolume('vol-4d826724'); - $arrVolume = array( + $arrVolume = [ 'volumeId' => 'vol-4d826724', 'instanceId' => 'i-6058a509', 'device' => '/dev/sdh', 'status' => 'detaching', 'attachTime' => '2008-05-08T11:51:50.000Z' - ); + ]; $this->assertSame($arrVolume, $return); } diff --git a/tests/Zend/Service/Amazon/Ec2/ElasticipTest.php b/tests/Zend/Service/Amazon/Ec2/ElasticipTest.php index 1ad64cda10..1c3cec7657 100644 --- a/tests/Zend/Service/Amazon/Ec2/ElasticipTest.php +++ b/tests/Zend/Service/Amazon/Ec2/ElasticipTest.php @@ -54,9 +54,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Elasticip = new Zend_Service_Amazon_Ec2_Elasticip('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Elasticip::setHttpClient($client); @@ -142,10 +142,10 @@ public function testDescribeSingleElasticIp() $response = $this->Zend_Service_Amazon_Ec2_Elasticip->describe('67.202.55.255'); - $arrIp = array( + $arrIp = [ 'publicIp' => '67.202.55.255', 'instanceId' => 'i-ag8ga0a' - ); + ]; $this->assertSame($arrIp, $response[0]); } @@ -175,18 +175,18 @@ public function testDescribeMultipleElasticIp() . ""; $this->adapter->setResponse($rawHttpResponse); - $response = $this->Zend_Service_Amazon_Ec2_Elasticip->describe(array('67.202.55.255', '67.202.55.200')); + $response = $this->Zend_Service_Amazon_Ec2_Elasticip->describe(['67.202.55.255', '67.202.55.200']); - $arrIps = array( - array( + $arrIps = [ + [ 'publicIp' => '67.202.55.255', 'instanceId' => 'i-ag8ga0a' - ), - array( + ], + [ 'publicIp' => '67.202.55.200', 'instanceId' => 'i-aauoi9g' - ) - ); + ] + ]; foreach($response as $k => $r) { $this->assertSame($arrIps[$k], $r); diff --git a/tests/Zend/Service/Amazon/Ec2/ImageTest.php b/tests/Zend/Service/Amazon/Ec2/ImageTest.php index f1725bc680..140e8e7881 100644 --- a/tests/Zend/Service/Amazon/Ec2/ImageTest.php +++ b/tests/Zend/Service/Amazon/Ec2/ImageTest.php @@ -55,9 +55,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Image = new Zend_Service_Amazon_Ec2_Image('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Image::setHttpClient($client); } @@ -130,10 +130,10 @@ public function testDescribeSingleImageMultipleImagesByIds() . ""; $this->adapter->setResponse($rawHttpResponse); - $return = $this->Zend_Service_Amazon_Ec2_Image->describe(array('ami-be3adfd7', 'ami-be3adfd6')); + $return = $this->Zend_Service_Amazon_Ec2_Image->describe(['ami-be3adfd7', 'ami-be3adfd6']); - $arrImage = array( - array( + $arrImage = [ + [ 'imageId' => 'ami-be3adfd7', 'imageLocation' => 'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml', 'imageState' => 'available', @@ -144,8 +144,8 @@ public function testDescribeSingleImageMultipleImagesByIds() 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'platform' => '', - ), - array( + ], + [ 'imageId' => 'ami-be3adfd6', 'imageLocation' => 'ec2-public-images/ubuntu-8.10-i386-base-v1.04.manifest.xml', 'imageState' => 'available', @@ -156,8 +156,8 @@ public function testDescribeSingleImageMultipleImagesByIds() 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'platform' => '', - ) - ); + ] + ]; $this->assertSame($arrImage, $return); } @@ -192,8 +192,8 @@ public function testDescribeSingleImageById() $return = $this->Zend_Service_Amazon_Ec2_Image->describe('ami-be3adfd7'); - $arrImage = array( - array( + $arrImage = [ + [ 'imageId' => 'ami-be3adfd7', 'imageLocation' => 'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml', 'imageState' => 'available', @@ -204,8 +204,8 @@ public function testDescribeSingleImageById() 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'platform' => '', - ) - ); + ] + ]; $this->assertSame($arrImage, $return); } @@ -249,10 +249,10 @@ public function testDescribeSingleImageMultipleImagesByOwnerId() . ""; $this->adapter->setResponse($rawHttpResponse); - $return = $this->Zend_Service_Amazon_Ec2_Image->describe(null, array('2060296256884', '206029621532')); + $return = $this->Zend_Service_Amazon_Ec2_Image->describe(null, ['2060296256884', '206029621532']); - $arrImage = array( - array( + $arrImage = [ + [ 'imageId' => 'ami-be3adfd7', 'imageLocation' => 'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml', 'imageState' => 'available', @@ -263,8 +263,8 @@ public function testDescribeSingleImageMultipleImagesByOwnerId() 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'platform' => '', - ), - array( + ], + [ 'imageId' => 'ami-be3adfd6', 'imageLocation' => 'ec2-public-images/ubuntu-8.10-i386-base-v1.04.manifest.xml', 'imageState' => 'available', @@ -275,8 +275,8 @@ public function testDescribeSingleImageMultipleImagesByOwnerId() 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'platform' => '', - ) - ); + ] + ]; $this->assertSame($arrImage, $return); } @@ -311,8 +311,8 @@ public function testDescribeSingleImageByOwnerId() $return = $this->Zend_Service_Amazon_Ec2_Image->describe(null, '206029621532'); - $arrImage = array( - array( + $arrImage = [ + [ 'imageId' => 'ami-be3adfd7', 'imageLocation' => 'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml', 'imageState' => 'available', @@ -323,8 +323,8 @@ public function testDescribeSingleImageByOwnerId() 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'platform' => '', - ) - ); + ] + ]; $this->assertSame($arrImage, $return); } @@ -368,10 +368,10 @@ public function testDescribeSingleImageMultipleImagesByExecutableBy() . ""; $this->adapter->setResponse($rawHttpResponse); - $return = $this->Zend_Service_Amazon_Ec2_Image->describe(null, null, array('46361432890', '432432265322')); + $return = $this->Zend_Service_Amazon_Ec2_Image->describe(null, null, ['46361432890', '432432265322']); - $arrImage = array( - array( + $arrImage = [ + [ 'imageId' => 'ami-be3adfd7', 'imageLocation' => 'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml', 'imageState' => 'available', @@ -382,8 +382,8 @@ public function testDescribeSingleImageMultipleImagesByExecutableBy() 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'platform' => '', - ), - array( + ], + [ 'imageId' => 'ami-be3adfd6', 'imageLocation' => 'ec2-public-images/ubuntu-8.10-i386-base-v1.04.manifest.xml', 'imageState' => 'available', @@ -394,8 +394,8 @@ public function testDescribeSingleImageMultipleImagesByExecutableBy() 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'platform' => '', - ) - ); + ] + ]; $this->assertSame($arrImage, $return); } @@ -430,8 +430,8 @@ public function testDescribeSingleImageByExecutableBy() $return = $this->Zend_Service_Amazon_Ec2_Image->describe(null, null, '46361432890'); - $arrImage = array( - array( + $arrImage = [ + [ 'imageId' => 'ami-be3adfd7', 'imageLocation' => 'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml', 'imageState' => 'available', @@ -442,8 +442,8 @@ public function testDescribeSingleImageByExecutableBy() 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'platform' => '', - ) - ); + ] + ]; $this->assertSame($arrImage, $return); } @@ -538,7 +538,7 @@ public function testModifyAttributeMultipleLaunchPermission() . "\r\n"; $this->adapter->setResponse($rawHttpResponse); - $return = $this->Zend_Service_Amazon_Ec2_Image->modifyAttribute('ami-61a54008', 'launchPermission', 'add', array('495219933132', '495219933133'), array('all', 'all')); + $return = $this->Zend_Service_Amazon_Ec2_Image->modifyAttribute('ami-61a54008', 'launchPermission', 'add', ['495219933132', '495219933133'], ['all', 'all']); $this->assertTrue($return); } diff --git a/tests/Zend/Service/Amazon/Ec2/InstanceReservedTest.php b/tests/Zend/Service/Amazon/Ec2/InstanceReservedTest.php index 6763c70607..3f0affb1cc 100644 --- a/tests/Zend/Service/Amazon/Ec2/InstanceReservedTest.php +++ b/tests/Zend/Service/Amazon/Ec2/InstanceReservedTest.php @@ -55,9 +55,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Instance_Reserved = new Zend_Service_Amazon_Ec2_Instance_Reserved('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Instance_Reserved::setHttpClient($client); @@ -106,8 +106,8 @@ public function testDescribeInstances() $return = $this->Zend_Service_Amazon_Ec2_Instance_Reserved->describeInstances('4b2293b4-5813-4cc8-9ce3-1957fc1dcfc8'); - $arrReturn = array( - array( + $arrReturn = [ + [ "reservedInstancesId" => "4b2293b4-5813-4cc8-9ce3-1957fc1dcfc8", "instanceType" => "m1.small", "availabilityZone" => "us-east-1a", @@ -117,8 +117,8 @@ public function testDescribeInstances() "productDescription" => "m1.small offering in us-east-1a", "instanceCount" => "19", "state" => "Active" - ) - ); + ] + ]; $this->assertSame($arrReturn, $return); @@ -155,8 +155,8 @@ public function testDescribeOfferings() $return = $this->Zend_Service_Amazon_Ec2_Instance_Reserved->describeOfferings(); - $arrReturn = array( - array( + $arrReturn = [ + [ "reservedInstancesOfferingId" => "4b2293b4-5813-4cc8-9ce3-1957fc1dcfc8", "instanceType" => "m1.small", "availabilityZone" => "us-east-1a", @@ -164,8 +164,8 @@ public function testDescribeOfferings() "fixedPrice" => "0.00", "usagePrice" => "0.00", "productDescription" => "m1.small offering in us-east-1a", - ) - ); + ] + ]; $this->assertSame($arrReturn, $return); diff --git a/tests/Zend/Service/Amazon/Ec2/InstanceTest.php b/tests/Zend/Service/Amazon/Ec2/InstanceTest.php index 1d03bc6515..5797126835 100644 --- a/tests/Zend/Service/Amazon/Ec2/InstanceTest.php +++ b/tests/Zend/Service/Amazon/Ec2/InstanceTest.php @@ -55,9 +55,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Instance = new Zend_Service_Amazon_Ec2_Instance('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Instance::setHttpClient($client); @@ -305,7 +305,7 @@ public function testDescribeByImageId() public function testRunThrowsExceptionWhenNoImageIdPassedIn() { - $arrStart = array( + $arrStart = [ 'maxStart' => 3, 'keyName' => 'example-key-name', 'securityGroup' => 'default', @@ -315,7 +315,7 @@ public function testRunThrowsExceptionWhenNoImageIdPassedIn() 'ramdiskId' => 'ari-4538dd2c', 'blockDeviceVirtualName' => 'vertdevice', 'blockDeviceName' => '/dev/sdv' - ); + ]; try { $return = $this->Zend_Service_Amazon_Ec2_Instance->run($arrStart); @@ -401,7 +401,7 @@ public function testRunOneSecurityGroup() $this->adapter->setResponse($rawHttpResponse); - $arrStart = array( + $arrStart = [ 'imageId' => 'ami-60a54009', 'maxStart' => 3, 'keyName' => 'example-key-name', @@ -412,14 +412,14 @@ public function testRunOneSecurityGroup() 'ramdiskId' => 'ari-4538dd2c', 'blockDeviceVirtualName' => 'vertdevice', 'blockDeviceName' => '/dev/sdv' - ); + ]; $return = $this->Zend_Service_Amazon_Ec2_Instance->run($arrStart); $this->assertEquals(3, count($return['instances'])); $this->assertEquals('495219933132', $return['ownerId']); - $arrInstanceIds = array('i-2ba64342', 'i-2bc64242', 'i-2be64332'); + $arrInstanceIds = ['i-2ba64342', 'i-2bc64242', 'i-2be64332']; foreach($return['instances'] as $k => $r) { $this->assertEquals($arrInstanceIds[$k], $r['instanceId']); @@ -472,21 +472,21 @@ public function testRunMultipleSecurityGroups() . "\r\n"; $this->adapter->setResponse($rawHttpResponse); - $arrStart = array( + $arrStart = [ 'imageId' => 'ami-60a54009', 'keyName' => 'example-key-name', - 'securityGroup' => array('default','web'), + 'securityGroup' => ['default','web'], 'userData' => 'instance_id=www3', 'placement' => 'us-east-1b', 'kernelId' => 'aki-4438dd2d', 'ramdiskId' => 'ari-4538dd2c', 'blockDeviceVirtualName' => 'vertdevice', 'blockDeviceName' => '/dev/sdv' - ); + ]; $return = $this->Zend_Service_Amazon_Ec2_Instance->run($arrStart); - $arrGroups = array('default', 'web'); + $arrGroups = ['default', 'web']; $this->assertSame($arrGroups, $return['groupSet']); } @@ -567,7 +567,7 @@ public function testTerminateMultipleInstances() . "\r\n"; $this->adapter->setResponse($rawHttpResponse); - $arrInstanceIds = array('i-28a64341', 'i-21a64348'); + $arrInstanceIds = ['i-28a64341', 'i-21a64348']; $return = $this->Zend_Service_Amazon_Ec2_Instance->terminate($arrInstanceIds); @@ -594,7 +594,7 @@ public function testRebootMultipleInstances() . "\r\n"; $this->adapter->setResponse($rawHttpResponse); - $arrInstanceIds = array('i-28a64341', 'i-21a64348'); + $arrInstanceIds = ['i-28a64341', 'i-21a64348']; $return = $this->Zend_Service_Amazon_Ec2_Instance->reboot($arrInstanceIds); $this->assertTrue($return); @@ -648,7 +648,7 @@ public function testGetConsoleOutput() $return = $this->Zend_Service_Amazon_Ec2_Instance->consoleOutput('i-28a64341'); - $arrOutput = array( + $arrOutput = [ 'instanceId' => 'i-28a64341', 'timestamp' => '2007-01-03 15:00:00', 'output' => "Linux version 2.6.16-xenU (builder@patchbat.amazonsa) (gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)) #1 SMP Thu Oct 26 08:41:26 SAST 2006\n" @@ -660,7 +660,7 @@ public function testGetConsoleOutput() . "IRQ lockup detection disabled\n" . "Built 1 zonelists\n" . "Kernel command line: root=/dev/sda1 ro 4\n" -. "Enabling fast FPU save and restore... done.\n"); +. "Enabling fast FPU save and restore... done.\n"]; $this->assertSame($arrOutput, $return); } @@ -690,7 +690,7 @@ public function testMonitorInstance() $return = $this->Zend_Service_Amazon_Ec2_Instance->monitor('i-43a4412a'); - $arrReturn = array(array('instanceid' => 'i-43a4412a', 'monitorstate' => 'monitoring')); + $arrReturn = [['instanceid' => 'i-43a4412a', 'monitorstate' => 'monitoring']]; $this->assertSame($arrReturn, $return); } @@ -719,7 +719,7 @@ public function testUnmonitorInstance() $return = $this->Zend_Service_Amazon_Ec2_Instance->unmonitor('i-43a4412a'); - $arrReturn = array(array('instanceid' => 'i-43a4412a', 'monitorstate' => 'pending')); + $arrReturn = [['instanceid' => 'i-43a4412a', 'monitorstate' => 'pending']]; $this->assertSame($arrReturn, $return); } diff --git a/tests/Zend/Service/Amazon/Ec2/InstanceWindowsTest.php b/tests/Zend/Service/Amazon/Ec2/InstanceWindowsTest.php index edcad968ec..85fe169287 100644 --- a/tests/Zend/Service/Amazon/Ec2/InstanceWindowsTest.php +++ b/tests/Zend/Service/Amazon/Ec2/InstanceWindowsTest.php @@ -55,9 +55,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Instance_Windows = new Zend_Service_Amazon_Ec2_Instance_Windows('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Instance_Windows::setHttpClient($client); } @@ -110,21 +110,20 @@ public function testBundle() print_r($return); - $arrReturn = array( + $arrReturn = [ "instanceId" => "i-12345678", "bundleId" => "bun-cla322b9", "state" => "bundling", "startTime" => "2008-10-07T11:41:50.000Z", "updateTime" => "2008-10-07T11:51:50.000Z", "progress" => "20%", - "storage" => array( - "s3" => array - ( + "storage" => [ + "s3" => [ "bucket" => "my-bucket", "prefix" => "my-new-image" - ) - ) - ); + ] + ] + ]; $this->assertSame($arrReturn, $return); @@ -164,20 +163,19 @@ public function testCancelBundle() $return = $this->Zend_Service_Amazon_Ec2_Instance_Windows->cancelBundle('bun-cla322b9'); - $arrReturn = array( "instanceId" => "i-12345678", + $arrReturn = [ "instanceId" => "i-12345678", "bundleId" => "bun-cla322b9", "state" => "canceling", "startTime" => "2008-10-07T11:41:50.000Z", "updateTime" => "2008-10-07T11:51:50.000Z", "progress" => "20%", - "storage" => array( - "s3" => array - ( + "storage" => [ + "s3" => [ "bucket" => "my-bucket", "prefix" => "my-new-image" - ) - ) - ); + ] + ] + ]; $this->assertSame($arrReturn, $return); @@ -221,23 +219,22 @@ public function testDescribeBundle() $return = $this->Zend_Service_Amazon_Ec2_Instance_Windows->describeBundle('bun-cla322b9'); - $arrReturn = array( - array( + $arrReturn = [ + [ "instanceId" => "i-12345678", "bundleId" => "bun-cla322b9", "state" => "bundling", "startTime" => "2008-10-07T11:41:50.000Z", "updateTime" => "2008-10-07T11:51:50.000Z", "progress" => "20%", - "storage" => array( - "s3" => array - ( + "storage" => [ + "s3" => [ "bucket" => "my-bucket", "prefix" => "my-new-image" - ) - ) - ) - ); + ] + ] + ] + ]; $this->assertSame($arrReturn, $return); diff --git a/tests/Zend/Service/Amazon/Ec2/KeypairTest.php b/tests/Zend/Service/Amazon/Ec2/KeypairTest.php index 0b84ec5a09..af0d09b327 100644 --- a/tests/Zend/Service/Amazon/Ec2/KeypairTest.php +++ b/tests/Zend/Service/Amazon/Ec2/KeypairTest.php @@ -54,9 +54,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Keypair = new Zend_Service_Amazon_Ec2_Keypair('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Keypair::setHttpClient($client); @@ -188,18 +188,18 @@ public function testDescribeMultipleKeyPair() . ""; $this->adapter->setResponse($rawHttpResponse); - $response = $this->Zend_Service_Amazon_Ec2_Keypair->describe(array('example-key-name', 'zend-test-key')); + $response = $this->Zend_Service_Amazon_Ec2_Keypair->describe(['example-key-name', 'zend-test-key']); - $arrKeys = array( - array( + $arrKeys = [ + [ 'keyName' => 'example-key-name', 'keyFingerprint'=> '1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f' - ), - array( + ], + [ 'keyName' => 'zend-test-key', 'keyFingerprint'=> '25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f:1f:51:ae:28:bf:89:e9:d8:1f' - ) - ); + ] + ]; foreach($response as $k => $r) { $this->assertSame($arrKeys[$k], $r); diff --git a/tests/Zend/Service/Amazon/Ec2/RegionTest.php b/tests/Zend/Service/Amazon/Ec2/RegionTest.php index 75a945e4f8..32c2b718e3 100644 --- a/tests/Zend/Service/Amazon/Ec2/RegionTest.php +++ b/tests/Zend/Service/Amazon/Ec2/RegionTest.php @@ -54,9 +54,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Region = new Zend_Service_Amazon_Ec2_Region('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Region::setHttpClient($client); @@ -97,12 +97,12 @@ public function testDescribeSingleRegion() $response = $this->Zend_Service_Amazon_Ec2_Region->describe('us-east-1'); - $arrRegion = array( - array( + $arrRegion = [ + [ 'regionName' => 'us-east-1', 'regionUrl' => 'us-east-1.ec2.amazonaws.com' - ) - ); + ] + ]; $this->assertSame($arrRegion, $response); } @@ -132,18 +132,18 @@ public function testDescribeMultipleRegions() . ""; $this->adapter->setResponse($rawHttpResponse); - $response = $this->Zend_Service_Amazon_Ec2_Region->describe(array('us-east-1','us-west-1')); + $response = $this->Zend_Service_Amazon_Ec2_Region->describe(['us-east-1','us-west-1']); - $arrRegion = array( - array( + $arrRegion = [ + [ 'regionName' => 'us-east-1', 'regionUrl' => 'us-east-1.ec2.amazonaws.com' - ), - array( + ], + [ 'regionName' => 'us-west-1', 'regionUrl' => 'us-west-1.ec2.amazonaws.com' - ) - ); + ] + ]; $this->assertSame($arrRegion, $response); } diff --git a/tests/Zend/Service/Amazon/Ec2/SecuritygroupsTest.php b/tests/Zend/Service/Amazon/Ec2/SecuritygroupsTest.php index fb62ca4589..c98b1750ce 100644 --- a/tests/Zend/Service/Amazon/Ec2/SecuritygroupsTest.php +++ b/tests/Zend/Service/Amazon/Ec2/SecuritygroupsTest.php @@ -54,9 +54,9 @@ protected function setUp() $this->Zend_Service_Amazon_Ec2_Securitygroups = new Zend_Service_Amazon_Ec2_Securitygroups('access_key', 'secret_access_key'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); $this->adapter = $adapter; Zend_Service_Amazon_Ec2_Securitygroups::setHttpClient($client); @@ -252,34 +252,34 @@ public function testDescribeMultipleSecruityGroups() . "\r\n"; $this->adapter->setResponse($rawHttpResponse); - $return = $this->Zend_Service_Amazon_Ec2_Securitygroups->describe(array('WebServers','RangedPortsBySource')); + $return = $this->Zend_Service_Amazon_Ec2_Securitygroups->describe(['WebServers','RangedPortsBySource']); $this->assertEquals(2, count($return)); - $arrGroups = array( - array( + $arrGroups = [ + [ 'ownerId' => 'UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM', 'groupName' => 'WebServers', 'groupDescription' => 'Web', - 'ipPermissions' => array(0 => array( + 'ipPermissions' => [0 => [ 'ipProtocol' => 'tcp', 'fromPort' => '80', 'toPort' => '80', 'ipRanges' => '0.0.0.0/0' - )) - ), - array( + ]] + ], + [ 'ownerId' => 'UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM', 'groupName' => 'RangedPortsBySource', 'groupDescription' => 'A', - 'ipPermissions' => array(0 => array( + 'ipPermissions' => [0 => [ 'ipProtocol' => 'tcp', 'fromPort' => '6000', 'toPort' => '7000', 'ipRanges' => '0.0.0.0/0' - )) - ) - ); + ]] + ] + ]; foreach($return as $k => $r) { $this->assertSame($arrGroups[$k], $r); } @@ -324,19 +324,19 @@ public function testDescribeSingleSecruityGroup() $this->assertEquals(1, count($return)); - $arrGroups = array( - array( + $arrGroups = [ + [ 'ownerId' => 'UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM', 'groupName' => 'WebServers', 'groupDescription' => 'Web', - 'ipPermissions' => array(0 => array( + 'ipPermissions' => [0 => [ 'ipProtocol' => 'tcp', 'fromPort' => '80', 'toPort' => '80', 'ipRanges' => '0.0.0.0/0' - )) - ) - ); + ]] + ] + ]; foreach($return as $k => $r) { $this->assertSame($arrGroups[$k], $r); } @@ -384,22 +384,22 @@ public function testDescribeSingleSecruityGroupWithMultipleIpsSamePort() $this->assertEquals(1, count($return)); - $arrGroups = array( - array( + $arrGroups = [ + [ 'ownerId' => 'UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM', 'groupName' => 'WebServers', 'groupDescription' => 'Web', - 'ipPermissions' => array(0 => array( + 'ipPermissions' => [0 => [ 'ipProtocol' => 'tcp', 'fromPort' => '80', 'toPort' => '80', - 'ipRanges' => array( + 'ipRanges' => [ '0.0.0.0/0', '1.1.1.1/0' - ) - )) - ) - ); + ] + ]] + ] + ]; foreach($return as $k => $r) { $this->assertSame($arrGroups[$k], $r); } diff --git a/tests/Zend/Service/Amazon/OfflineTest.php b/tests/Zend/Service/Amazon/OfflineTest.php index 528818385c..432513bde1 100644 --- a/tests/Zend/Service/Amazon/OfflineTest.php +++ b/tests/Zend/Service/Amazon/OfflineTest.php @@ -108,7 +108,7 @@ public function testMozardSearchFromFile() $dom = new DOMDocument(); $dom->loadXML($xml); - $mozartTracks = array( + $mozartTracks = [ 'B00005A8JZ' => '29', 'B0000058HV' => '25', 'B000BLI3K2' => '500', @@ -119,7 +119,7 @@ public function testMozardSearchFromFile() 'B00002DEH1' => '58', 'B0000041EV' => '12', 'B00004SA87' => '42', - ); + ]; $result = new Zend_Service_Amazon_ResultSet($dom); @@ -151,96 +151,96 @@ public function testFullOffersFromFile() $dom = new DOMDocument(); $dom->loadXML($xml); - $dataExpected = array( - '0439774098' => array( - 'offers' => array( - 'A79CLRHOQ3NF4' => array( + $dataExpected = [ + '0439774098' => [ + 'offers' => [ + 'A79CLRHOQ3NF4' => [ 'name' => 'PLEXSUPPLY', 'price' => '5153' - ), - 'A2K9NS8DSVOE2W' => array( + ], + 'A2K9NS8DSVOE2W' => [ 'name' => 'nangsuer', 'price' => '5153' - ), - 'A31EVTLIC13ORD' => array( + ], + 'A31EVTLIC13ORD' => [ 'name' => 'Wizard of Math', 'price' => '7599' - ), - 'A3SKJE188CW5XG' => array( + ], + 'A3SKJE188CW5XG' => [ 'name' => 'ReStockIt', 'price' => '5299' - ), - 'A1729W3053T57N' => array( + ], + 'A1729W3053T57N' => [ 'name' => 'The Price Pros', 'price' => '5487' - ), - 'A29PHU0KPCGV8S' => array( + ], + 'A29PHU0KPCGV8S' => [ 'name' => 'TheFactoryDepot', 'price' => '5821' - ), - 'AIHRRFGW11GJ8' => array( + ], + 'AIHRRFGW11GJ8' => [ 'name' => 'Design Tec Office Products', 'price' => '5987' - ), - 'A27OK403WRHSGI' => array( + ], + 'A27OK403WRHSGI' => [ 'name' => 'Kaplan Early Learning Company', 'price' => '7595' - ), - 'A25DVOZOPBFMAN' => array( + ], + 'A25DVOZOPBFMAN' => [ 'name' => 'Deerso', 'price' => '7599' - ), - 'A6IFKC796Y64H' => array( + ], + 'A6IFKC796Y64H' => [ 'name' => 'The Education Station Inc', 'price' => '7599' - ), - ), - ), - 'B00000194U' => array( - 'offers' => array( - 'A3UOG6723G7MG0' => array( + ], + ], + ], + 'B00000194U' => [ + 'offers' => [ + 'A3UOG6723G7MG0' => [ 'name' => 'Efunctional', 'price' => '480' - ), - 'A3SNNXCKUIW1O2' => array( + ], + 'A3SNNXCKUIW1O2' => [ 'name' => 'Universal Mania', 'price' => '531' - ), - 'A18ACDNYOEMMOL' => array( + ], + 'A18ACDNYOEMMOL' => [ 'name' => 'ApexSuppliers', 'price' => '589' - ), - 'A2NYACAJP9I1IY' => array( + ], + 'A2NYACAJP9I1IY' => [ 'name' => 'GizmosForLife', 'price' => '608' - ), - 'A1729W3053T57N' => array( + ], + 'A1729W3053T57N' => [ 'name' => 'The Price Pros', 'price' => '628' - ), - 'A29PHU0KPCGV8S' => array( + ], + 'A29PHU0KPCGV8S' => [ 'name' => 'TheFactoryDepot', 'price' => '638' - ), - 'A3Q3IAIX1CLBMZ' => array( + ], + 'A3Q3IAIX1CLBMZ' => [ 'name' => 'ElectroGalaxy', 'price' => '697' - ), - 'A1PC5XI7QQLW5G' => array( + ], + 'A1PC5XI7QQLW5G' => [ 'name' => 'Long Trading Company', 'price' => '860' - ), - 'A2R0FX412W1BDT' => array( + ], + 'A2R0FX412W1BDT' => [ 'name' => 'Beach Audio', 'price' => '896' - ), - 'AKJJGJ0JKT8F1' => array( + ], + 'AKJJGJ0JKT8F1' => [ 'name' => 'Buy.com', 'price' => '899' - ), - ), - ), - ); + ], + ], + ], + ]; $result = new Zend_Service_Amazon_ResultSet($dom); @@ -255,10 +255,10 @@ public function testFullOffersFromFile() public function dataSignatureEncryption() { - return array( - array( + return [ + [ 'http://webservices.amazon.com', - array( + [ 'Service' => 'AWSECommerceService', 'AWSAccessKeyId' => '00000000000000000000', 'Operation' => 'ItemLookup', @@ -266,7 +266,7 @@ public function dataSignatureEncryption() 'ResponseGroup' => 'ItemAttributes,Offers,Images,Reviews', 'Version' => '2009-01-06', 'Timestamp' => '2009-01-01T12:00:00Z', - ), + ], "GET\n". "webservices.amazon.com\n". "/onca/xml\n". @@ -275,10 +275,10 @@ public function dataSignatureEncryption() "s&Service=AWSECommerceService&Timestamp=2009-01-01T12%3A00%3A00Z&". "Version=2009-01-06", 'Nace%2BU3Az4OhN7tISqgs1vdLBHBEijWcBeCqL5xN9xg%3D' - ), - array( + ], + [ 'http://ecs.amazonaws.co.uk', - array( + [ 'Service' => 'AWSECommerceService', 'AWSAccessKeyId' => '00000000000000000000', 'Operation' => 'ItemSearch', @@ -289,7 +289,7 @@ public function dataSignatureEncryption() 'Sort' => 'salesrank', 'AssociateTag' => 'mytag-20', 'Timestamp' => '2009-01-01T12:00:00Z', - ), + ], "GET\n". "ecs.amazonaws.co.uk\n". "/onca/xml\n". @@ -299,8 +299,8 @@ public function dataSignatureEncryption() "SECommerceService&Sort=salesrank&Timestamp=2009-01-01T12%3A00%3A0". "0Z&Version=2009-01-01", 'TuM6E5L9u%2FuNqOX09ET03BXVmHLVFfJIna5cxXuHxiU%3D', - ), - ); + ], + ]; } /** diff --git a/tests/Zend/Service/Amazon/OnlineTest.php b/tests/Zend/Service/Amazon/OnlineTest.php index 9ba1e61c01..8914f716cc 100644 --- a/tests/Zend/Service/Amazon/OnlineTest.php +++ b/tests/Zend/Service/Amazon/OnlineTest.php @@ -107,12 +107,12 @@ public function setUp() */ public function testItemSearchBooksPhp() { - $resultSet = $this->_amazon->itemSearch(array( + $resultSet = $this->_amazon->itemSearch([ 'SearchIndex' => 'Books', 'Keywords' => 'php', 'ResponseGroup' => 'Small,ItemAttributes,Images,SalesRank,Reviews,EditorialReview,Similarities,' . 'ListmaniaLists' - )); + ]); $this->assertTrue(10 < $resultSet->totalResults()); $this->assertTrue(1 < $resultSet->totalPages()); @@ -148,11 +148,11 @@ public function testItemSearchBooksPhp() */ public function testItemSearchMusicMozart() { - $resultSet = $this->_amazon->itemSearch(array( + $resultSet = $this->_amazon->itemSearch([ 'SearchIndex' => 'Music', 'Keywords' => 'Mozart', 'ResponseGroup' => 'Small,Tracks,Offers' - )); + ]); foreach ($resultSet as $item) { $this->assertTrue($item instanceof Zend_Service_Amazon_Item); @@ -166,11 +166,11 @@ public function testItemSearchMusicMozart() */ public function testItemSearchElectronicsDigitalCamera() { - $resultSet = $this->_amazon->itemSearch(array( + $resultSet = $this->_amazon->itemSearch([ 'SearchIndex' => 'Electronics', 'Keywords' => 'digital camera', 'ResponseGroup' => 'Accessories' - )); + ]); foreach ($resultSet as $item) { $this->assertTrue($item instanceof Zend_Service_Amazon_Item); @@ -184,11 +184,11 @@ public function testItemSearchElectronicsDigitalCamera() */ public function testItemSearchBooksPHPSort() { - $resultSet = $this->_amazon->itemSearch(array( + $resultSet = $this->_amazon->itemSearch([ 'SearchIndex' => 'Books', 'Keywords' => 'php', 'Sort' => '-titlerank' - )); + ]); foreach ($resultSet as $item) { $this->assertTrue($item instanceof Zend_Service_Amazon_Item); @@ -203,11 +203,11 @@ public function testItemSearchBooksPHPSort() public function testItemSearchExceptionCityInvalid() { try { - $this->_amazon->itemSearch(array( + $this->_amazon->itemSearch([ 'SearchIndex' => 'Restaurants', 'Keywords' => 'seafood', 'City' => 'Des Moines' - )); + ]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { } @@ -265,7 +265,7 @@ public function testItemLookupMultiple() public function testItemLookupExceptionSearchIndex() { try { - $this->_amazon->itemLookup('oops', array('SearchIndex' => 'Books')); + $this->_amazon->itemLookup('oops', ['SearchIndex' => 'Books']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('restricted parameter combination', $e->getMessage()); diff --git a/tests/Zend/Service/Amazon/S3/OnlineTest.php b/tests/Zend/Service/Amazon/S3/OnlineTest.php index 39a8b4a278..7866b2afb8 100755 --- a/tests/Zend/Service/Amazon/S3/OnlineTest.php +++ b/tests/Zend/Service/Amazon/S3/OnlineTest.php @@ -232,9 +232,9 @@ public function testRemoveBucket() protected function _fileTest($filename, $object, $type, $exp_type, $stream = false) { if($stream) { - $this->_amazon->putFile($filename, $object, array(Zend_Service_Amazon_S3::S3_CONTENT_TYPE_HEADER => $type)); + $this->_amazon->putFile($filename, $object, [Zend_Service_Amazon_S3::S3_CONTENT_TYPE_HEADER => $type]); } else { - $this->_amazon->putFileStream($filename, $object, array(Zend_Service_Amazon_S3::S3_CONTENT_TYPE_HEADER => $type)); + $this->_amazon->putFileStream($filename, $object, [Zend_Service_Amazon_S3::S3_CONTENT_TYPE_HEADER => $type]); } $data = file_get_contents($filename); @@ -377,7 +377,7 @@ public function testAcl() $this->_amazon->putFile($filedir."testdata.html", $this->_bucket."/zftestfile.html"); $this->_amazon->putFile($filedir."testdata.html", $this->_bucket."/zftestfile2.html", - array(Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ)); + [Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ]); $url = 'http://' . Zend_Service_Amazon_S3::S3_ENDPOINT."/".$this->_bucket."/zftestfile.html"; $data = @file_get_contents($url); @@ -413,7 +413,7 @@ public function testObjectPath() $this->_amazon->createBucket($this->_bucket); $filedir = dirname(__FILE__)."/_files/"; $this->_amazon->putFile($filedir."testdata.html", $this->_bucket."/subdir/dir with spaces/zftestfile.html", - array(Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ)); + [Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ]); $url = 'http://' . Zend_Service_Amazon_S3::S3_ENDPOINT."/".$this->_bucket."/subdir/dir%20with%20spaces/zftestfile.html"; $data = @file_get_contents($url); $this->assertEquals(file_get_contents($filedir."testdata.html"), $data); @@ -477,7 +477,7 @@ public function testGetObjectsByBucketParams() $this->_amazon->putObject("testgetobjectparams1/zftest1", "testdata"); $this->_amazon->putObject("testgetobjectparams1/zftest2", "testdata"); - $list = $this->_amazon->getObjectsByBucket("testgetobjectparams1", array('max-keys' => 1)); + $list = $this->_amazon->getObjectsByBucket("testgetobjectparams1", ['max-keys' => 1]); $this->assertEquals(1, count($list)); $this->_amazon->removeObject("testgetobjectparams1/zftest1", "testdata"); @@ -490,7 +490,7 @@ public function testGetObjectsByBucketParams() public function testVersionBucket() { $this->_amazon->createBucket($this->_bucket); - $response= $this->_amazon->_makeRequest('GET', $this->_bucket.'/?versions', array('versions'=>'')); + $response= $this->_amazon->_makeRequest('GET', $this->_bucket.'/?versions', ['versions'=>'']); $this->assertNotNull($response,'The response for the ?versions is empty'); $xml = new SimpleXMLElement($response->getBody()); $this->assertEquals((string) $xml->Name,$this->_bucket,'The bucket name in XML response is not valid'); @@ -503,10 +503,10 @@ public function testCommonPrefixes() $this->_amazon->createBucket($this->_bucket); $this->_amazon->putObject($this->_bucket.'/test-folder/test1','test'); $this->_amazon->putObject($this->_bucket.'/test-folder/test2-folder/',''); - $params= array( + $params= [ 'prefix' => 'test-folder/', 'delimiter' => '/' - ); + ]; $response= $this->_amazon->getObjectsAndPrefixesByBucket($this->_bucket,$params); $this->assertEquals($response['objects'][0],'test-folder/test1'); $this->assertEquals($response['prefixes'][0],'test-folder/test2-folder/'); diff --git a/tests/Zend/Service/Amazon/S3/StreamTest.php b/tests/Zend/Service/Amazon/S3/StreamTest.php index e5f2b5d396..27c9bc883c 100755 --- a/tests/Zend/Service/Amazon/S3/StreamTest.php +++ b/tests/Zend/Service/Amazon/S3/StreamTest.php @@ -190,7 +190,7 @@ public function testReadObject() */ public function testGetBucketList() { - $buckets = array($this->_bucket.'zf-test1', $this->_bucket.'zf-test2', $this->_bucket.'zf-test3'); + $buckets = [$this->_bucket.'zf-test1', $this->_bucket.'zf-test2', $this->_bucket.'zf-test3']; // Create the buckets foreach ($buckets as $bucket) { @@ -198,7 +198,7 @@ public function testGetBucketList() $this->assertTrue($result); } - $online_buckets = array(); + $online_buckets = []; // Retrieve list of buckets on S3 $e = opendir('s3://'); diff --git a/tests/Zend/Service/Amazon/SimpleDb/OnlineTest.php b/tests/Zend/Service/Amazon/SimpleDb/OnlineTest.php index 61a9cb3bb9..9785812887 100644 --- a/tests/Zend/Service/Amazon/SimpleDb/OnlineTest.php +++ b/tests/Zend/Service/Amazon/SimpleDb/OnlineTest.php @@ -118,13 +118,13 @@ public function setUp() * @param array $args Method argument list * @return void */ - public function request($method, $args = array()) + public function request($method, $args = []) { $response = null; for ($try = 1; $try <= $this->_testWaitRetries; $try++) { try { $this->_wait(); - $response = call_user_func_array(array($this->_amazon, $method), $args); + $response = call_user_func_array([$this->_amazon, $method], $args); break; } catch (Zend_Service_Amazon_SimpleDb_Exception $e) { // Only retry after throtte-related error @@ -138,80 +138,80 @@ public function request($method, $args = array()) public function testGetAttributes() { $domainName = $this->_testDomainNamePrefix . '_testGetAttributes'; - $this->request('deleteDomain', array($domainName)); - $this->request('createDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); + $this->request('createDomain', [$domainName]); try { $itemName = $this->_testItemNamePrefix . '_testGetAttributes'; $attributeName1 = $this->_testAttributeNamePrefix . '_testGetAttributes1'; $attributeName2 = $this->_testAttributeNamePrefix . '_testGetAttributes2'; $attributeValue1 = 'value1'; $attributeValue2 = 'value2'; - $attributes = array( + $attributes = [ $attributeName1 => new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $attributeName1, $attributeValue1), $attributeName2 => new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $attributeName2, $attributeValue2) - ); + ]; // Now that everything's set up, test it - $this->request('putAttributes', array($domainName, $itemName, $attributes)); + $this->request('putAttributes', [$domainName, $itemName, $attributes]); // One attribute - $results = $this->request('getAttributes', array($domainName, $itemName, $attributeName1)); + $results = $this->request('getAttributes', [$domainName, $itemName, $attributeName1]); $this->assertEquals(1, count($results)); $attribute = current($results); $this->assertEquals($attributeName1, $attribute->getName()); $this->assertEquals($attributeValue1, current($attribute->getValues())); // Multiple attributes - $results = $this->request('getAttributes', array($domainName, $itemName)); + $results = $this->request('getAttributes', [$domainName, $itemName]); $this->assertEquals(2, count($results)); $this->assertTrue(array_key_exists($attributeName1, $results)); $this->assertTrue(array_key_exists($attributeName2, $results)); $this->assertEquals($attributeValue1, current($results[$attributeName1]->getValues())); $this->assertEquals($attributeValue2, current($results[$attributeName2]->getValues())); - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); } catch(Exception $e) { - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); throw $e; } } public function testPutAttributes() { $domainName = $this->_testDomainNamePrefix . '_testPutAttributes'; - $this->request('deleteDomain', array($domainName)); - $this->request('createDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); + $this->request('createDomain', [$domainName]); try { $itemName = $this->_testItemNamePrefix . '_testPutAttributes'; $attributeName1 = $this->_testAttributeNamePrefix . '_testPutAttributes1'; $attributeName2 = $this->_testAttributeNamePrefix . '_testPutAttributes2'; $attributeValue1 = 'value1'; $attributeValue2 = 'value2'; - $attributes = array( + $attributes = [ $attributeName1 => new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $attributeName1, $attributeValue1), $attributeName2 => new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $attributeName2, $attributeValue2) - ); + ]; // Now that everything's set up, test it - $this->request('putAttributes', array($domainName, $itemName, $attributes)); + $this->request('putAttributes', [$domainName, $itemName, $attributes]); // Multiple attributes - $results = $this->request('getAttributes', array($domainName, $itemName)); + $results = $this->request('getAttributes', [$domainName, $itemName]); $this->assertEquals(2, count($results)); $this->assertTrue(array_key_exists($attributeName1, $results)); $this->assertTrue(array_key_exists($attributeName2, $results)); $this->assertEquals($attributes[$attributeName1], $results[$attributeName1]); $this->assertEquals($attributes[$attributeName2], $results[$attributeName2]); - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); } catch(Exception $e) { - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); throw $e; } } public function testBatchPutAttributes() { $domainName = $this->_testDomainNamePrefix . '_testBatchPutAttributes'; - $this->request('deleteDomain', array($domainName)); - $this->request('createDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); + $this->request('createDomain', [$domainName]); try { $itemName1 = $this->_testItemNamePrefix . '_testBatchPutAttributes1'; $itemName2 = $this->_testItemNamePrefix . '_testBatchPutAttributes2'; @@ -224,39 +224,39 @@ public function testBatchPutAttributes() { $attributeValue3 = 'value3'; $attributeValue4 = 'value4'; $attributeValue5 = 'value5'; - $items = array( - $itemName1 => array( + $items = [ + $itemName1 => [ $attributeName1 => new Zend_Service_Amazon_SimpleDb_Attribute($itemName1, $attributeName1, $attributeValue1), - $attributeName2 =>new Zend_Service_Amazon_SimpleDb_Attribute($itemName1, $attributeName2, $attributeValue2)), - $itemName2 => array( + $attributeName2 =>new Zend_Service_Amazon_SimpleDb_Attribute($itemName1, $attributeName2, $attributeValue2)], + $itemName2 => [ $attributeName3 => new Zend_Service_Amazon_SimpleDb_Attribute($itemName2, $attributeName3, $attributeValue3), - $attributeName4 => new Zend_Service_Amazon_SimpleDb_Attribute($itemName2, $attributeName4, array($attributeValue4, $attributeValue5))) - ); + $attributeName4 => new Zend_Service_Amazon_SimpleDb_Attribute($itemName2, $attributeName4, [$attributeValue4, $attributeValue5])] + ]; - $replace = array( - $itemName1 => array( + $replace = [ + $itemName1 => [ $attributeName1 => false, $attributeName2 => false - ), - $itemName2 => array( + ], + $itemName2 => [ $attributeName3 => false, $attributeName4 => false - ) - ); + ] + ]; - $this->assertEquals(array(), $this->request('getAttributes', array($domainName, $itemName1))); - $this->request('batchPutAttributes', array($items, $domainName, $replace)); + $this->assertEquals([], $this->request('getAttributes', [$domainName, $itemName1])); + $this->request('batchPutAttributes', [$items, $domainName, $replace]); - $result = $this->request('getAttributes', array($domainName, $itemName1, $attributeName1)); + $result = $this->request('getAttributes', [$domainName, $itemName1, $attributeName1]); $this->assertTrue(array_key_exists($attributeName1, $result)); $this->assertEquals($attributeName1, $result[$attributeName1]->getName()); $this->assertEquals($attributeValue1, current($result[$attributeName1]->getValues())); - $result = $this->request('getAttributes', array($domainName, $itemName2, $attributeName4)); + $result = $this->request('getAttributes', [$domainName, $itemName2, $attributeName4]); $this->assertTrue(array_key_exists($attributeName4, $result)); $this->assertEquals(2, count($result[$attributeName4]->getValues())); - $result = $this->request('getAttributes', array($domainName, $itemName2)); + $result = $this->request('getAttributes', [$domainName, $itemName2]); $this->assertEquals(2, count($result)); $this->assertTrue(array_key_exists($attributeName3, $result)); $this->assertEquals($attributeName3, $result[$attributeName3]->getName()); @@ -265,45 +265,45 @@ public function testBatchPutAttributes() { $this->assertTrue(array_key_exists($attributeName4, $result)); $this->assertEquals($attributeName4, $result[$attributeName4]->getName()); $this->assertEquals(2, count($result[$attributeName4]->getValues())); - $this->assertEquals(array($attributeValue4, $attributeValue5), $result[$attributeName4]->getValues()); + $this->assertEquals([$attributeValue4, $attributeValue5], $result[$attributeName4]->getValues()); // Test replace $newAttributeValue1 = 'newValue1'; $newAttributeValue4 = 'newValue4'; - $items[$itemName1][$attributeName1]->setValues(array($newAttributeValue1)); - $items[$itemName2][$attributeName4]->setValues(array($newAttributeValue4)); + $items[$itemName1][$attributeName1]->setValues([$newAttributeValue1]); + $items[$itemName2][$attributeName4]->setValues([$newAttributeValue4]); - $this->request('batchPutAttributes', array($items, $domainName, $replace)); + $this->request('batchPutAttributes', [$items, $domainName, $replace]); - $result = $this->request('getAttributes', array($domainName, $itemName1, $attributeName1)); - $this->assertEquals(array($newAttributeValue1, $attributeValue1), $result[$attributeName1]->getValues()); + $result = $this->request('getAttributes', [$domainName, $itemName1, $attributeName1]); + $this->assertEquals([$newAttributeValue1, $attributeValue1], $result[$attributeName1]->getValues()); - $result = $this->request('getAttributes', array($domainName, $itemName2, $attributeName4)); - $this->assertEquals(array($newAttributeValue4, $attributeValue4, $attributeValue5), $result[$attributeName4]->getValues()); + $result = $this->request('getAttributes', [$domainName, $itemName2, $attributeName4]); + $this->assertEquals([$newAttributeValue4, $attributeValue4, $attributeValue5], $result[$attributeName4]->getValues()); $replace[$itemName1][$attributeName1] = true; $replace[$itemName2][$attributeName4] = true; - $this->request('batchPutAttributes', array($items, $domainName, $replace)); + $this->request('batchPutAttributes', [$items, $domainName, $replace]); - $result = $this->request('getAttributes', array($domainName, $itemName1, $attributeName1)); + $result = $this->request('getAttributes', [$domainName, $itemName1, $attributeName1]); $this->assertEquals($items[$itemName1][$attributeName1], $result[$attributeName1]); - $result = $this->request('getAttributes', array($domainName, $itemName2, $attributeName4)); + $result = $this->request('getAttributes', [$domainName, $itemName2, $attributeName4]); $this->assertEquals($items[$itemName2][$attributeName4], $result[$attributeName4]); - $this->assertEquals($items[$itemName1], $this->request('getAttributes', array($domainName, $itemName1))); + $this->assertEquals($items[$itemName1], $this->request('getAttributes', [$domainName, $itemName1])); - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); } catch(Exception $e) { - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); throw $e; } } public function testDeleteAttributes() { $domainName = $this->_testDomainNamePrefix . '_testDeleteAttributes'; - $this->request('deleteDomain', array($domainName)); - $this->request('createDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); + $this->request('createDomain', [$domainName]); try { $itemName = $this->_testItemNamePrefix . '_testDeleteAttributes'; $attributeName1 = $this->_testAttributeNamePrefix . '_testDeleteAttributes1'; @@ -314,17 +314,17 @@ public function testDeleteAttributes() { $attributeValue2 = 'value2'; $attributeValue3 = 'value3'; $attributeValue4 = 'value4'; - $attributes = array( + $attributes = [ new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $attributeName1, $attributeValue1), new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $attributeName2, $attributeValue2), new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $attributeName3, $attributeValue3), new Zend_Service_Amazon_SimpleDb_Attribute($itemName, $attributeName4, $attributeValue4) - ); + ]; // Now that everything's set up, test it - $this->request('putAttributes', array($domainName, $itemName, $attributes)); + $this->request('putAttributes', [$domainName, $itemName, $attributes]); - $results = $this->request('getAttributes', array($domainName, $itemName)); + $results = $this->request('getAttributes', [$domainName, $itemName]); $this->assertEquals(4, count($results)); $this->assertTrue(array_key_exists($attributeName1, $results)); $this->assertTrue(array_key_exists($attributeName2, $results)); @@ -335,9 +335,9 @@ public function testDeleteAttributes() { $this->assertEquals($attributeValue3, current($results[$attributeName3]->getValues())); $this->assertEquals($attributeValue4, current($results[$attributeName4]->getValues())); - $this->request('deleteAttributes', array($domainName, $itemName, array($attributes[0]))); + $this->request('deleteAttributes', [$domainName, $itemName, [$attributes[0]]]); - $results = $this->request('getAttributes', array($domainName, $itemName)); + $results = $this->request('getAttributes', [$domainName, $itemName]); $this->assertEquals(3, count($results)); $this->assertTrue(array_key_exists($attributeName2, $results)); $this->assertTrue(array_key_exists($attributeName3, $results)); @@ -346,22 +346,22 @@ public function testDeleteAttributes() { $this->assertEquals($attributeValue3, current($results[$attributeName3]->getValues())); $this->assertEquals($attributeValue4, current($results[$attributeName4]->getValues())); - $this->request('deleteAttributes', array($domainName, $itemName, array($attributes[1], $attributes[2]))); + $this->request('deleteAttributes', [$domainName, $itemName, [$attributes[1], $attributes[2]]]); - $results = $this->request('getAttributes', array($domainName, $itemName)); + $results = $this->request('getAttributes', [$domainName, $itemName]); $this->assertEquals(1, count($results)); $this->assertTrue(array_key_exists($attributeName4, $results)); $this->assertEquals($attributeValue4, current($results[$attributeName4]->getValues())); - $this->request('deleteAttributes', array($domainName, $itemName, array($attributes[3]))); + $this->request('deleteAttributes', [$domainName, $itemName, [$attributes[3]]]); - $results = $this->request('getAttributes', array($domainName, $itemName)); + $results = $this->request('getAttributes', [$domainName, $itemName]); $this->assertEquals(0, count($results)); - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); } catch(Exception $e) { - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); throw $e; } } @@ -372,11 +372,11 @@ public function testListDomains() { // Create some domains for($i = 1; $i <= 3; $i++) { $domainName = $this->_testDomainNamePrefix . '_testListDomains' . $i; - $this->request('deleteDomain', array($domainName)); - $this->request('createDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); + $this->request('createDomain', [$domainName]); } - $page = $this->request('listDomains', array(3)); + $page = $this->request('listDomains', [3]); $this->assertEquals(3, count($page->getData())); // Amazon returns an empty page as the last page :/ $isLast = $page->isLast(); @@ -391,7 +391,7 @@ public function testListDomains() { $tokenDomainName = base64_decode($token); if (false !== strpos($tokenDomainName, $this->_testDomainNamePrefix)) { try { - $this->request('domainMetadata', array($tokenDomainName)); + $this->request('domainMetadata', [$tokenDomainName]); $this->fail('listDomains call with 3 domain maximum did not return last page'); } catch (Exception $e) { $this->assertContains('The specified domain does not exist', $e->getMessage()); @@ -399,17 +399,17 @@ public function testListDomains() { } } } - $this->assertEquals(1, count($this->request('listDomains', array(1, $page->getToken())))); + $this->assertEquals(1, count($this->request('listDomains', [1, $page->getToken()]))); - $page = $this->request('listDomains', array(4)); + $page = $this->request('listDomains', [4]); $this->assertEquals(3, count($page->getData())); $this->assertTrue($page->isLast()); - $page = $this->request('listDomains', array(2)); + $page = $this->request('listDomains', [2]); $this->assertEquals(2, count($page->getData())); $this->assertFalse($page->isLast()); - $nextPage = $this->request('listDomains', array(100, $page->getToken())); + $nextPage = $this->request('listDomains', [100, $page->getToken()]); $this->assertEquals(1, count($nextPage->getData())); // Amazon returns an empty page as the last page :/ $this->assertTrue($nextPage->isLast()); @@ -417,13 +417,13 @@ public function testListDomains() { // Delete the domains for($i = 1; $i <= 3; $i++) { $domainName = $this->_testDomainNamePrefix . '_testListDomains' . $i; - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); } } catch(Exception $e) { // Delete the domains for($i = 1; $i <= 3; $i++) { $domainName = $this->_testDomainNamePrefix . '_testListDomains' . $i; - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); } throw $e; } @@ -431,10 +431,10 @@ public function testListDomains() { public function testDomainMetadata() { $domainName = $this->_testDomainNamePrefix . '_testDomainMetadata'; - $this->request('deleteDomain', array($domainName)); - $this->request('createDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); + $this->request('createDomain', [$domainName]); try { - $metadata = $this->request('domainMetadata', array($domainName)); + $metadata = $this->request('domainMetadata', [$domainName]); $this->assertTrue(is_array($metadata)); $this->assertGreaterThan(0, count($metadata)); $this->assertTrue(array_key_exists('ItemCount', $metadata)); @@ -452,42 +452,42 @@ public function testDomainMetadata() { $this->assertTrue(array_key_exists('Timestamp', $metadata)); // Delete the domain - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); } catch(Exception $e) { - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); throw $e; } } public function testCreateDomain() { $domainName = $this->_testDomainNamePrefix . '_testCreateDomain'; - $this->request('deleteDomain', array($domainName)); - $this->request('createDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); + $this->request('createDomain', [$domainName]); try { $domainListPage = $this->request('listDomains'); $this->assertContains($domainName, $domainListPage->getData()); // Delete the domain - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); } catch(Exception $e) { - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); throw $e; } } public function testDeleteDomain() { $domainName = $this->_testDomainNamePrefix . '_testDeleteDomain'; - $this->request('deleteDomain', array($domainName)); - $this->request('createDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); + $this->request('createDomain', [$domainName]); try { $domainListPage = $this->request('listDomains'); $this->assertContains($domainName, $domainListPage->getData()); $this->assertNull($domainListPage->getToken()); // Delete the domain - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); $domainListPage = $this->request('listDomains'); $this->assertNotContains($domainName, $domainListPage->getData()); } catch(Exception $e) { - $this->request('deleteDomain', array($domainName)); + $this->request('deleteDomain', [$domainName]); throw $e; } } diff --git a/tests/Zend/Service/Amazon/Sqs/OfflineTest.php b/tests/Zend/Service/Amazon/Sqs/OfflineTest.php index e4af9523bb..949e2c3428 100644 --- a/tests/Zend/Service/Amazon/Sqs/OfflineTest.php +++ b/tests/Zend/Service/Amazon/Sqs/OfflineTest.php @@ -86,11 +86,11 @@ public function testSetEmptyRegion() public function testGetRegions() { - $endPoints= array('us-east-1' => 'sqs.us-east-1.amazonaws.com', + $endPoints= ['us-east-1' => 'sqs.us-east-1.amazonaws.com', 'us-west-1' => 'sqs.us-west-1.amazonaws.com', 'eu-west-1' => 'sqs.eu-west-1.amazonaws.com', 'ap-southeast-1' => 'sqs.ap-southeast-1.amazonaws.com', - 'ap-northeast-1' => 'sqs.ap-northeast-1.amazonaws.com'); + 'ap-northeast-1' => 'sqs.ap-northeast-1.amazonaws.com']; $this->assertEquals($this->_amazon->getEndpoints(),$endPoints); } } diff --git a/tests/Zend/Service/Audioscrobbler/AudioscrobblerTestCase.php b/tests/Zend/Service/Audioscrobbler/AudioscrobblerTestCase.php index d2822db00f..456a979c58 100644 --- a/tests/Zend/Service/Audioscrobbler/AudioscrobblerTestCase.php +++ b/tests/Zend/Service/Audioscrobbler/AudioscrobblerTestCase.php @@ -56,7 +56,7 @@ public function setUp() { $this->_httpTestAdapter = new Zend_Http_Client_Adapter_Test(); $this->_httpClient = new Zend_Http_Client(); - $this->_httpClient->setConfig(array('adapter' => $this->_httpTestAdapter)); + $this->_httpClient->setConfig(['adapter' => $this->_httpTestAdapter]); $this->_asService = new Zend_Service_Audioscrobbler(); $this->_asService->setHttpClient($this->_httpClient); } diff --git a/tests/Zend/Service/Delicious/PostTest.php b/tests/Zend/Service/Delicious/PostTest.php index bcfe3bee6e..b90b111a76 100644 --- a/tests/Zend/Service/Delicious/PostTest.php +++ b/tests/Zend/Service/Delicious/PostTest.php @@ -68,10 +68,10 @@ public function setUp() { $this->_delicious = new Zend_Service_Delicious(self::UNAME, self::PASS); - $values = array( + $values = [ 'title' => 'anything', 'url' => 'anything' - ); + ]; $this->_post = new Zend_Service_Delicious_Post($this->_delicious, $values); } @@ -83,7 +83,7 @@ public function setUp() public function testConstructExceptionValuesTitleMissing() { try { - $post = new Zend_Service_Delicious_Post($this->_delicious, array('url' => 'anything')); + $post = new Zend_Service_Delicious_Post($this->_delicious, ['url' => 'anything']); $this->fail('Expected Zend_Service_Delicious_Exception not thrown'); } catch (Zend_Service_Delicious_Exception $e) { $this->assertContains("'url' and 'title'", $e->getMessage()); @@ -98,7 +98,7 @@ public function testConstructExceptionValuesTitleMissing() public function testConstructExceptionValuesUrlMissing() { try { - $post = new Zend_Service_Delicious_Post($this->_delicious, array('title' => 'anything')); + $post = new Zend_Service_Delicious_Post($this->_delicious, ['title' => 'anything']); $this->fail('Expected Zend_Service_Delicious_Exception not thrown'); } catch (Zend_Service_Delicious_Exception $e) { $this->assertContains("'url' and 'title'", $e->getMessage()); @@ -112,11 +112,11 @@ public function testConstructExceptionValuesUrlMissing() */ public function testConstructExceptionValuesDateInvalid() { - $values = array( + $values = [ 'title' => 'anything', 'url' => 'anything', 'date' => 'invalid' - ); + ]; try { $post = new Zend_Service_Delicious_Post($this->_delicious, $values); $this->fail('Expected Zend_Service_Delicious_Exception not thrown'); @@ -152,7 +152,7 @@ public function testSetNotesFluent() */ public function testSetTagsFluent() { - $this->assertSame($this->_post, $this->_post->setTags(array('something'))); + $this->assertSame($this->_post, $this->_post->setTags(['something'])); } /** diff --git a/tests/Zend/Service/Delicious/PrivateDataTest.php b/tests/Zend/Service/Delicious/PrivateDataTest.php index 65d2667e28..b1fe584ace 100644 --- a/tests/Zend/Service/Delicious/PrivateDataTest.php +++ b/tests/Zend/Service/Delicious/PrivateDataTest.php @@ -43,7 +43,7 @@ class Zend_Service_Delicious_PrivateDataTest extends PHPUnit_Framework_TestCase private static $TEST_POST_TITLE = 'test - title'; private static $TEST_POST_URL = 'http://zfdev.com/unittests/delicious/test_url_1'; private static $TEST_POST_NOTES = 'test - note'; - private static $TEST_POST_TAGS = array('testTag1','testTag2'); + private static $TEST_POST_TAGS = ['testTag1','testTag2']; private static $TEST_POST_SHARED = false; /** @@ -58,10 +58,10 @@ class Zend_Service_Delicious_PrivateDataTest extends PHPUnit_Framework_TestCase public function setUp() { $httpClient = new Zend_Http_Client(); - $httpClient->setConfig(array( + $httpClient->setConfig([ 'useragent' => 'Zend_Service_Delicious - Unit tests/0.1', 'keepalive' => true - )); + ]); Zend_Rest_Client::setHttpClient($httpClient); $this->_delicious = new Zend_Service_Delicious(self::TEST_UNAME, self::TEST_PASS); diff --git a/tests/Zend/Service/Delicious/PublicDataTest.php b/tests/Zend/Service/Delicious/PublicDataTest.php index 78324f8c22..c643e2d449 100644 --- a/tests/Zend/Service/Delicious/PublicDataTest.php +++ b/tests/Zend/Service/Delicious/PublicDataTest.php @@ -53,10 +53,10 @@ class Zend_Service_Delicious_PublicDataTest extends PHPUnit_Framework_TestCase public function setUp() { $httpClient = new Zend_Http_Client(); - $httpClient->setConfig(array( + $httpClient->setConfig([ 'useragent' => 'Zend_Service_Delicious - Unit tests/0.1', 'keepalive' => true - )); + ]); Zend_Rest_Client::setHttpClient($httpClient); $this->_delicious = new Zend_Service_Delicious(); diff --git a/tests/Zend/Service/Delicious/SimplePostTest.php b/tests/Zend/Service/Delicious/SimplePostTest.php index 8c7b72d3e7..2467e5fb45 100644 --- a/tests/Zend/Service/Delicious/SimplePostTest.php +++ b/tests/Zend/Service/Delicious/SimplePostTest.php @@ -44,7 +44,7 @@ class Zend_Service_Delicious_SimplePostTest extends PHPUnit_Framework_TestCase */ public function testConstructExceptionTitleMissing() { - $post = array('u' => 'anything'); + $post = ['u' => 'anything']; try { $simplePost = new Zend_Service_Delicious_SimplePost($post); $this->fail('Expected Zend_Service_Delicious_Exception not thrown'); @@ -60,7 +60,7 @@ public function testConstructExceptionTitleMissing() */ public function testConstructExceptionUrlMissing() { - $post = array('d' => 'anything'); + $post = ['d' => 'anything']; try { $simplePost = new Zend_Service_Delicious_SimplePost($post); $this->fail('Expected Zend_Service_Delicious_Exception not thrown'); @@ -77,10 +77,10 @@ public function testConstructExceptionUrlMissing() public function testGetUrl() { $url = 'something'; - $post = array( + $post = [ 'd' => 'anything', 'u' => $url - ); + ]; $simplePost = new Zend_Service_Delicious_SimplePost($post); $this->assertEquals( $url, @@ -97,10 +97,10 @@ public function testGetUrl() public function testGetTitle() { $title = 'something'; - $post = array( + $post = [ 'd' => $title, 'u' => 'anything' - ); + ]; $simplePost = new Zend_Service_Delicious_SimplePost($post); $this->assertEquals( $title, @@ -117,11 +117,11 @@ public function testGetTitle() public function testGetNotes() { $notes = 'something'; - $post = array( + $post = [ 'd' => 'anything', 'u' => 'anything', 'n' => $notes - ); + ]; $simplePost = new Zend_Service_Delicious_SimplePost($post); $this->assertEquals( $notes, @@ -138,11 +138,11 @@ public function testGetNotes() public function testGetTags() { $tags = 'something'; - $post = array( + $post = [ 'd' => 'anything', 'u' => 'anything', 't' => $tags - ); + ]; $simplePost = new Zend_Service_Delicious_SimplePost($post); $this->assertEquals( $tags, diff --git a/tests/Zend/Service/Ebay/AbstractTest.php b/tests/Zend/Service/Ebay/AbstractTest.php index 9868886ad1..5cfeac649e 100644 --- a/tests/Zend/Service/Ebay/AbstractTest.php +++ b/tests/Zend/Service/Ebay/AbstractTest.php @@ -46,13 +46,13 @@ class Zend_Service_Ebay_AbstractTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->_concrete = new Zend_Service_Ebay_AbstractConcrete(array()); + $this->_concrete = new Zend_Service_Ebay_AbstractConcrete([]); } public function testConstructor() { - $array = array('foo' => 'bar', - 'some' => 'value'); + $array = ['foo' => 'bar', + 'some' => 'value']; $config = new Zend_Config($array); $concreteArray = new Zend_Service_Ebay_AbstractConcrete($array); @@ -65,8 +65,8 @@ public function testConstructor() public function testSetOptions() { - $array = array('foo' => 'bar', - 'some' => 'value'); + $array = ['foo' => 'bar', + 'some' => 'value']; $config = new Zend_Config($array); $concreteArray = new Zend_Service_Ebay_AbstractConcrete(); $concreteArray->setOption($array); @@ -88,22 +88,22 @@ public function testOptionsToArrayInvalid() public function testGetOption() { - $expected = array( + $expected = [ 'foo' => 1, 'bar' => 2 - ); + ]; $this->_concrete->setOption('foo', 1) - ->setOption(array('bar' => 2)); + ->setOption(['bar' => 2]); $this->assertEquals(1, $this->_concrete->getOption('foo')); $this->assertEquals(2, $this->_concrete->getOption('bar')); $this->assertEquals($expected, $this->_concrete->getOption()); $this->_concrete->setOption( - array('foo' => 3, + ['foo' => 3, 'bar' => 4 - ) + ] ); $this->assertEquals(3, $this->_concrete->getOption('foo')); $this->assertEquals(4, $this->_concrete->getOption('bar')); @@ -147,38 +147,38 @@ public function testToPhpValueInvalidType() public function testOptionsToNameValueSyntax() { - $options = array( - 'paginationInput' => array( + $options = [ + 'paginationInput' => [ 'entriesPerPage' => 5, 'pageNumber' => 2 - ), - 'itemFilter' => array( - array( + ], + 'itemFilter' => [ + [ 'name' => 'MaxPrice', 'value' => 25, 'paramName' => 'Currency', 'paramValue' => 'USD' - ), - array( + ], + [ 'name' => 'FreeShippingOnly', 'value' => true - ), - array( + ], + [ 'name' => 'ListingType', - 'value' => array( + 'value' => [ 'AuctionWithBIN', 'FixedPrice', 'StoreInventory' - ) - ) - ), - 'productId' => array( + ] + ] + ], + 'productId' => [ '' => 123, 'type' => 'UPC' - ) - ); + ] + ]; - $expected = array( + $expected = [ 'paginationInput.entriesPerPage' => '5', 'paginationInput.pageNumber' => '2', 'itemFilter(0).name' => 'MaxPrice', @@ -193,7 +193,7 @@ public function testOptionsToNameValueSyntax() 'itemFilter(2).value(2)' => 'StoreInventory', 'productId' => '123', 'productId.@type' => 'UPC' - ); + ]; $this->assertEquals($expected, $this->_concrete->optionsToNameValueSyntax($options)); } diff --git a/tests/Zend/Service/Ebay/Finding/OfflineTest.php b/tests/Zend/Service/Ebay/Finding/OfflineTest.php index af8212007e..cfed220507 100644 --- a/tests/Zend/Service/Ebay/Finding/OfflineTest.php +++ b/tests/Zend/Service/Ebay/Finding/OfflineTest.php @@ -71,18 +71,18 @@ public function testConstructor() $this->assertEquals('EBAY-US', $this->_finding->getOption(Zend_Service_Ebay_Finding::OPTION_GLOBAL_ID)); $this->assertEquals('foo', $this->_finding->getOption(Zend_Service_Ebay_Finding::OPTION_APP_ID)); - $options = array( + $options = [ Zend_Service_Ebay_Finding::OPTION_APP_ID => 'app-id', Zend_Service_Ebay_Finding::OPTION_GLOBAL_ID => 'EBAY-GB', 'foo' => 'bar' - ); + ]; $finding = new Zend_Service_Ebay_Finding($options); $this->assertEquals('EBAY-GB', $finding->getOption(Zend_Service_Ebay_Finding::OPTION_GLOBAL_ID)); $this->assertEquals('app-id', $finding->getOption(Zend_Service_Ebay_Finding::OPTION_APP_ID)); $this->assertEquals('bar', $finding->getOption('foo')); $this->setExpectedException('Zend_Service_Ebay_Finding_Exception'); - $finding = new Zend_Service_Ebay_Finding(array('foo' => 'bar')); + $finding = new Zend_Service_Ebay_Finding(['foo' => 'bar']); } public function testResponseAbstract() diff --git a/tests/Zend/Service/Ebay/Finding/OnlineTest.php b/tests/Zend/Service/Ebay/Finding/OnlineTest.php index bd7a2f16c5..54fa53365a 100644 --- a/tests/Zend/Service/Ebay/Finding/OnlineTest.php +++ b/tests/Zend/Service/Ebay/Finding/OnlineTest.php @@ -69,17 +69,17 @@ public function testInvalidAppId() public function testResponseTypeFinds() { - $services = array('findItemsAdvanced' => array('tolkien'), - 'findItemsByCategory' => array('10181'), - 'findItemsByKeywords' => array('harry+potter'), - 'findItemsByProduct' => array('53039031'), - 'findItemsInEbayStores' => array("Laura_Chen's_Small_Store")); + $services = ['findItemsAdvanced' => ['tolkien'], + 'findItemsByCategory' => ['10181'], + 'findItemsByKeywords' => ['harry+potter'], + 'findItemsByProduct' => ['53039031'], + 'findItemsInEbayStores' => ["Laura_Chen's_Small_Store"]]; $item = null; $category = null; $store = null; foreach ($services as $service => $params) { - $response = call_user_func_array(array($this->_finding, $service), $params); + $response = call_user_func_array([$this->_finding, $service], $params); $this->assertTrue($response instanceof Zend_Service_Ebay_Finding_Response_Items); if (!$item && $response->attributes('searchResult', 'count') > 0) { $item = $response->searchResult->item->current(); @@ -103,10 +103,10 @@ public function testResponseTypeFinds() $response2 = $item->findItemsByProduct($this->_finding); $this->assertTrue($response2 instanceof Zend_Service_Ebay_Finding_Response_Items); - $response3 = $category->findItems($this->_finding, array()); + $response3 = $category->findItems($this->_finding, []); $this->assertTrue($response3 instanceof Zend_Service_Ebay_Finding_Response_Items); - $response4 = $store->findItems($this->_finding, array()); + $response4 = $store->findItems($this->_finding, []); $this->assertTrue($response4 instanceof Zend_Service_Ebay_Finding_Response_Items); } @@ -115,7 +115,7 @@ public function testResponseTypeGets() $response = $this->_finding->getSearchKeywordsRecommendation('hary'); $this->assertTrue($response instanceof Zend_Service_Ebay_Finding_Response_Keywords); - $response2 = $response->findItems($this->_finding, array()); + $response2 = $response->findItems($this->_finding, []); $this->assertTrue($response2 instanceof Zend_Service_Ebay_Finding_Response_Items); $response3 = $this->_finding->getHistograms('11233'); diff --git a/tests/Zend/Service/Flickr/OfflineTest.php b/tests/Zend/Service/Flickr/OfflineTest.php index 5a2d3ee30c..dcd2eaa4a6 100644 --- a/tests/Zend/Service/Flickr/OfflineTest.php +++ b/tests/Zend/Service/Flickr/OfflineTest.php @@ -111,12 +111,12 @@ public function testTagSearchBasic() $this->_httpClientAdapterTest->setResponse($this->_loadResponse(__FUNCTION__)); - $options = array( + $options = [ 'per_page' => 10, 'page' => 1, 'tag_mode' => 'or', 'extras' => 'license, date_upload, date_taken, owner_name, icon_server' - ); + ]; $resultSet = $this->_flickr->tagSearch('php', $options); @@ -145,7 +145,7 @@ public function testTagSearchBasic() $resultSet->rewind(); - $resultSetIds = array( + $resultSetIds = [ '428222530', '427883929', '427884403', @@ -156,7 +156,7 @@ public function testTagSearchBasic() '427884398', '427883924', '427884401' - ); + ]; $this->assertTrue($resultSet->valid()); @@ -265,7 +265,7 @@ public function testGetImageDetailsExceptionIdEmpty() public function testValidateUserSearchExceptionPerPageInvalid() { try { - $this->_flickrProxy->proxyValidateUserSearch(array('per_page' => -1)); + $this->_flickrProxy->proxyValidateUserSearch(['per_page' => -1]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('"per_page" option', $e->getMessage()); @@ -280,7 +280,7 @@ public function testValidateUserSearchExceptionPerPageInvalid() public function testValidateUserSearchExceptionPageInvalid() { try { - $this->_flickrProxy->proxyValidateUserSearch(array('per_page' => 10, 'page' => 1.23)); + $this->_flickrProxy->proxyValidateUserSearch(['per_page' => 10, 'page' => 1.23]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('"page" option', $e->getMessage()); @@ -295,7 +295,7 @@ public function testValidateUserSearchExceptionPageInvalid() public function testValidateTagSearchExceptionPerPageInvalid() { try { - $this->_flickrProxy->proxyValidateTagSearch(array('per_page' => -1)); + $this->_flickrProxy->proxyValidateTagSearch(['per_page' => -1]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('"per_page" option', $e->getMessage()); @@ -310,7 +310,7 @@ public function testValidateTagSearchExceptionPerPageInvalid() public function testValidateTagSearchExceptionPageInvalid() { try { - $this->_flickrProxy->proxyValidateTagSearch(array('per_page' => 10, 'page' => 1.23)); + $this->_flickrProxy->proxyValidateTagSearch(['per_page' => 10, 'page' => 1.23]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('"page" option', $e->getMessage()); @@ -325,7 +325,7 @@ public function testValidateTagSearchExceptionPageInvalid() public function testCompareOptionsExceptionOptionInvalid() { try { - $this->_flickrProxy->proxyCompareOptions(array('unexpected' => null), array()); + $this->_flickrProxy->proxyCompareOptions(['unexpected' => null], []); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('parameters are invalid', $e->getMessage()); @@ -340,7 +340,7 @@ public function testCompareOptionsExceptionOptionInvalid() public function testTagSearchExceptionOptionInvalid() { try { - $this->_flickr->tagSearch('irrelevant', array('unexpected' => null)); + $this->_flickr->tagSearch('irrelevant', ['unexpected' => null]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('parameters are invalid', $e->getMessage()); @@ -360,11 +360,11 @@ public function testGroupPoolGetPhotosBasic() $this->_httpClientAdapterTest->setResponse($this->_loadResponse(__FUNCTION__)); - $options = array( + $options = [ 'per_page' => 10, 'page' => 1, 'extras' => 'license, date_upload, date_taken, owner_name, icon_server' - ); + ]; $resultSet = $this->_flickr->groupPoolGetPhotos('20083316@N00', $options); @@ -393,7 +393,7 @@ public function testGroupPoolGetPhotosBasic() $resultSet->rewind(); - $resultSetIds = array( + $resultSetIds = [ '428222530', '427883929', '427884403', @@ -404,7 +404,7 @@ public function testGroupPoolGetPhotosBasic() '427884398', '427883924', '427884401' - ); + ]; $this->assertTrue($resultSet->valid()); @@ -426,7 +426,7 @@ public function testGroupPoolGetPhotosBasic() public function testGroupPoolGetPhotosExceptionOptionInvalid() { try { - $this->_flickr->groupPoolGetPhotos('irrelevant', array('unexpected' => null)); + $this->_flickr->groupPoolGetPhotos('irrelevant', ['unexpected' => null]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('parameters are invalid', $e->getMessage()); @@ -441,7 +441,7 @@ public function testGroupPoolGetPhotosExceptionOptionInvalid() public function testValidateGroupPoolGetPhotosExceptionPerPageInvalid() { try { - $this->_flickrProxy->proxyValidateGroupPoolGetPhotos(array('per_page' => -1)); + $this->_flickrProxy->proxyValidateGroupPoolGetPhotos(['per_page' => -1]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('"per_page" option', $e->getMessage()); @@ -456,7 +456,7 @@ public function testValidateGroupPoolGetPhotosExceptionPerPageInvalid() public function testValidateGroupPoolGetPhotosExceptionPageInvalid() { try { - $this->_flickrProxy->proxyValidateGroupPoolGetPhotos(array('per_page' => 10, 'page' => 1.23)); + $this->_flickrProxy->proxyValidateGroupPoolGetPhotos(['per_page' => 10, 'page' => 1.23]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('"page" option', $e->getMessage()); @@ -507,7 +507,7 @@ public function testGroupPoolGetPhotosExceptionGroupIdEmpty() public function testGroupPoolGetPhotosExceptionGroupIdArray() { try { - $this->_flickr->groupPoolGetPhotos(array()); + $this->_flickr->groupPoolGetPhotos([]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('supply a group id', $e->getMessage()); diff --git a/tests/Zend/Service/Flickr/OnlineTest.php b/tests/Zend/Service/Flickr/OnlineTest.php index beb21fd07a..b68890fe04 100644 --- a/tests/Zend/Service/Flickr/OnlineTest.php +++ b/tests/Zend/Service/Flickr/OnlineTest.php @@ -76,9 +76,9 @@ public function setUp() */ public function testGroupPoolGetPhotosBasic() { - $options = array('per_page' => 10, + $options = ['per_page' => 10, 'page' => 1, - 'extras' => 'license, date_upload, date_taken, owner_name, icon_server'); + 'extras' => 'license, date_upload, date_taken, owner_name, icon_server']; $resultSet = $this->_flickr->groupPoolGetPhotos('20083316@N00', $options); @@ -123,9 +123,9 @@ public function testGroupPoolGetPhotosBasic() */ public function testUserSearchBasic() { - $options = array('per_page' => 10, + $options = ['per_page' => 10, 'page' => 1, - 'extras' => 'license, date_upload, date_taken, owner_name, icon_server'); + 'extras' => 'license, date_upload, date_taken, owner_name, icon_server']; $resultSet = $this->_flickr->userSearch('darby.felton@yahoo.com', $options); @@ -181,13 +181,13 @@ public function testGetIdByUsernameBasic() */ public function testTagSearchOptionSort() { - $options = array( + $options = [ 'per_page' => 10, 'page' => 1, 'tag_mode' => 'or', 'sort' => 'date-taken-asc', 'extras' => 'license, date_upload, date_taken, owner_name, icon_server' - ); + ]; $resultSet = $this->_flickr->tagSearch('php', $options); diff --git a/tests/Zend/Service/LiveDocx/MailMergeTest.php b/tests/Zend/Service/LiveDocx/MailMergeTest.php index 79b4fd0410..b179c14d4a 100644 --- a/tests/Zend/Service/LiveDocx/MailMergeTest.php +++ b/tests/Zend/Service/LiveDocx/MailMergeTest.php @@ -133,10 +133,10 @@ public function testLoginUsernamePasswordSoapClientException() public function testConstructorOptionsUsernamePassword() { $phpLiveDocx = new Zend_Service_LiveDocx_MailMerge( - array ( + [ 'username' => TESTS_ZEND_SERVICE_LIVEDOCX_USERNAME, 'password' => TESTS_ZEND_SERVICE_LIVEDOCX_PASSWORD - ) + ] ); $this->assertTrue($phpLiveDocx->logIn()); } @@ -144,11 +144,11 @@ public function testConstructorOptionsUsernamePassword() public function testConstructorOptionsUsernamePasswordSoapClient() { $phpLiveDocx = new Zend_Service_LiveDocx_MailMerge( - array ( + [ 'username' => TESTS_ZEND_SERVICE_LIVEDOCX_USERNAME, 'password' => TESTS_ZEND_SERVICE_LIVEDOCX_PASSWORD, 'soapClient' => new Zend_Soap_Client(self::ENDPOINT) - ) + ] ); $this->assertTrue($phpLiveDocx->logIn()); } @@ -171,7 +171,7 @@ public function testSetRemoteTemplate() public function testSetFieldValues() { - $testValues = array('software' => 'phpunit'); + $testValues = ['software' => 'phpunit']; // Remote Template $this->phpLiveDocx->uploadTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_1); @@ -217,10 +217,10 @@ public function testAssign() public function testSetBlockFieldValues() { $testKey = 'connection'; - $testValues = array(array('connection_number' => 'unittest', 'connection_duration' => 'unittest', 'fee' => 'unittest'), - array('connection_number' => 'unittest', 'connection_duration' => 'unittest', 'fee' => 'unittest'), - array('connection_number' => 'unittest', 'connection_duration' => 'unittest', 'fee' => 'unittest'), - array('connection_number' => 'unittest', 'connection_duration' => 'unittest', 'fee' => 'unittest') ); + $testValues = [['connection_number' => 'unittest', 'connection_duration' => 'unittest', 'fee' => 'unittest'], + ['connection_number' => 'unittest', 'connection_duration' => 'unittest', 'fee' => 'unittest'], + ['connection_number' => 'unittest', 'connection_duration' => 'unittest', 'fee' => 'unittest'], + ['connection_number' => 'unittest', 'connection_duration' => 'unittest', 'fee' => 'unittest'] ]; // Remote Template $this->phpLiveDocx->uploadTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_2); @@ -236,7 +236,7 @@ public function testSetBlockFieldValues() public function testCreateDocument() { - $testValues = array( + $testValues = [ 'software' => 'phpunit', 'licensee' => 'phpunit', 'company' => 'phpunit', @@ -244,7 +244,7 @@ public function testCreateDocument() 'time' => 'phpunit', 'city' => 'phpunit', 'country' => 'phpunit', - ); + ]; // Remote Template $this->phpLiveDocx->uploadTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_1); @@ -261,7 +261,7 @@ public function testCreateDocument() public function testRetrieveDocument() { - $testValues = array( + $testValues = [ 'software' => 'phpunit', 'licensee' => 'phpunit', 'company' => 'phpunit', @@ -269,19 +269,19 @@ public function testRetrieveDocument() 'time' => 'phpunit', 'city' => 'phpunit', 'country' => 'phpunit', - ); + ]; // PDF and DOCs are always slightly different: // - PDF because of the timestamp in meta data // - DOC because of ??? - $expectedResults = array( + $expectedResults = [ 'docx' => 'f21728491855c27a9e64a47266c2a720', 'rtf' => 'fb75deabf481b0264927cb4a5c9db765', 'txd' => 'd1f645405ded0718edff6ae6f50a496e', 'txt' => 'ec2f680646540edd79cd22773fa7e183', 'html' => 'e3a28523794b0071501c09f791f8c795', - ); + ]; // Remote Template $this->phpLiveDocx->uploadTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_1); @@ -306,8 +306,8 @@ public function testRetrieveDocument() public function testRetrieveDocumentAppended() { - $testValues = array( - array( + $testValues = [ + [ 'software' => 'phpunit - document 1', 'licensee' => 'phpunit - document 1', 'company' => 'phpunit - document 1', @@ -315,8 +315,8 @@ public function testRetrieveDocumentAppended() 'time' => 'phpunit - document 1', 'city' => 'phpunit - document 1', 'country' => 'phpunit - document 1', - ), - array( + ], + [ 'software' => 'phpunit - document 2', 'licensee' => 'phpunit - document 2', 'company' => 'phpunit - document 2', @@ -324,19 +324,19 @@ public function testRetrieveDocumentAppended() 'time' => 'phpunit - document 2', 'city' => 'phpunit - document 2', 'country' => 'phpunit - document 2', - ), - ); + ], + ]; // PDF and DOCs are always slightly different: // - PDF because of the timestamp in meta data // - DOC because of ??? - $expectedResults = array( + $expectedResults = [ 'docx' => '2757b4d10c8c031d8f501231be39fcfe', 'rtf' => '2997e531011d826f315291fca1351988', 'txd' => '8377a5a62f2e034974fc299c322d137f', 'txt' => 'a7d23668f81b314e15d653ab657316f9', 'html' => '57365a2ff02347a7863626317505e037', - ); + ]; // Remote Template $this->phpLiveDocx->uploadTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_1); @@ -363,25 +363,25 @@ public function testRetrieveDocumentAppended() public function testGetTemplateFormats() { - $expectedResults = array('doc' , 'docx' , 'rtf' , 'txd'); + $expectedResults = ['doc' , 'docx' , 'rtf' , 'txd']; $this->assertEquals($expectedResults, $this->phpLiveDocx->getTemplateFormats()); } public function testGetDocumentFormats() { - $expectedResults = array('doc' , 'docx' , 'html' , 'pdf' , 'rtf' , 'txd' , 'txt'); + $expectedResults = ['doc' , 'docx' , 'html' , 'pdf' , 'rtf' , 'txd' , 'txt']; $this->assertEquals($expectedResults, $this->phpLiveDocx->getDocumentFormats()); } public function testGetImageImportFormats() { - $expectedResults = array('bmp' , 'gif' , 'jpg' , 'png' , 'tiff', 'wmf'); + $expectedResults = ['bmp' , 'gif' , 'jpg' , 'png' , 'tiff', 'wmf']; $this->assertEquals($expectedResults, $this->phpLiveDocx->getImageImportFormats()); } public function testGetImageExportFormats() { - $expectedResults = array('bmp' , 'gif' , 'jpg' , 'png' , 'tiff'); + $expectedResults = ['bmp' , 'gif' , 'jpg' , 'png' , 'tiff']; $this->assertEquals($expectedResults, $this->phpLiveDocx->getImageExportFormats()); } @@ -389,7 +389,7 @@ public function testGetImageExportFormats() public function testGetBitmaps() { - $testValues = array( + $testValues = [ 'software' => 'phpunit', 'licensee' => 'phpunit', 'company' => 'phpunit', @@ -397,15 +397,15 @@ public function testGetBitmaps() 'time' => 'phpunit', 'city' => 'phpunit', 'country' => 'phpunit', - ); + ]; - $expectedResults = array( + $expectedResults = [ 'bmp' => 'a1934f2153172f021847af7ece9049ce', 'gif' => 'd7281d7b6352ff897917e25d6b92746f', 'jpg' => 'e0b20ea2c9a6252886f689f227109085', 'png' => 'c449f0c2726f869e9a42156e366f1bf9', 'tiff' => '20a96a94762a531e9879db0aa6bd673f', - ); + ]; $this->phpLiveDocx->setLocalTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_1); $this->phpLiveDocx->assign($testValues); @@ -418,7 +418,7 @@ public function testGetBitmaps() public function testGetAllBitmaps() { - $testValues = array( + $testValues = [ 'software' => 'phpunit', 'licensee' => 'phpunit', 'company' => 'phpunit', @@ -426,15 +426,15 @@ public function testGetAllBitmaps() 'time' => 'phpunit', 'city' => 'phpunit', 'country' => 'phpunit', - ); + ]; - $expectedResults = array( + $expectedResults = [ 'bmp' => 'e8a884ee61c394deec8520fb397d1cf1', 'gif' => '2255fee47b4af8438b109efc3cb0d304', 'jpg' => 'e1acfc3001fc62567de2a489eccdb552', 'png' => '15eac34d08e602cde042862b467fa865', 'tiff' => '98bad79380a80c9cc43dfffc5158d0f9', - ); + ]; $this->phpLiveDocx->setLocalTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_1); $this->phpLiveDocx->assign($testValues); @@ -449,7 +449,7 @@ public function testGetFontNames() { $fonts = $this->phpLiveDocx->getFontNames(); if (is_array($fonts) && count($fonts) > 5) { - foreach (array('Courier New' , 'Verdana' , 'Arial' , 'Times New Roman') as $font) { + foreach (['Courier New' , 'Verdana' , 'Arial' , 'Times New Roman'] as $font) { if (in_array($font, $fonts)) { $this->assertTrue(true); } else { @@ -463,7 +463,7 @@ public function testGetFontNames() public function testGetFieldNames() { - $expectedResults = array('phone', 'date', 'name', 'customer_number', 'invoice_number', 'account_number', 'service_phone', 'service_fax', 'month', 'monthly_fee', 'total_net', 'tax', 'tax_value', 'total'); + $expectedResults = ['phone', 'date', 'name', 'customer_number', 'invoice_number', 'account_number', 'service_phone', 'service_fax', 'month', 'monthly_fee', 'total_net', 'tax', 'tax_value', 'total']; // Remote Template $this->phpLiveDocx->uploadTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_2); @@ -478,7 +478,7 @@ public function testGetFieldNames() public function testGetBlockFieldNames() { - $expectedResults = array('connection_number', 'connection_duration', 'fee'); + $expectedResults = ['connection_number', 'connection_duration', 'fee']; // Remote Template $this->phpLiveDocx->uploadTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_2); @@ -493,7 +493,7 @@ public function testGetBlockFieldNames() public function testGetBlockNames() { - $expectedResults = array('connection'); + $expectedResults = ['connection']; // Remote Template $this->phpLiveDocx->uploadTemplate($this->path . DIRECTORY_SEPARATOR . self::TEST_TEMPLATE_2); @@ -556,7 +556,7 @@ public function testListTemplates() $this->assertTrue($testTemplate1Exists && $testTemplate2Exists); // Is all info about templates available? - $expectedResults = array('filename', 'fileSize', 'createTime', 'modifyTime'); + $expectedResults = ['filename', 'fileSize', 'createTime', 'modifyTime']; foreach($templates as $template) { $this->assertEquals($expectedResults, array_keys($template)); } @@ -630,7 +630,7 @@ public function testListImages() $this->assertTrue($testImage1Exists && $testImage2Exists); // Is all info about images available? - $expectedResults = array('filename', 'fileSize', 'createTime', 'modifyTime'); + $expectedResults = ['filename', 'fileSize', 'createTime', 'modifyTime']; foreach($images as $image) { $this->assertEquals($expectedResults, array_keys($image)); } @@ -658,16 +658,16 @@ public function testImageExists() public function testAssocArrayToArrayOfArrayOfString() { - $testValues = array( + $testValues = [ 'a' => '1', 'b' => '2', 'c' => '3', - ); + ]; - $expectedResults = array( - array('a', 'b', 'c'), - array('1', '2', '3'), - ); + $expectedResults = [ + ['a', 'b', 'c'], + ['1', '2', '3'], + ]; $actualResults = Zend_Service_LiveDocx_MailMerge::assocArrayToArrayOfArrayOfString($testValues); $this->assertEquals($expectedResults, $actualResults); @@ -675,30 +675,30 @@ public function testAssocArrayToArrayOfArrayOfString() public function testMultiAssocArrayToArrayOfArrayOfString() { - $testValues = array( - array( + $testValues = [ + [ 'a' => '1', 'b' => '2', 'c' => '3', - ), - array( + ], + [ 'a' => '4', 'b' => '5', 'c' => '6', - ), - array( + ], + [ 'a' => '7', 'b' => '8', 'c' => '9', - ), - ); - - $expectedResults = array( - array('a', 'b', 'c'), - array('1', '2', '3'), - array('4', '5', '6'), - array('7', '8', '9'), - ); + ], + ]; + + $expectedResults = [ + ['a', 'b', 'c'], + ['1', '2', '3'], + ['4', '5', '6'], + ['7', '8', '9'], + ]; $actualResults = Zend_Service_LiveDocx_MailMerge::multiAssocArrayToArrayOfArrayOfString($testValues); $this->assertEquals($expectedResults, $actualResults); } diff --git a/tests/Zend/Service/Rackspace/Files/OfflineTest.php b/tests/Zend/Service/Rackspace/Files/OfflineTest.php index fbc008a524..7fc5c71c82 100644 --- a/tests/Zend/Service/Rackspace/Files/OfflineTest.php +++ b/tests/Zend/Service/Rackspace/Files/OfflineTest.php @@ -83,9 +83,9 @@ public function setUp() $this->container = new Zend_Service_Rackspace_Files_Container( $this->rackspace, - array( + [ 'name' => TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME - ) + ] ); $this->httpClientAdapterTest = new Zend_Http_Client_Adapter_Test(); @@ -102,14 +102,14 @@ public function setUp() $this->rackspace->authenticate(), 'Authentication failed' ); - $this->metadata = array( + $this->metadata = [ 'foo' => 'bar', 'foo2' => 'bar2' - ); + ]; - $this->metadata2 = array( + $this->metadata2 = [ 'hello' => 'world' - ); + ]; // load the HTTP response (from a file) $this->httpClientAdapterTest->setResponse( @@ -231,10 +231,10 @@ public function testGetObjectsPseudoDirs() { $objects = $this->rackspace->getObjects( 'zf-unit-test', - array( + [ 'delimiter' => '/', 'prefix' => 'dir/', - ) + ] ); $this->assertTrue($objects !== false); diff --git a/tests/Zend/Service/Rackspace/Files/OnlineTest.php b/tests/Zend/Service/Rackspace/Files/OnlineTest.php index fedb9b68de..3988e76f5d 100644 --- a/tests/Zend/Service/Rackspace/Files/OnlineTest.php +++ b/tests/Zend/Service/Rackspace/Files/OnlineTest.php @@ -85,14 +85,14 @@ public function setUp() $this->rackspace->getHttpClient() ->setAdapter(self::$httpClientAdapterSocket); - $this->metadata = array ( + $this->metadata = [ 'foo' => 'bar', 'foo2' => 'bar2' - ); + ]; - $this->metadata2 = array ( + $this->metadata2 = [ 'hello' => 'world' - ); + ]; // terms of use compliance: safe delay between each test sleep(2); diff --git a/tests/Zend/Service/Rackspace/Servers/OfflineTest.php b/tests/Zend/Service/Rackspace/Servers/OfflineTest.php index 9a82d475bb..0b4605834b 100644 --- a/tests/Zend/Service/Rackspace/Servers/OfflineTest.php +++ b/tests/Zend/Service/Rackspace/Servers/OfflineTest.php @@ -131,11 +131,11 @@ public function testConstants() */ public function testCreateServer() { - $data = array ( + $data = [ 'name' => TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NAME, 'imageId' => TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGEID, 'flavorId' => TESTS_ZEND_SERVICE_RACKSPACE_SERVER_FLAVORID - ); + ]; $server= $this->rackspace->createServer($data); $this->assertTrue($server!==false); diff --git a/tests/Zend/Service/Rackspace/Servers/OnlineTest.php b/tests/Zend/Service/Rackspace/Servers/OnlineTest.php index 427777c638..e9da3b1386 100644 --- a/tests/Zend/Service/Rackspace/Servers/OnlineTest.php +++ b/tests/Zend/Service/Rackspace/Servers/OnlineTest.php @@ -154,11 +154,11 @@ public function testAuthentication() */ public function testCreateServer() { - $data = array ( + $data = [ 'name' => TESTS_ZEND_SERVICE_RACKSPACE_SERVER_NAME, 'imageId' => TESTS_ZEND_SERVICE_RACKSPACE_SERVER_IMAGEID, 'flavorId' => TESTS_ZEND_SERVICE_RACKSPACE_SERVER_FLAVORID - ); + ]; $server= $this->rackspace->createServer($data); $this->assertTrue($server!==false); self::$serverId= $server->getId(); diff --git a/tests/Zend/Service/ReCaptcha/MailHideTest.php b/tests/Zend/Service/ReCaptcha/MailHideTest.php index 69930dbef1..ae988ad6d3 100644 --- a/tests/Zend/Service/ReCaptcha/MailHideTest.php +++ b/tests/Zend/Service/ReCaptcha/MailHideTest.php @@ -72,10 +72,10 @@ public function testEmailLocalPart() { public function testConstructor() { $mail = 'mail@example.com'; - $options = array( + $options = [ 'theme' => 'black', 'lang' => 'no', - ); + ]; $config = new Zend_Config($options); diff --git a/tests/Zend/Service/ReCaptcha/ReCaptchaTest.php b/tests/Zend/Service/ReCaptcha/ReCaptchaTest.php index de98bb2e83..9fa98ddb73 100644 --- a/tests/Zend/Service/ReCaptcha/ReCaptchaTest.php +++ b/tests/Zend/Service/ReCaptcha/ReCaptchaTest.php @@ -76,11 +76,11 @@ public function tetsGetNonExistingParam() { } public function testMultipleParams() { - $params = array( + $params = [ 'ssl' => true, 'error' => 'errorMsg', 'xhtml' => true, - ); + ]; $this->_reCaptcha->setParams($params); $_params = $this->_reCaptcha->getParams(); @@ -103,10 +103,10 @@ public function tetsGetNonExistingOption() { } public function testMultipleOptions() { - $options = array( + $options = [ 'theme' => 'black', 'lang' => 'no', - ); + ]; $this->_reCaptcha->setOptions($options); $_options = $this->_reCaptcha->getOptions(); @@ -116,11 +116,11 @@ public function testMultipleOptions() { } public function testSetMultipleParamsFromZendConfig() { - $params = array( + $params = [ 'ssl' => true, 'error' => 'errorMsg', 'xhtml' => true, - ); + ]; $config = new Zend_Config($params); @@ -139,10 +139,10 @@ public function testSetInvalidParams() { } public function testSetMultipleOptionsFromZendConfig() { - $options = array( + $options = [ 'theme' => 'black', 'lang' => 'no', - ); + ]; $config = new Zend_Config($options); @@ -160,16 +160,16 @@ public function testSetInvalidOptions() { } public function testConstructor() { - $params = array( + $params = [ 'ssl' => true, 'error' => 'errorMsg', 'xhtml' => true, - ); + ]; - $options = array( + $options = [ 'theme' => 'black', 'lang' => 'no', - ); + ]; $ip = '127.0.0.1'; @@ -211,9 +211,9 @@ public function testVerify() { $this->_reCaptcha->setIp('127.0.0.1'); $adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, array( + $client = new Zend_Http_Client(null, [ 'adapter' => $adapter - )); + ]); Zend_Service_ReCaptcha::setHttpClient($client); diff --git a/tests/Zend/Service/ReCaptcha/ResponseTest.php b/tests/Zend/Service/ReCaptcha/ResponseTest.php index cac51c3795..a2ede2ed2f 100644 --- a/tests/Zend/Service/ReCaptcha/ResponseTest.php +++ b/tests/Zend/Service/ReCaptcha/ResponseTest.php @@ -68,7 +68,7 @@ public function testIsInvalid() { public function testSetFromHttpResponseWhenResponseContentIsMissing() { $responseBody = 'true'; - $httpResponse = new Zend_Http_Response(200, array('Content-Type' => 'text/html'), $responseBody); + $httpResponse = new Zend_Http_Response(200, ['Content-Type' => 'text/html'], $responseBody); $this->_response->setFromHttpResponse($httpResponse); @@ -80,7 +80,7 @@ public function testSetFromHttpResponse() { $status = 'false'; $errorCode = 'foobar'; $responseBody = $status . "\n" . $errorCode; - $httpResponse = new Zend_Http_Response(200, array('Content-Type' => 'text/html'), $responseBody); + $httpResponse = new Zend_Http_Response(200, ['Content-Type' => 'text/html'], $responseBody); $this->_response->setFromHttpResponse($httpResponse); @@ -92,7 +92,7 @@ public function testSetFromHttpResponseWhenResponseHasSeveralLinesOfContent() { $status = 'false'; $errorCode = 'foobar'; $responseBody = $status . "\n" . $errorCode . "\nSome data\nEven more data"; - $httpResponse = new Zend_Http_Response(200, array('Content-Type' => 'text/html'), $responseBody); + $httpResponse = new Zend_Http_Response(200, ['Content-Type' => 'text/html'], $responseBody); $this->_response->setFromHttpResponse($httpResponse); @@ -114,7 +114,7 @@ public function testConstructorWithHttpResponse() { $status = 'false'; $errorCode = 'foobar'; $responseBody = $status . "\n" . $errorCode; - $httpResponse = new Zend_Http_Response(200, array('Content-Type' => 'text/html'), $responseBody); + $httpResponse = new Zend_Http_Response(200, ['Content-Type' => 'text/html'], $responseBody); $response = new Zend_Service_ReCaptcha_Response(null, null, $httpResponse); diff --git a/tests/Zend/Service/ShortUrl/BitLyTest.php b/tests/Zend/Service/ShortUrl/BitLyTest.php index 247672b886..34a843f51e 100644 --- a/tests/Zend/Service/ShortUrl/BitLyTest.php +++ b/tests/Zend/Service/ShortUrl/BitLyTest.php @@ -65,10 +65,10 @@ public function testExceptionOnBadApiResponse() { $this->setExpectedException('Zend_Service_ShortUrl_Exception'); - $clientResponse = $this->getMock('Zend_Http_Response', array(), array(), '', false); + $clientResponse = $this->getMock('Zend_Http_Response', [], [], '', false); $clientResponse->expects($this->once())->method('getStatus')->will($this->returnValue(500)); - $client = $this->getMock('Zend_Http_Client', array(), array(), '', false); + $client = $this->getMock('Zend_Http_Client', [], [], '', false); $client->expects($this->once())->method('request')->will($this->returnValue($clientResponse)); $s = new Zend_Service_ShortUrl_BitLy('test'); @@ -80,11 +80,11 @@ public function testAuthenticationWithAccessToken() { $accessToken = 'test'; - $clientResponse = $this->getMock('Zend_Http_Response', array(), array(), '', false); + $clientResponse = $this->getMock('Zend_Http_Response', [], [], '', false); $clientResponse->expects($this->once())->method('getStatus')->will($this->returnValue(200)); $clientResponse->expects($this->once())->method('getBody')->will($this->returnValue('http://bit.ly/ZFramework')); - $client = $this->getMock('Zend_Http_Client', array(), array(), '', false); + $client = $this->getMock('Zend_Http_Client', [], [], '', false); $client->expects($this->any())->method('setParameterGet')->with($this->anything(),$this->anything()); $client->expects($this->at(0))->method('setParameterGet')->with('access_token',$accessToken); $client->expects($this->once())->method('request')->will($this->returnValue($clientResponse)); @@ -99,11 +99,11 @@ public function testAuthenticationWithUserCredentials() $login = 'test'; $apiKey = 'api'; - $clientResponse = $this->getMock('Zend_Http_Response', array(), array(), '', false); + $clientResponse = $this->getMock('Zend_Http_Response', [], [], '', false); $clientResponse->expects($this->once())->method('getStatus')->will($this->returnValue(200)); $clientResponse->expects($this->once())->method('getBody')->will($this->returnValue('http://bit.ly/ZFramework')); - $client = $this->getMock('Zend_Http_Client', array(), array(), '', false); + $client = $this->getMock('Zend_Http_Client', [], [], '', false); $client->expects($this->any())->method('setParameterGet')->with($this->anything(),$this->anything()); $client->expects($this->at(0))->method('setParameterGet')->with('login',$login); $client->expects($this->at(1))->method('setParameterGet')->with('apiKey',$apiKey); diff --git a/tests/Zend/Service/ShortUrl/IsGdTest.php b/tests/Zend/Service/ShortUrl/IsGdTest.php index c19e375ed4..17625561f2 100644 --- a/tests/Zend/Service/ShortUrl/IsGdTest.php +++ b/tests/Zend/Service/ShortUrl/IsGdTest.php @@ -68,10 +68,10 @@ public function testShortenIncorrectUrlException() public function testShorten() { - $urls = array( + $urls = [ 'http://framework.zend.com/', 'http://framework.zend.com/manual/en/', - ); + ]; foreach ($urls as $url) { $shortenedUrl = $this->_s->shorten($url); @@ -83,10 +83,10 @@ public function testShorten() public function testUnshorten() { - $urls = array( + $urls = [ 'http://framework.zend.com/' => 'http://is.gd/g3ASn', 'http://framework.zend.com/manual/en/' => 'http://is.gd/g3AVm' - ); + ]; foreach ($urls as $url => $shortenedUrl) { $this->assertEquals($url, $this->_s->unshorten($shortenedUrl)); diff --git a/tests/Zend/Service/ShortUrl/JdemCzTest.php b/tests/Zend/Service/ShortUrl/JdemCzTest.php index 611323a577..abf9d73d28 100644 --- a/tests/Zend/Service/ShortUrl/JdemCzTest.php +++ b/tests/Zend/Service/ShortUrl/JdemCzTest.php @@ -67,10 +67,10 @@ public function testShortenIncorrectUrlException() public function testShorten() { - $urls = array( + $urls = [ 'http://framework.zend.com/' => 'http://jdem.cz/ab2l1', 'http://framework.zend.com/manual/en/' => 'http://jdem.cz/ab3z7' - ); + ]; foreach ($urls as $url => $shortenedUrl) { $this->assertEquals($shortenedUrl, $this->_s->shorten($url)); @@ -79,10 +79,10 @@ public function testShorten() public function testUnshorten() { - $urls = array( + $urls = [ 'http://framework.zend.com/' => 'http://jdem.cz/ab2l1', 'http://framework.zend.com/manual/en/' => 'http://jdem.cz/ab3z7' - ); + ]; foreach ($urls as $url => $shortenedUrl) { $this->assertEquals($url, $this->_s->unshorten($shortenedUrl)); diff --git a/tests/Zend/Service/ShortUrl/MetamarkNetTest.php b/tests/Zend/Service/ShortUrl/MetamarkNetTest.php index c434ba1d92..60f1c4fc07 100644 --- a/tests/Zend/Service/ShortUrl/MetamarkNetTest.php +++ b/tests/Zend/Service/ShortUrl/MetamarkNetTest.php @@ -68,10 +68,10 @@ public function testShortenIncorrectUrlException() public function testShorten() { - $urls = array( + $urls = [ 'http://framework.zend.com/' => 'http://xrl.us/bh4ptf', 'http://framework.zend.com/manual/en/' => 'http://xrl.us/bh4pth' - ); + ]; foreach ($urls as $url => $shortenedUrl) { $this->assertEquals($shortenedUrl, $this->_s->shorten($url)); @@ -80,10 +80,10 @@ public function testShorten() public function testUnshorten() { - $urls = array( + $urls = [ 'http://framework.zend.com/' => 'http://xrl.us/bh4ptf', 'http://framework.zend.com/manual/en/' => 'http://xrl.us/bh4pth' - ); + ]; foreach ($urls as $url => $shortenedUrl) { $this->assertEquals($url, $this->_s->unshorten($shortenedUrl)); diff --git a/tests/Zend/Service/ShortUrl/TinyUrlComTest.php b/tests/Zend/Service/ShortUrl/TinyUrlComTest.php index 25263f4402..fec0b9d39c 100644 --- a/tests/Zend/Service/ShortUrl/TinyUrlComTest.php +++ b/tests/Zend/Service/ShortUrl/TinyUrlComTest.php @@ -67,10 +67,10 @@ public function testShortenIncorrectUrlException() public function testShorten() { - $urls = array( + $urls = [ 'http://framework.zend.com/' => 'http://tinyurl.com/rxtuq', 'http://framework.zend.com/manual/en/' => 'http://tinyurl.com/ynvdzf' - ); + ]; foreach ($urls as $url => $shortenedUrl) { $this->assertEquals($shortenedUrl, $this->_s->shorten($url)); @@ -79,10 +79,10 @@ public function testShorten() public function testUnshorten() { - $urls = array( + $urls = [ 'http://framework.zend.com/' => 'http://tinyurl.com/rxtuq', 'http://framework.zend.com/manual/en/' => 'http://tinyurl.com/ynvdzf' - ); + ]; foreach ($urls as $url => $shortenedUrl) { $this->assertEquals($url, $this->_s->unshorten($shortenedUrl)); diff --git a/tests/Zend/Service/SlideShareTest.php b/tests/Zend/Service/SlideShareTest.php index dbd84324af..b7b6806212 100644 --- a/tests/Zend/Service/SlideShareTest.php +++ b/tests/Zend/Service/SlideShareTest.php @@ -61,11 +61,11 @@ protected function _getSSObject() $cache = Zend_Cache::factory( 'Core', 'File', - array( + [ 'lifetime' => 0, 'automatic_serialization' => true - ), - array('cache_dir' => dirname(__FILE__) . "/SlideShare/_files") + ], + ['cache_dir' => dirname(__FILE__) . "/SlideShare/_files"] ); $ss->setCacheObject($cache); @@ -134,10 +134,10 @@ public function testGetSlideShowByTags() try { $results = $ss->getSlideShowsByTag( - array( + [ 'zend', 'php' - ), 0, 1 + ], 0, 1 ); } catch (Exception $e) { $this->fail("Exception Caught retrieving Slideshow List (tag)"); @@ -183,7 +183,7 @@ public function testUploadSlideShow() $show->setFilename($ppt_file); $show->setDescription("Unit Test"); $show->setTitle($title); - $show->setTags(array('unittest')); + $show->setTags(['unittest']); $show->setID(0); try { @@ -222,10 +222,10 @@ public function testSlideShowObj() $ss->setStatus(124); $ss->setStatusDescription("Boo"); $ss->setTags( - array( + [ 'bar', 'baz' - ) + ] ); $ss->addTag('fon'); $ss->setThumbnailUrl('asdf'); @@ -243,11 +243,11 @@ public function testSlideShowObj() $this->assertEquals($ss->getStatusDescription(), "Boo"); $this->assertEquals( $ss->getTags(), - array( + [ 'bar', 'baz', 'fon' - ) + ] ); $this->assertEquals($ss->getThumbnailUrl(), "asdf"); $this->assertEquals($ss->getTitle(), "title"); diff --git a/tests/Zend/Service/StrikeIron/BaseTest.php b/tests/Zend/Service/StrikeIron/BaseTest.php index a93277a22c..daeb88788c 100644 --- a/tests/Zend/Service/StrikeIron/BaseTest.php +++ b/tests/Zend/Service/StrikeIron/BaseTest.php @@ -39,9 +39,9 @@ class Zend_Service_StrikeIron_BaseTest extends PHPUnit_Framework_TestCase public function setUp() { $this->soapClient = new Zend_Service_StrikeIron_BaseTest_MockSoapClient; - $this->base = new Zend_Service_StrikeIron_Base(array('client' => $this->soapClient, + $this->base = new Zend_Service_StrikeIron_Base(['client' => $this->soapClient, 'username' => 'user', - 'password' => 'pass')); + 'password' => 'pass']); } public function testHasNoPredefinedWsdl() @@ -52,8 +52,8 @@ public function testHasNoPredefinedWsdl() public function testSettingWsdl() { $wsdl = 'http://example.com/foo'; - $base = new Zend_Service_StrikeIron_Base(array('client' => $this->soapClient, - 'wsdl' => $wsdl)); + $base = new Zend_Service_StrikeIron_Base(['client' => $this->soapClient, + 'wsdl' => $wsdl]); $this->assertEquals($wsdl, $base->getWsdl()); } @@ -66,8 +66,8 @@ public function testSoapClientInitializesDefaultSOAPClient() { // set soapclient options to non-wsdl mode just to get a // soapclient instance without hitting the network - $base = new Zend_Service_StrikeIron_Base(array('options' => array('location' => '', - 'uri' => ''))); + $base = new Zend_Service_StrikeIron_Base(['options' => ['location' => '', + 'uri' => '']]); $this->assertTrue($base->getSoapClient() instanceof SOAPClient); } @@ -90,8 +90,8 @@ public function testAddingInvalidSoapHeaderThrows() { $invalidHeaders = 'foo'; try { - $base = new Zend_Service_StrikeIron_Base(array('client' => $this->soapClient, - 'headers' => $invalidHeaders)); + $base = new Zend_Service_StrikeIron_Base(['client' => $this->soapClient, + 'headers' => $invalidHeaders]); $this->fail(); } catch (Zend_Service_StrikeIron_Exception $e) { $this->assertRegExp('/instance of soapheader/i', $e->getMessage()); @@ -100,10 +100,10 @@ public function testAddingInvalidSoapHeaderThrows() public function testAddingInvalidSoapHeaderArrayThrows() { - $invalidHeaders = array('foo'); + $invalidHeaders = ['foo']; try { - $base = new Zend_Service_StrikeIron_Base(array('client' => $this->soapClient, - 'headers' => $invalidHeaders)); + $base = new Zend_Service_StrikeIron_Base(['client' => $this->soapClient, + 'headers' => $invalidHeaders]); $this->fail(); } catch (Zend_Service_StrikeIron_Exception $e) { $this->assertRegExp('/instance of soapheader/i', $e->getMessage()); @@ -113,8 +113,8 @@ public function testAddingInvalidSoapHeaderArrayThrows() public function testAddingScalarSoapHeaderNotLicenseInfo() { $header = new SoapHeader('foo', 'bar'); - $base = new Zend_Service_StrikeIron_Base(array('client' => $this->soapClient, - 'headers' => $header)); + $base = new Zend_Service_StrikeIron_Base(['client' => $this->soapClient, + 'headers' => $header]); $base->foo(); $headers = $this->soapClient->calls[0]['headers']; @@ -127,10 +127,10 @@ public function testAddingScalarSoapHeaderThatOverridesLicenseInfo() { $soapHeaders = new SoapHeader('http://ws.strikeiron.com', 'LicenseInfo', - array('RegisteredUser' => array('UserID' => 'foo', - 'Password' => 'bar'))); - $base = new Zend_Service_StrikeIron_Base(array('client' => $this->soapClient, - 'headers' => $soapHeaders)); + ['RegisteredUser' => ['UserID' => 'foo', + 'Password' => 'bar']]); + $base = new Zend_Service_StrikeIron_Base(['client' => $this->soapClient, + 'headers' => $soapHeaders]); $base->foo(); $headers = $this->soapClient->calls[0]['headers']; @@ -147,11 +147,11 @@ public function testAddingScalarSoapHeaderThatOverridesLicenseInfo() public function testAddingArrayOfSoapHeaders() { - $headers = array(new SoapHeader('foo', 'bar'), - new SoapHeader('baz', 'qux')); + $headers = [new SoapHeader('foo', 'bar'), + new SoapHeader('baz', 'qux')]; - $base = new Zend_Service_StrikeIron_Base(array('client' => $this->soapClient, - 'headers' => $headers)); + $base = new Zend_Service_StrikeIron_Base(['client' => $this->soapClient, + 'headers' => $headers]); $base->foo(); $headers = $this->soapClient->calls[0]['headers']; @@ -197,7 +197,7 @@ public function testMethodExceptionsAreWrapped() public function testGettingOutputHeaders() { - $this->assertSame(array(), $this->base->getLastOutputHeaders()); + $this->assertSame([], $this->base->getLastOutputHeaders()); $info = $this->base->foo(); $this->assertEquals(Zend_Service_StrikeIron_BaseTest_MockSoapClient::$outputHeaders, $this->base->getLastOutputHeaders()); @@ -261,18 +261,18 @@ public function testGettingSubscriptionInfoThrowsWhenHeaderNotFound() */ class Zend_Service_StrikeIron_BaseTest_MockSoapClient { - public static $outputHeaders = array('SubscriptionInfo' => array('RemainingHits' => 3)); + public static $outputHeaders = ['SubscriptionInfo' => ['RemainingHits' => 3]]; - public $calls = array(); + public $calls = []; public function __soapCall($method, $params, $options, $headers, &$outputHeaders) { $outputHeaders = self::$outputHeaders; - $this->calls[] = array('method' => $method, + $this->calls[] = ['method' => $method, 'params' => $params, 'options' => $options, - 'headers' => $headers); + 'headers' => $headers]; if ($method == 'ReturnTheObject') { // testMethodResultWrappingAnyObject @@ -280,7 +280,7 @@ public function __soapCall($method, $params, $options, $headers, &$outputHeaders } else if ($method == 'WrapThis') { // testMethodResultWrappingAnObjectAndSelectingDefaultResultProperty - return (object)array('WrapThisResult' => 'unwraped'); + return (object)['WrapThisResult' => 'unwraped']; } else if ($method == 'ThrowTheException') { // testMethodExceptionsAreWrapped @@ -288,7 +288,7 @@ public function __soapCall($method, $params, $options, $headers, &$outputHeaders } else if ($method == 'ReturnNoOutputHeaders') { // testGettingSubscriptionInfoThrowsWhenHeaderNotFound - $outputHeaders = array(); + $outputHeaders = []; } else { return 42; diff --git a/tests/Zend/Service/StrikeIron/DecoratorTest.php b/tests/Zend/Service/StrikeIron/DecoratorTest.php index 339f6827c0..9a912ddfc6 100644 --- a/tests/Zend/Service/StrikeIron/DecoratorTest.php +++ b/tests/Zend/Service/StrikeIron/DecoratorTest.php @@ -52,31 +52,31 @@ public function testDecoratorReturnsNullWhenPropertyIsMissing() public function testDecoratorReturnsPropertyByItsName() { - $object = (object)array('Foo' => 'bar', - 'Baz' => 'qux'); + $object = (object)['Foo' => 'bar', + 'Baz' => 'qux']; $decorator = new Zend_Service_StrikeIron_Decorator($object); $this->assertEquals('qux', $decorator->Baz); } public function testDecoratorReturnsPropertyByInflectedName() { - $object = (object)array('Foo' => 'bar', - 'Baz' => 'qux'); + $object = (object)['Foo' => 'bar', + 'Baz' => 'qux']; $decorator = new Zend_Service_StrikeIron_Decorator($object); $this->assertEquals('qux', $decorator->baz); } public function testDecoratorTriesActualPropertyNameBeforeInflecting() { - $object = (object)array('foo' => 'bar', - 'Foo' => 'qux'); + $object = (object)['foo' => 'bar', + 'Foo' => 'qux']; $decorator = new Zend_Service_StrikeIron_Decorator($object); $this->assertEquals('bar', $decorator->foo); } public function testDecoratorReturnsAnotherDecoratorWhenValueIsAnObject() { - $object = (object)array('Foo' => new stdclass); + $object = (object)['Foo' => new stdclass]; $decorator = new Zend_Service_StrikeIron_Decorator($object); $class = get_class($decorator); $this->assertTrue($decorator->Foo instanceof $class); diff --git a/tests/Zend/Service/StrikeIron/NoSoapTest.php b/tests/Zend/Service/StrikeIron/NoSoapTest.php index f5e46aa09d..d82be1d0ac 100644 --- a/tests/Zend/Service/StrikeIron/NoSoapTest.php +++ b/tests/Zend/Service/StrikeIron/NoSoapTest.php @@ -50,9 +50,9 @@ public function setUp() public function testNoSoapException() { try { - $base = new Zend_Service_StrikeIron_Base(array('client' => $this->soapClient, + $base = new Zend_Service_StrikeIron_Base(['client' => $this->soapClient, 'username' => 'user', - 'password' => 'pass')); + 'password' => 'pass']); $this->fail('Expecting exception of type Zend_Service_StrikeIron_Exception'); } catch (Zend_Exception $e) { $this->assertTrue($e instanceof Zend_Service_StrikeIron_Exception, diff --git a/tests/Zend/Service/StrikeIron/SalesUseTaxBasicTest.php b/tests/Zend/Service/StrikeIron/SalesUseTaxBasicTest.php index a45cc099ec..adc70ab700 100644 --- a/tests/Zend/Service/StrikeIron/SalesUseTaxBasicTest.php +++ b/tests/Zend/Service/StrikeIron/SalesUseTaxBasicTest.php @@ -45,7 +45,7 @@ class Zend_Service_StrikeIron_SalesUseTaxBasicTest extends PHPUnit_Framework_Tes public function setUp() { $this->soapClient = new stdclass(); - $this->service = new Zend_Service_StrikeIron_SalesUseTaxBasic(array('client' => $this->soapClient)); + $this->service = new Zend_Service_StrikeIron_SalesUseTaxBasic(['client' => $this->soapClient]); } public function testInheritsFromBase() @@ -61,8 +61,8 @@ public function testWsdl() public function testInstantiationFromFactory() { - $strikeIron = new Zend_Service_StrikeIron(array('client' => $this->soapClient)); - $client = $strikeIron->getService(array('class' => 'SalesUseTaxBasic')); + $strikeIron = new Zend_Service_StrikeIron(['client' => $this->soapClient]); + $client = $strikeIron->getService(['class' => 'SalesUseTaxBasic']); $this->assertTrue($client instanceof Zend_Service_StrikeIron_SalesUseTaxBasic); } diff --git a/tests/Zend/Service/StrikeIron/StrikeIronTest.php b/tests/Zend/Service/StrikeIron/StrikeIronTest.php index 7cfccdf891..8c7da96099 100644 --- a/tests/Zend/Service/StrikeIron/StrikeIronTest.php +++ b/tests/Zend/Service/StrikeIron/StrikeIronTest.php @@ -40,14 +40,14 @@ public function setUp() { // stub out SOAPClient instance $this->soapClient = new stdclass(); - $this->options = array('client' => $this->soapClient); + $this->options = ['client' => $this->soapClient]; $this->strikeIron = new Zend_Service_StrikeIron($this->options); } public function testFactoryThrowsOnBadName() { try { - $this->strikeIron->getService(array('class' => 'BadServiceNameHere')); + $this->strikeIron->getService(['class' => 'BadServiceNameHere']); $this->fail(); } catch (Zend_Service_StrikeIron_Exception $e) { $this->assertRegExp('/could not be loaded/i', $e->getMessage()); @@ -57,7 +57,7 @@ public function testFactoryThrowsOnBadName() public function testFactoryReturnsServiceByStrikeIronClass() { - $base = $this->strikeIron->getService(array('class' => 'Base')); + $base = $this->strikeIron->getService(['class' => 'Base']); $this->assertTrue($base instanceof Zend_Service_StrikeIron_Base); $this->assertSame(null, $base->getWsdl()); $this->assertSame($this->soapClient, $base->getSoapClient()); @@ -66,28 +66,28 @@ public function testFactoryReturnsServiceByStrikeIronClass() public function testFactoryReturnsServiceAnyUnderscoredClass() { $class = 'Zend_Service_StrikeIron_StrikeIronTest_StubbedBase'; - $stub = $this->strikeIron->getService(array('class' => $class)); + $stub = $this->strikeIron->getService(['class' => $class]); $this->assertTrue($stub instanceof $class); } public function testFactoryReturnsServiceByWsdl() { $wsdl = 'http://strikeiron.com/foo'; - $base = $this->strikeIron->getService(array('wsdl' => $wsdl)); + $base = $this->strikeIron->getService(['wsdl' => $wsdl]); $this->assertEquals($wsdl, $base->getWsdl()); } public function testFactoryPassesOptionsFromConstructor() { $class = 'Zend_Service_StrikeIron_StrikeIronTest_StubbedBase'; - $stub = $this->strikeIron->getService(array('class' => $class)); + $stub = $this->strikeIron->getService(['class' => $class]); $this->assertEquals($this->options, $stub->options); } public function testFactoryMergesItsOptionsWithConstructorOptions() { - $options = array('class' => 'Zend_Service_StrikeIron_StrikeIronTest_StubbedBase', - 'foo' => 'bar'); + $options = ['class' => 'Zend_Service_StrikeIron_StrikeIronTest_StubbedBase', + 'foo' => 'bar']; $mergedOptions = array_merge($options, $this->options); unset($mergedOptions['class']); diff --git a/tests/Zend/Service/StrikeIron/USAddressVerificationTest.php b/tests/Zend/Service/StrikeIron/USAddressVerificationTest.php index 8da835f434..d7a4a063fe 100644 --- a/tests/Zend/Service/StrikeIron/USAddressVerificationTest.php +++ b/tests/Zend/Service/StrikeIron/USAddressVerificationTest.php @@ -45,7 +45,7 @@ class Zend_Service_StrikeIron_USAddressVerificationTest extends PHPUnit_Framewor public function setUp() { $this->soapClient = new stdclass(); - $this->service = new Zend_Service_StrikeIron_USAddressVerification(array('client' => $this->soapClient)); + $this->service = new Zend_Service_StrikeIron_USAddressVerification(['client' => $this->soapClient]); } public function testInheritsFromBase() @@ -61,8 +61,8 @@ public function testHasCorrectWsdl() public function testInstantiationFromFactory() { - $strikeIron = new Zend_Service_StrikeIron(array('client' => $this->soapClient)); - $client = $strikeIron->getService(array('class' => 'USAddressVerification')); + $strikeIron = new Zend_Service_StrikeIron(['client' => $this->soapClient]); + $client = $strikeIron->getService(['class' => 'USAddressVerification']); $this->assertTrue($client instanceof Zend_Service_StrikeIron_USAddressVerification); } diff --git a/tests/Zend/Service/StrikeIron/ZipCodeInfoTest.php b/tests/Zend/Service/StrikeIron/ZipCodeInfoTest.php index f51386bfe9..1fdf1223ff 100644 --- a/tests/Zend/Service/StrikeIron/ZipCodeInfoTest.php +++ b/tests/Zend/Service/StrikeIron/ZipCodeInfoTest.php @@ -45,7 +45,7 @@ class Zend_Service_StrikeIron_ZipCodeInfoTest extends PHPUnit_Framework_TestCase public function setUp() { $this->soapClient = new stdclass(); - $this->service = new Zend_Service_StrikeIron_ZipCodeInfo(array('client' => $this->soapClient)); + $this->service = new Zend_Service_StrikeIron_ZipCodeInfo(['client' => $this->soapClient]); } public function testInheritsFromBase() @@ -61,8 +61,8 @@ public function testHasCorrectWsdl() public function testInstantiationFromFactory() { - $strikeIron = new Zend_Service_StrikeIron(array('client' => $this->soapClient)); - $client = $strikeIron->getService(array('class' => 'ZipCodeInfo')); + $strikeIron = new Zend_Service_StrikeIron(['client' => $this->soapClient]); + $client = $strikeIron->getService(['class' => 'ZipCodeInfo']); $this->assertTrue($client instanceof Zend_Service_StrikeIron_ZipCodeInfo); } diff --git a/tests/Zend/Service/Twitter/TwitterTest.php b/tests/Zend/Service/Twitter/TwitterTest.php index 579dde1af0..66bad36461 100644 --- a/tests/Zend/Service/Twitter/TwitterTest.php +++ b/tests/Zend/Service/Twitter/TwitterTest.php @@ -82,12 +82,12 @@ public static function main() */ protected function stubTwitter($path, $method, $responseFile = null, array $params = null) { - $client = $this->getMock('Zend_Oauth_Client', array(), array(), '', false); + $client = $this->getMock('Zend_Oauth_Client', [], [], '', false); $client->expects($this->any())->method('resetParameters') ->will($this->returnValue($client)); $client->expects($this->once())->method('setUri') ->with('https://api.twitter.com/1.1/' . $path); - $response = $this->getMock('Zend_Http_Response', array(), array(), '', false); + $response = $this->getMock('Zend_Http_Response', [], [], '', false); if (!is_null($params)) { $setter = 'setParameter' . ucfirst(strtolower($method)); $client->expects($this->once())->method($setter)->with($params); @@ -107,13 +107,13 @@ protected function stubTwitter($path, $method, $responseFile = null, array $para public function testProvidingAccessTokenInOptionsSetsHttpClientFromAccessToken() { - $token = $this->getMock('Zend_Oauth_Token_Access', array(), array(), '', false); - $client = $this->getMock('Zend_Oauth_Client', array(), array(), '', false); + $token = $this->getMock('Zend_Oauth_Token_Access', [], [], '', false); + $client = $this->getMock('Zend_Oauth_Client', [], [], '', false); $token->expects($this->once())->method('getHttpClient') - ->with(array('token'=>$token, 'siteUrl'=>'https://api.twitter.com/oauth')) + ->with(['token'=>$token, 'siteUrl'=>'https://api.twitter.com/oauth']) ->will($this->returnValue($client)); - $twitter = new Zend_Service_Twitter(array('accessToken'=>$token, 'opt1'=>'val1')); + $twitter = new Zend_Service_Twitter(['accessToken'=>$token, 'opt1'=>'val1']); $this->assertTrue($client === $twitter->getHttpClient()); } @@ -125,52 +125,52 @@ public function testNotAuthorisedWithoutToken() public function testChecksAuthenticatedStateBasedOnAvailabilityOfAccessTokenBasedClient() { - $token = $this->getMock('Zend_Oauth_Token_Access', array(), array(), '', false); - $client = $this->getMock('Zend_Oauth_Client', array(), array(), '', false); + $token = $this->getMock('Zend_Oauth_Token_Access', [], [], '', false); + $client = $this->getMock('Zend_Oauth_Client', [], [], '', false); $token->expects($this->once())->method('getHttpClient') - ->with(array('token'=>$token, 'siteUrl'=>'https://api.twitter.com/oauth')) + ->with(['token'=>$token, 'siteUrl'=>'https://api.twitter.com/oauth']) ->will($this->returnValue($client)); - $twitter = new Zend_Service_Twitter(array('accessToken'=>$token)); + $twitter = new Zend_Service_Twitter(['accessToken'=>$token]); $this->assertTrue($twitter->isAuthorised()); } public function testRelaysMethodsToInternalOAuthInstance() { - $oauth = $this->getMock('Zend_Oauth_Consumer', array(), array(), '', false); + $oauth = $this->getMock('Zend_Oauth_Consumer', [], [], '', false); $oauth->expects($this->once())->method('getRequestToken')->will($this->returnValue('foo')); $oauth->expects($this->once())->method('getRedirectUrl')->will($this->returnValue('foo')); $oauth->expects($this->once())->method('redirect')->will($this->returnValue('foo')); $oauth->expects($this->once())->method('getAccessToken')->will($this->returnValue('foo')); $oauth->expects($this->once())->method('getToken')->will($this->returnValue('foo')); - $twitter = new Zend_Service_Twitter(array('opt1'=>'val1'), $oauth); + $twitter = new Zend_Service_Twitter(['opt1'=>'val1'], $oauth); $this->assertEquals('foo', $twitter->getRequestToken()); $this->assertEquals('foo', $twitter->getRedirectUrl()); $this->assertEquals('foo', $twitter->redirect()); - $this->assertEquals('foo', $twitter->getAccessToken(array(), $this->getMock('Zend_Oauth_Token_Request'))); + $this->assertEquals('foo', $twitter->getAccessToken([], $this->getMock('Zend_Oauth_Token_Request'))); $this->assertEquals('foo', $twitter->getToken()); } public function testResetsHttpClientOnReceiptOfAccessTokenToOauthClient() { $this->markTestIncomplete('Problem with resolving classes for mocking'); - $oauth = $this->getMock('Zend_Oauth_Consumer', array(), array(), '', false); - $client = $this->getMock('Zend_Oauth_Client', array(), array(), '', false); - $token = $this->getMock('Zend_Oauth_Token_Access', array(), array(), '', false); + $oauth = $this->getMock('Zend_Oauth_Consumer', [], [], '', false); + $client = $this->getMock('Zend_Oauth_Client', [], [], '', false); + $token = $this->getMock('Zend_Oauth_Token_Access', [], [], '', false); $token->expects($this->once())->method('getHttpClient')->will($this->returnValue($client)); $oauth->expects($this->once())->method('getAccessToken')->will($this->returnValue($token)); $client->expects($this->once())->method('setHeaders')->with('Accept-Charset', 'ISO-8859-1,utf-8'); - $twitter = new Zend_Service_Twitter(array(), $oauth); - $twitter->getAccessToken(array(), $this->getMock('Zend_Oauth_Token_Request')); + $twitter = new Zend_Service_Twitter([], $oauth); + $twitter->getAccessToken([], $this->getMock('Zend_Oauth_Token_Request')); $this->assertTrue($client === $twitter->getHttpClient()); } public function testAuthorisationFailureWithUsernameAndNoAccessToken() { $this->setExpectedException('Zend_Service_Twitter_Exception'); - $twitter = new Zend_Service_Twitter(array('username'=>'me')); + $twitter = new Zend_Service_Twitter(['username'=>'me']); $twitter->statusesPublicTimeline(); } @@ -182,7 +182,7 @@ public function testUserNameNotRequired() $twitter = new Zend_Service_Twitter(); $twitter->setHttpClient($this->stubTwitter( 'users/show.json', Zend_Http_Client::GET, 'users.show.mwop.json', - array('screen_name' => 'mwop') + ['screen_name' => 'mwop'] )); $response = $twitter->users->show('mwop'); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -199,7 +199,7 @@ public function testRetrievingStatusesWithValidScreenNameThrowsNoInvalidScreenNa $twitter->setHttpClient($this->stubTwitter( 'statuses/user_timeline.json', Zend_Http_Client::GET, 'statuses.user_timeline.mwop.json' )); - $twitter->statuses->userTimeline(array('screen_name' => 'mwop')); + $twitter->statuses->userTimeline(['screen_name' => 'mwop']); } /** @@ -209,7 +209,7 @@ public function testRetrievingStatusesWithInvalidScreenNameCharacterThrowsInvali { $this->setExpectedException('Zend_Service_Twitter_Exception'); $twitter = new Zend_Service_Twitter(); - $twitter->statuses->userTimeline(array('screen_name' => 'abc.def')); + $twitter->statuses->userTimeline(['screen_name' => 'abc.def']); } /** @@ -219,7 +219,7 @@ public function testRetrievingStatusesWithInvalidScreenNameLengthThrowsInvalidSc { $this->setExpectedException('Zend_Service_Twitter_Exception'); $twitter = new Zend_Service_Twitter(); - $twitter->statuses->userTimeline(array('screen_name' => 'abcdef_abc123_abc123x')); + $twitter->statuses->userTimeline(['screen_name' => 'abcdef_abc123_abc123x']); } /** @@ -229,15 +229,15 @@ public function testStatusUserTimelineConstructsExpectedGetUriAndOmitsInvalidPar { $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( - 'statuses/user_timeline.json', Zend_Http_Client::GET, 'statuses.user_timeline.mwop.json', array( + 'statuses/user_timeline.json', Zend_Http_Client::GET, 'statuses.user_timeline.mwop.json', [ 'count' => '123', 'user_id' => 783214, 'since_id' => '10000', 'max_id' => '20000', 'screen_name' => 'twitter' - ) + ] )); - $twitter->statuses->userTimeline(array( + $twitter->statuses->userTimeline([ 'id' => '783214', 'since' => '+2 days', /* invalid param since Apr 2009 */ 'page' => '1', @@ -246,7 +246,7 @@ public function testStatusUserTimelineConstructsExpectedGetUriAndOmitsInvalidPar 'since_id' => '10000', 'max_id' => '20000', 'screen_name' => 'twitter' - )); + ]); } public function testOverloadingGetShouldReturnObjectInstanceWithValidMethodType() @@ -336,7 +336,7 @@ public function testFriendshipCreate() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'friendships/create.json', Zend_Http_Client::POST, 'friendships.create.twitter.json', - array('screen_name' => 'twitter') + ['screen_name' => 'twitter'] )); $response = $twitter->friendships->create('twitter'); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -347,9 +347,9 @@ public function testHomeTimelineWithCountReturnsResults() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'statuses/home_timeline.json', Zend_Http_Client::GET, 'statuses.home_timeline.page.json', - array('count' => 3) + ['count' => 3] )); - $response = $twitter->statuses->homeTimeline(array('count' => 3)); + $response = $twitter->statuses->homeTimeline(['count' => 3]); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); } @@ -361,9 +361,9 @@ public function testUserTimelineReturnsResults() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'statuses/user_timeline.json', Zend_Http_Client::GET, 'statuses.user_timeline.mwop.json', - array('screen_name' => 'mwop') + ['screen_name' => 'mwop'] )); - $response = $twitter->statuses->userTimeline(array('screen_name' => 'mwop')); + $response = $twitter->statuses->userTimeline(['screen_name' => 'mwop']); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); } @@ -375,7 +375,7 @@ public function testPostStatusUpdateReturnsResponse() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'statuses/update.json', Zend_Http_Client::POST, 'statuses.update.json', - array('status'=>'Test Message 1') + ['status'=>'Test Message 1'] )); $response = $twitter->statuses->update('Test Message 1'); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -410,7 +410,7 @@ public function testCreateFavoriteStatusReturnsResponse() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'favorites/create.json', Zend_Http_Client::POST, 'favorites.create.json', - array('id' => 15042159587) + ['id' => 15042159587] )); $response = $twitter->favorites->create(15042159587); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -431,7 +431,7 @@ public function testDestroyFavoriteReturnsResponse() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'favorites/destroy.json', Zend_Http_Client::POST, 'favorites.destroy.json', - array('id' => 15042159587) + ['id' => 15042159587] )); $response = $twitter->favorites->destroy(15042159587); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -462,7 +462,7 @@ public function testUserShowByIdReturnsResults() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'users/show.json', Zend_Http_Client::GET, 'users.show.mwop.json', - array('screen_name' => 'mwop') + ['screen_name' => 'mwop'] )); $response = $twitter->users->show('mwop'); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -490,7 +490,7 @@ public function testFriendshipDestroy() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'friendships/destroy.json', Zend_Http_Client::POST, 'friendships.destroy.twitter.json', - array('screen_name' => 'twitter') + ['screen_name' => 'twitter'] )); $response = $twitter->friendships->destroy('twitter'); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -501,7 +501,7 @@ public function testBlockingCreate() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'blocks/create.json', Zend_Http_Client::POST, 'blocks.create.twitter.json', - array('screen_name' => 'twitter') + ['screen_name' => 'twitter'] )); $response = $twitter->blocks->create('twitter'); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -512,7 +512,7 @@ public function testBlockingList() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'blocks/list.json', Zend_Http_Client::GET, 'blocks.list.json', - array('cursor' => -1) + ['cursor' => -1] )); $response = $twitter->blocks->list(); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -523,7 +523,7 @@ public function testBlockingIds() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'blocks/ids.json', Zend_Http_Client::GET, 'blocks.ids.json', - array('cursor' => -1) + ['cursor' => -1] )); $response = $twitter->blocks->ids(); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -535,7 +535,7 @@ public function testBlockingDestroy() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'blocks/destroy.json', Zend_Http_Client::POST, 'blocks.destroy.twitter.json', - array('screen_name' => 'twitter') + ['screen_name' => 'twitter'] )); $response = $twitter->blocks->destroy('twitter'); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -546,8 +546,8 @@ public function testBlockingDestroy() */ public function testTwitterObjectsSoNotShareSameHttpClientToPreventConflictingAuthentication() { - $twitter1 = new Zend_Service_Twitter(array('username'=>'zftestuser1')); - $twitter2 = new Zend_Service_Twitter(array('username'=>'zftestuser2')); + $twitter1 = new Zend_Service_Twitter(['username'=>'zftestuser1']); + $twitter2 = new Zend_Service_Twitter(['username'=>'zftestuser2']); $this->assertFalse($twitter1->getHttpClient() === $twitter2->getHttpClient()); } @@ -556,7 +556,7 @@ public function testSearchTweets() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'search/tweets.json', Zend_Http_Client::GET, 'search.tweets.json', - array('q' => '#zf2') + ['q' => '#zf2'] )); $response = $twitter->search->tweets('#zf2'); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); @@ -567,7 +567,7 @@ public function testUsersSearch() $twitter = new Zend_Service_Twitter; $twitter->setHttpClient($this->stubTwitter( 'users/search.json', Zend_Http_Client::GET, 'users.search.json', - array('q' => 'Zend') + ['q' => 'Zend'] )); $response = $twitter->users->search('Zend'); $this->assertTrue($response instanceof Zend_Service_Twitter_Response); diff --git a/tests/Zend/Service/WindowsAzure/BlobStorageSharedAccessTest.php b/tests/Zend/Service/WindowsAzure/BlobStorageSharedAccessTest.php index f435d32b78..cc135c17b5 100644 --- a/tests/Zend/Service/WindowsAzure/BlobStorageSharedAccessTest.php +++ b/tests/Zend/Service/WindowsAzure/BlobStorageSharedAccessTest.php @@ -152,9 +152,9 @@ public function testSharedAccess_OnlyWrite() // Reduced permissions user performs this part $storageClient = $this->createStorageInstance(); $credentials = $storageClient->getCredentials(); - $credentials->setPermissionSet(array( + $credentials->setPermissionSet([ $sharedAccessUrl - )); + ]); $result = $storageClient->putBlob($containerName, 'images/WindowsAzure.gif', self::$path . 'WindowsAzure.gif'); @@ -204,10 +204,10 @@ public function testDifferentAccounts() $exceptionThrown = false; try { - $credentials->setPermissionSet(array( + $credentials->setPermissionSet([ $sharedAccessUrl1, $sharedAccessUrl2 - )); + ]); } catch (Exception $ex) { $exceptionThrown = true; } diff --git a/tests/Zend/Service/WindowsAzure/BlobStorageTest.php b/tests/Zend/Service/WindowsAzure/BlobStorageTest.php index ce447b97ac..c77d507748 100644 --- a/tests/Zend/Service/WindowsAzure/BlobStorageTest.php +++ b/tests/Zend/Service/WindowsAzure/BlobStorageTest.php @@ -233,9 +233,9 @@ public function testSetContainerAclAdvanced() $storageClient->setContainerAcl( $containerName, Zend_Service_WindowsAzure_Storage_Blob::ACL_PRIVATE, - array( + [ new Zend_Service_WindowsAzure_Storage_SignedIdentifier('ABCDEF', '2009-10-10', '2009-10-11', 'r') - ) + ] ); $acl = $storageClient->getContainerAcl($containerName, true); @@ -253,9 +253,9 @@ public function testSetContainerMetadata() $storageClient = $this->createStorageInstance(); $storageClient->createContainer($containerName); - $storageClient->setContainerMetadata($containerName, array( + $storageClient->setContainerMetadata($containerName, [ 'createdby' => 'PHPAzure', - )); + ]); $metadata = $storageClient->getContainerMetadata($containerName); $this->assertEquals('PHPAzure', $metadata['createdby']); @@ -298,10 +298,10 @@ public function testListContainersWithMetadata() if (TESTS_ZEND_SERVICE_WINDOWSAZURE_BLOB_RUNTESTS) { $containerName = $this->generateName(); $storageClient = $this->createStorageInstance(); - $storageClient->createContainer($containerName, array( + $storageClient->createContainer($containerName, [ 'createdby' => 'PHPAzure', 'ownedby' => 'PHPAzure', - )); + ]); $result = $storageClient->listContainers($containerName, null, null, 'metadata'); @@ -500,10 +500,10 @@ public function testSetBlobProperties() $storageClient->createContainer($containerName); $storageClient->putBlob($containerName, 'images/WindowsAzure.gif', self::$path . 'WindowsAzure.gif'); - $storageClient->setBlobProperties($containerName, 'images/WindowsAzure.gif', null, array( + $storageClient->setBlobProperties($containerName, 'images/WindowsAzure.gif', null, [ 'x-ms-blob-content-language' => 'nl-BE', 'x-ms-blob-content-type' => 'image/gif' - )); + ]); $blobInstance = $storageClient->getBlobInstance($containerName, 'images/WindowsAzure.gif'); @@ -523,9 +523,9 @@ public function testSetBlobMetadata() $storageClient->createContainer($containerName); $storageClient->putBlob($containerName, 'images/WindowsAzure.gif', self::$path . 'WindowsAzure.gif'); - $storageClient->setBlobMetadata($containerName, 'images/WindowsAzure.gif', array( + $storageClient->setBlobMetadata($containerName, 'images/WindowsAzure.gif', [ 'createdby' => 'PHPAzure', - )); + ]); $metadata = $storageClient->getBlobMetadata($containerName, 'images/WindowsAzure.gif'); $this->assertEquals('PHPAzure', $metadata['createdby']); @@ -546,9 +546,9 @@ public function testSetBlobMetadata_Security_AdditionalHeaders() $exceptionThrown = false; try { // adding a newline should not be possible... - $storageClient->setBlobMetadata($containerName, 'images/WindowsAzure.gif', array( + $storageClient->setBlobMetadata($containerName, 'images/WindowsAzure.gif', [ 'createdby' => "PHPAzure\nx-ms-meta-something:false", - )); + ]); } catch (Exception $ex) { $exceptionThrown = true; } @@ -609,18 +609,18 @@ public function testListBlobsWithAllIncludes() $storageClient = $this->createStorageInstance(); $storageClient->createContainer($containerName); - $storageClient->putBlob($containerName, 'images/WindowsAzure1.gif', self::$path . 'WindowsAzure.gif', array( + $storageClient->putBlob($containerName, 'images/WindowsAzure1.gif', self::$path . 'WindowsAzure.gif', [ 'createdby' => 'PHPAzure', 'ownedby' => 'PHPAzure', - )); - $storageClient->putBlob($containerName, 'images/WindowsAzure2.gif', self::$path . 'WindowsAzure.gif', array( + ]); + $storageClient->putBlob($containerName, 'images/WindowsAzure2.gif', self::$path . 'WindowsAzure.gif', [ 'createdby' => 'PHPAzure', 'ownedby' => 'PHPAzure', - )); - $storageClient->putBlob($containerName, 'images/WindowsAzure3.gif', self::$path . 'WindowsAzure.gif', array( + ]); + $storageClient->putBlob($containerName, 'images/WindowsAzure3.gif', self::$path . 'WindowsAzure.gif', [ 'createdby' => 'PHPAzure', 'ownedby' => 'PHPAzure', - )); + ]); $result = $storageClient->listBlobs($containerName, '', '', null, null, 'metadata,snapshots,uncommittedblobs'); $this->assertEquals(3, count($result)); @@ -651,7 +651,7 @@ public function testCopyBlob() $this->assertEquals('images/WindowsAzureCopy.gif', $destination->Name); $snapshotId = $storageClient->snapshotBlob($containerName, 'images/WindowsAzure.gif'); - $destination = $storageClient->copyBlob($containerName, 'images/WindowsAzure.gif', $containerName, 'images/WindowsAzureCopy2.gif', array(), $snapshotId); + $destination = $storageClient->copyBlob($containerName, 'images/WindowsAzure.gif', $containerName, 'images/WindowsAzureCopy2.gif', [], $snapshotId); $this->assertEquals($containerName, $destination->Container); $this->assertEquals('images/WindowsAzureCopy2.gif', $destination->Name); @@ -676,9 +676,9 @@ public function testRootContainer() $this->assertEquals(Zend_Service_WindowsAzure_Storage_Blob::ACL_PUBLIC_CONTAINER, $acl); // Metadata - $storageClient->setContainerMetadata($containerName, array( + $storageClient->setContainerMetadata($containerName, [ 'createdby' => 'PHPAzure', - )); + ]); $metadata = $storageClient->getContainerMetadata($containerName); $this->assertEquals('PHPAzure', $metadata['createdby']); @@ -707,9 +707,9 @@ public function testRootContainer() unlink($fileName); // Blob metadata - $storageClient->setBlobMetadata($containerName, 'WindowsAzure.gif', array( + $storageClient->setBlobMetadata($containerName, 'WindowsAzure.gif', [ 'createdby' => 'PHPAzure', - )); + ]); $metadata = $storageClient->getBlobMetadata($containerName, 'WindowsAzure.gif'); $this->assertEquals('PHPAzure', $metadata['createdby']); @@ -796,8 +796,8 @@ public function testPutBlobWithCacheControlHeader() $containerName = $this->generateName(); $storageClient = $this->createStorageInstance(); $storageClient->createContainer($containerName); - $headers = array("x-ms-blob-cache-control" => "public, max-age=7200"); - $result = $storageClient->putBlob($containerName, 'images/WindowsAzure.gif', self::$path . 'WindowsAzure.gif', array(), null, $headers); + $headers = ["x-ms-blob-cache-control" => "public, max-age=7200"]; + $result = $storageClient->putBlob($containerName, 'images/WindowsAzure.gif', self::$path . 'WindowsAzure.gif', [], null, $headers); $blobInstance = $storageClient->getBlobInstance($containerName, 'images/WindowsAzure.gif'); @@ -818,8 +818,8 @@ public function testPutLargeBlobWithCacheControlHeader() $containerName = $this->generateName(); $storageClient = $this->createStorageInstance(); $storageClient->createContainer($containerName); - $headers = array("x-ms-blob-cache-control" => "public, max-age=7200"); - $storageClient->putLargeBlob($containerName, 'LargeFile.txt', $fileName, array(), null, array("x-ms-blob-cache-control" => "public, max-age=7200")); + $headers = ["x-ms-blob-cache-control" => "public, max-age=7200"]; + $storageClient->putLargeBlob($containerName, 'LargeFile.txt', $fileName, [], null, ["x-ms-blob-cache-control" => "public, max-age=7200"]); $blobInstance = $storageClient->getBlobInstance($containerName, 'LargeFile.txt'); diff --git a/tests/Zend/Service/WindowsAzure/BlobStreamTest.php b/tests/Zend/Service/WindowsAzure/BlobStreamTest.php index 575bdfbdc1..7100556ac9 100644 --- a/tests/Zend/Service/WindowsAzure/BlobStreamTest.php +++ b/tests/Zend/Service/WindowsAzure/BlobStreamTest.php @@ -290,7 +290,7 @@ public function testOpendir() $storageClient->registerStreamWrapper(); - $result2 = array(); + $result2 = []; if ($handle = opendir('azure://' . $containerName)) { while (false !== ($file = readdir($handle))) { $result2[] = $file; diff --git a/tests/Zend/Service/WindowsAzure/Credentials/SharedAccessSignatureTest.php b/tests/Zend/Service/WindowsAzure/Credentials/SharedAccessSignatureTest.php index 2faa9ec3e1..91017c831e 100644 --- a/tests/Zend/Service/WindowsAzure/Credentials/SharedAccessSignatureTest.php +++ b/tests/Zend/Service/WindowsAzure/Credentials/SharedAccessSignatureTest.php @@ -125,9 +125,9 @@ public function testSignRequestUrl() $credentials = new Zend_Service_WindowsAzure_Credentials_SharedAccessSignature('myaccount', '', false); $queryString = $credentials->createSignedQueryString('pictures/blob.txt', '', 'b', 'r', '2009-02-09', '2009-02-10'); - $credentials->setPermissionSet(array( + $credentials->setPermissionSet([ 'http://blob.core.windows.net/myaccount/pictures/blob.txt?' . $queryString - )); + ]); $requestUrl = 'http://blob.core.windows.net/myaccount/pictures/blob.txt?comp=metadata'; $result = $credentials->signRequestUrl($requestUrl, Zend_Service_WindowsAzure_Storage::RESOURCE_BLOB); diff --git a/tests/Zend/Service/WindowsAzure/Credentials/SharedKeyLiteTest.php b/tests/Zend/Service/WindowsAzure/Credentials/SharedKeyLiteTest.php index 188ad4b1b2..1804103faa 100644 --- a/tests/Zend/Service/WindowsAzure/Credentials/SharedKeyLiteTest.php +++ b/tests/Zend/Service/WindowsAzure/Credentials/SharedKeyLiteTest.php @@ -59,7 +59,7 @@ public function testSignForDevstoreWithRootPath() 'GET', '/', '', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], true ); @@ -78,7 +78,7 @@ public function testSignForDevstoreWithOtherPath() 'GET', '/test', '', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], true ); @@ -97,7 +97,7 @@ public function testSignForDevstoreWithQueryString() 'GET', '/', '?test=true', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], true ); @@ -116,7 +116,7 @@ public function testSignForProductionWithRootPath() 'GET', '/', '', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], true ); @@ -135,7 +135,7 @@ public function testSignForProductionWithOtherPath() 'GET', '/test', '', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], true ); @@ -154,7 +154,7 @@ public function testSignForProductionWithQueryString() 'GET', '/', '?test=true', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], true ); diff --git a/tests/Zend/Service/WindowsAzure/Credentials/SharedKeyTest.php b/tests/Zend/Service/WindowsAzure/Credentials/SharedKeyTest.php index 8bb20d7984..d365c94f43 100644 --- a/tests/Zend/Service/WindowsAzure/Credentials/SharedKeyTest.php +++ b/tests/Zend/Service/WindowsAzure/Credentials/SharedKeyTest.php @@ -59,7 +59,7 @@ public function testSignForDevstoreWithRootPath() 'GET', '/', '', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], false ); @@ -78,7 +78,7 @@ public function testSignForDevstoreWithOtherPath() 'GET', '/test', '', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], false ); @@ -97,7 +97,7 @@ public function testSignForDevstoreWithQueryString() 'GET', '/', '?test=true', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], false ); @@ -116,7 +116,7 @@ public function testSignForProductionWithRootPath() 'GET', '/', '', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], false ); @@ -135,7 +135,7 @@ public function testSignForProductionWithOtherPath() 'GET', '/test', '', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], false ); @@ -154,7 +154,7 @@ public function testSignForProductionWithQueryString() 'GET', '/', '?test=true', - array("x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"), + ["x-ms-date" => "Wed, 29 Apr 2009 13:12:47 GMT"], false ); diff --git a/tests/Zend/Service/WindowsAzure/DynamicTableEntityTest.php b/tests/Zend/Service/WindowsAzure/DynamicTableEntityTest.php index 1808e621f2..f3c171c8ad 100644 --- a/tests/Zend/Service/WindowsAzure/DynamicTableEntityTest.php +++ b/tests/Zend/Service/WindowsAzure/DynamicTableEntityTest.php @@ -134,14 +134,14 @@ public function testSetAzureValues() { $dateTimeValue = new DateTime(); - $values = array( + $values = [ 'PartitionKey' => 'partition1', 'RowKey' => '000001', 'Name' => 'Maarten', 'Age' => 25, 'Visible' => true, 'DateInService' => $dateTimeValue - ); + ]; $target = new Zend_Service_WindowsAzure_Storage_DynamicTableEntity(); $target->setAzureValues($values); diff --git a/tests/Zend/Service/WindowsAzure/QueueStorageTest.php b/tests/Zend/Service/WindowsAzure/QueueStorageTest.php index 5a7788bba7..65687a8408 100644 --- a/tests/Zend/Service/WindowsAzure/QueueStorageTest.php +++ b/tests/Zend/Service/WindowsAzure/QueueStorageTest.php @@ -158,9 +158,9 @@ public function testSetQueueMetadata() $storageClient = $this->createStorageInstance(); $storageClient->createQueue($queueName); - $storageClient->setQueueMetadata($queueName, array( + $storageClient->setQueueMetadata($queueName, [ 'createdby' => 'PHPAzure', - )); + ]); $metadata = $storageClient->getQueueMetadata($queueName); $this->assertEquals('PHPAzure', $metadata['createdby']); @@ -219,10 +219,10 @@ public function testListQueuesWithMetadata() if (TESTS_ZEND_SERVICE_WINDOWSAZURE_QUEUE_RUNTESTS) { $queueName = $this->generateName(); $storageClient = $this->createStorageInstance(); - $storageClient->createQueue($queueName, array( + $storageClient->createQueue($queueName, [ 'createdby' => 'PHPAzure', 'ownedby' => 'PHPAzure', - )); + ]); $result = $storageClient->listQueues($queueName, null, null, 'metadata'); diff --git a/tests/Zend/Service/WindowsAzure/RetryPolicyTest.php b/tests/Zend/Service/WindowsAzure/RetryPolicyTest.php index b26f336615..3f8a23b043 100644 --- a/tests/Zend/Service/WindowsAzure/RetryPolicyTest.php +++ b/tests/Zend/Service/WindowsAzure/RetryPolicyTest.php @@ -71,7 +71,7 @@ public function testNoRetry() $this->_executedRetries = 0; $policy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry(); $retries = $policy->execute( - array($this, '_countRetries') + [$this, '_countRetries'] ); $this->assertEquals(1, $retries); } @@ -86,7 +86,7 @@ public function testRetryN() $policy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::retryN(10, 100); $retries = $policy->execute( - array($this, '_countRetriesAndThrowExceptions') + [$this, '_countRetriesAndThrowExceptions'] ); $this->assertEquals(10, $retries); } diff --git a/tests/Zend/Service/WindowsAzure/TableEntityQueryTest.php b/tests/Zend/Service/WindowsAzure/TableEntityQueryTest.php index 5dedb022fc..4f80fc0939 100644 --- a/tests/Zend/Service/WindowsAzure/TableEntityQueryTest.php +++ b/tests/Zend/Service/WindowsAzure/TableEntityQueryTest.php @@ -162,7 +162,7 @@ public function testWhereArrayQuery() $target = new Zend_Service_WindowsAzure_Storage_TableEntityQuery(); $target->select() ->from('MyTable') - ->where('Name eq ? or Name eq ?', array('Maarten', 'Vijay')); + ->where('Name eq ? or Name eq ?', ['Maarten', 'Vijay']); $this->assertEquals('MyTable()?$filter=Name eq \'Maarten\' or Name eq \'Vijay\'', $target->__toString()); } diff --git a/tests/Zend/Service/WindowsAzure/TableEntityTest.php b/tests/Zend/Service/WindowsAzure/TableEntityTest.php index e326f8df4e..a618e38c02 100644 --- a/tests/Zend/Service/WindowsAzure/TableEntityTest.php +++ b/tests/Zend/Service/WindowsAzure/TableEntityTest.php @@ -85,13 +85,13 @@ public function testGetAzureValues() */ public function testSetAzureValuesSuccess() { - $values = array( + $values = [ 'PartitionKey' => 'partition1', 'RowKey' => '000001', 'Name' => 'Maarten', 'Age' => 25, 'Visible' => true - ); + ]; $target = new TSETTest_TestEntity(); $target->setAzureValues($values); @@ -108,10 +108,10 @@ public function testSetAzureValuesSuccess() */ public function testSetAzureValuesFailure() { - $values = array( + $values = [ 'PartitionKey' => 'partition1', 'RowKey' => '000001' - ); + ]; $exceptionRaised = false; $target = new TSETTest_TestEntity(); diff --git a/tests/Zend/Service/WindowsAzure/TableStorageTest.php b/tests/Zend/Service/WindowsAzure/TableStorageTest.php index 4b761adeb7..21da8b9b0d 100644 --- a/tests/Zend/Service/WindowsAzure/TableStorageTest.php +++ b/tests/Zend/Service/WindowsAzure/TableStorageTest.php @@ -449,7 +449,7 @@ public function testMergeEntity_NoEtag() $dynamicEntity->Otherproperty = "Test"; $dynamicEntity->Age = 0; - $storageClient->mergeEntity($tableName, $dynamicEntity, false, array('Myproperty', 'Otherproperty')); // only update 'Myproperty' and 'Otherproperty' + $storageClient->mergeEntity($tableName, $dynamicEntity, false, ['Myproperty', 'Otherproperty']); // only update 'Myproperty' and 'Otherproperty' $result = $storageClient->retrieveEntityById($tableName, $entity->getPartitionKey(), $entity->getRowKey()); @@ -873,7 +873,7 @@ public function testRetrieveEntityByIdCurlyBrackets() */ protected function _generateEntities($amount = 1) { - $returnValue = array(); + $returnValue = []; for ($i = 0; $i < $amount; $i++) { diff --git a/tests/Zend/Service/Yahoo/OfflineTest.php b/tests/Zend/Service/Yahoo/OfflineTest.php index 29da25675c..de8541e5a4 100644 --- a/tests/Zend/Service/Yahoo/OfflineTest.php +++ b/tests/Zend/Service/Yahoo/OfflineTest.php @@ -119,7 +119,7 @@ public function testResultSetCurrentException() public function testInlinkDataSearchExceptionResultsInvalid() { try { - $this->_yahoo->inlinkDataSearch('http://framework.zend.com/', array('results' => 101)); + $this->_yahoo->inlinkDataSearch('http://framework.zend.com/', ['results' => 101]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'results'", $e->getMessage()); @@ -134,7 +134,7 @@ public function testInlinkDataSearchExceptionResultsInvalid() public function testInlinkDataSearchExceptionStartInvalid() { try { - $this->_yahoo->inlinkDataSearch('http://framework.zend.com/', array('start' => 1001)); + $this->_yahoo->inlinkDataSearch('http://framework.zend.com/', ['start' => 1001]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'start'", $e->getMessage()); @@ -149,7 +149,7 @@ public function testInlinkDataSearchExceptionStartInvalid() public function testInlinkDataSearchExceptionOmitLinksInvalid() { try { - $this->_yahoo->inlinkDataSearch('http://framework.zend.com/', array('omit_inlinks' => 'oops')); + $this->_yahoo->inlinkDataSearch('http://framework.zend.com/', ['omit_inlinks' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'omit_inlinks'", $e->getMessage()); @@ -164,7 +164,7 @@ public function testInlinkDataSearchExceptionOmitLinksInvalid() public function testImageSearchExceptionTypeInvalid() { try { - $this->_yahoo->imageSearch('php', array('type' => 'oops')); + $this->_yahoo->imageSearch('php', ['type' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'type'", $e->getMessage()); @@ -179,7 +179,7 @@ public function testImageSearchExceptionTypeInvalid() public function testImageSearchExceptionResultsInvalid() { try { - $this->_yahoo->imageSearch('php', array('results' => 500)); + $this->_yahoo->imageSearch('php', ['results' => 500]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'results'", $e->getMessage()); @@ -194,7 +194,7 @@ public function testImageSearchExceptionResultsInvalid() public function testImageSearchExceptionStartInvalid() { try { - $this->_yahoo->imageSearch('php', array('start' => 1001)); + $this->_yahoo->imageSearch('php', ['start' => 1001]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'start'", $e->getMessage()); @@ -209,7 +209,7 @@ public function testImageSearchExceptionStartInvalid() public function testImageSearchExceptionFormatInvalid() { try { - $this->_yahoo->imageSearch('php', array('format' => 'oops')); + $this->_yahoo->imageSearch('php', ['format' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'format'", $e->getMessage()); @@ -224,7 +224,7 @@ public function testImageSearchExceptionFormatInvalid() public function testImageSearchExceptionColorationInvalid() { try { - $this->_yahoo->imageSearch('php', array('coloration' => 'oops')); + $this->_yahoo->imageSearch('php', ['coloration' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'coloration'", $e->getMessage()); @@ -239,7 +239,7 @@ public function testImageSearchExceptionColorationInvalid() public function testLocalSearchExceptionResultsInvalid() { try { - $this->_yahoo->localSearch('php', array('results' => 'oops')); + $this->_yahoo->localSearch('php', ['results' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'results'", $e->getMessage()); @@ -254,7 +254,7 @@ public function testLocalSearchExceptionResultsInvalid() public function testLocalSearchExceptionStartInvalid() { try { - $this->_yahoo->localSearch('php', array('start' => 'oops')); + $this->_yahoo->localSearch('php', ['start' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'start'", $e->getMessage()); @@ -269,7 +269,7 @@ public function testLocalSearchExceptionStartInvalid() public function testLocalSearchExceptionLongitudeInvalid() { try { - $this->_yahoo->localSearch('php', array('longitude' => -91)); + $this->_yahoo->localSearch('php', ['longitude' => -91]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'longitude'", $e->getMessage()); @@ -284,7 +284,7 @@ public function testLocalSearchExceptionLongitudeInvalid() public function testLocalSearchExceptionLatitudeInvalid() { try { - $this->_yahoo->localSearch('php', array('latitude' => -181)); + $this->_yahoo->localSearch('php', ['latitude' => -181]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'latitude'", $e->getMessage()); @@ -299,7 +299,7 @@ public function testLocalSearchExceptionLatitudeInvalid() public function testLocalSearchExceptionZipInvalid() { try { - $this->_yahoo->localSearch('php', array('zip' => 'oops')); + $this->_yahoo->localSearch('php', ['zip' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'zip'", $e->getMessage()); @@ -329,7 +329,7 @@ public function testLocalSearchExceptionLocationMissing() public function testLocalSearchExceptionSortInvalid() { try { - $this->_yahoo->localSearch('php', array('location' => '95014', 'sort' => 'oops')); + $this->_yahoo->localSearch('php', ['location' => '95014', 'sort' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'sort'", $e->getMessage()); @@ -344,7 +344,7 @@ public function testLocalSearchExceptionSortInvalid() public function testNewsSearchExceptionResultsInvalid() { try { - $this->_yahoo->newsSearch('php', array('results' => 51)); + $this->_yahoo->newsSearch('php', ['results' => 51]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'results'", $e->getMessage()); @@ -359,7 +359,7 @@ public function testNewsSearchExceptionResultsInvalid() public function testNewsSearchExceptionStartInvalid() { try { - $this->_yahoo->newsSearch('php', array('start' => 'oops')); + $this->_yahoo->newsSearch('php', ['start' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'start'", $e->getMessage()); @@ -374,7 +374,7 @@ public function testNewsSearchExceptionStartInvalid() public function testNewsSearchExceptionLanguageInvalid() { try { - $this->_yahoo->newsSearch('php', array('language' => 'oops')); + $this->_yahoo->newsSearch('php', ['language' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('selected language', $e->getMessage()); @@ -389,7 +389,7 @@ public function testNewsSearchExceptionLanguageInvalid() public function testPageDataSearchExceptionResultsInvalid() { try { - $this->_yahoo->pageDataSearch('http://framework.zend.com/', array('results' => 101)); + $this->_yahoo->pageDataSearch('http://framework.zend.com/', ['results' => 101]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'results'", $e->getMessage()); @@ -404,7 +404,7 @@ public function testPageDataSearchExceptionResultsInvalid() public function testPageDataSearchExceptionStartInvalid() { try { - $this->_yahoo->pageDataSearch('http://framework.zend.com/', array('start' => 1001)); + $this->_yahoo->pageDataSearch('http://framework.zend.com/', ['start' => 1001]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'start'", $e->getMessage()); @@ -419,7 +419,7 @@ public function testPageDataSearchExceptionStartInvalid() public function testVideoSearchExceptionTypeInvalid() { try { - $this->_yahoo->videoSearch('php', array('type' => 'oops')); + $this->_yahoo->videoSearch('php', ['type' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'type'", $e->getMessage()); @@ -434,7 +434,7 @@ public function testVideoSearchExceptionTypeInvalid() public function testVideoSearchExceptionResultsInvalid() { try { - $this->_yahoo->videoSearch('php', array('results' => 500)); + $this->_yahoo->videoSearch('php', ['results' => 500]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'results'", $e->getMessage()); @@ -449,7 +449,7 @@ public function testVideoSearchExceptionResultsInvalid() public function testVideoSearchExceptionStartInvalid() { try { - $this->_yahoo->videoSearch('php', array('start' => 1001)); + $this->_yahoo->videoSearch('php', ['start' => 1001]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'start'", $e->getMessage()); @@ -464,7 +464,7 @@ public function testVideoSearchExceptionStartInvalid() public function testVideoSearchExceptionFormatInvalid() { try { - $this->_yahoo->videoSearch('php', array('format' => 'oops')); + $this->_yahoo->videoSearch('php', ['format' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'format'", $e->getMessage()); @@ -479,7 +479,7 @@ public function testVideoSearchExceptionFormatInvalid() public function testWebSearchExceptionResultsInvalid() { try { - $this->_yahoo->webSearch('php', array('results' => 101)); + $this->_yahoo->webSearch('php', ['results' => 101]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'results'", $e->getMessage()); @@ -494,7 +494,7 @@ public function testWebSearchExceptionResultsInvalid() public function testWebSearchExceptionStartInvalid() { try { - $this->_yahoo->webSearch('php', array('start' => 'oops')); + $this->_yahoo->webSearch('php', ['start' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'start'", $e->getMessage()); @@ -509,7 +509,7 @@ public function testWebSearchExceptionStartInvalid() public function testWebSearchExceptionOptionInvalid() { try { - $this->_yahoo->webSearch('php', array('oops' => 'oops')); + $this->_yahoo->webSearch('php', ['oops' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('parameters are invalid', $e->getMessage()); @@ -524,7 +524,7 @@ public function testWebSearchExceptionOptionInvalid() public function testWebSearchExceptionTypeInvalid() { try { - $this->_yahoo->webSearch('php', array('type' => 'oops')); + $this->_yahoo->webSearch('php', ['type' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains("option 'type'", $e->getMessage()); diff --git a/tests/Zend/Service/Yahoo/OnlineTest.php b/tests/Zend/Service/Yahoo/OnlineTest.php index 4b8cf1fcaf..7a8229a738 100644 --- a/tests/Zend/Service/Yahoo/OnlineTest.php +++ b/tests/Zend/Service/Yahoo/OnlineTest.php @@ -143,7 +143,7 @@ public function testImageSearchPhp() public function testImageSearchExceptionAdultOkInvalid() { try { - $this->_yahoo->imageSearch('php', array('adult_ok' => -1)); + $this->_yahoo->imageSearch('php', ['adult_ok' => -1]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('error occurred sending request', $e->getMessage()); @@ -157,7 +157,7 @@ public function testImageSearchExceptionAdultOkInvalid() */ public function testLocalSearchRestaurants() { - $localResultSet = $this->_yahoo->localSearch('restaurants', array('zip' => '95014')); + $localResultSet = $this->_yahoo->localSearch('restaurants', ['zip' => '95014']); $this->assertTrue($localResultSet instanceof Zend_Service_Yahoo_LocalResultSet); @@ -179,7 +179,7 @@ public function testLocalSearchRestaurants() public function testLocalSearchExceptionRadiusInvalid() { try { - $this->_yahoo->localSearch('php', array('zip' => '95014', 'radius' => -1)); + $this->_yahoo->localSearch('php', ['zip' => '95014', 'radius' => -1]); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('error occurred sending request', $e->getMessage()); @@ -300,7 +300,7 @@ public function testWebSearchPhp() public function testWebSearchExceptionAdultOkInvalid() { try { - $this->_yahoo->webSearch('php', array('adult_ok' => 'oops')); + $this->_yahoo->webSearch('php', ['adult_ok' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('error occurred sending request', $e->getMessage()); @@ -315,7 +315,7 @@ public function testWebSearchExceptionAdultOkInvalid() public function testWebSearchExceptionSimilarOkInvalid() { try { - $this->_yahoo->webSearch('php', array('similar_ok' => 'oops')); + $this->_yahoo->webSearch('php', ['similar_ok' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); } catch (Zend_Service_Exception $e) { $this->assertContains('error occurred sending request', $e->getMessage()); @@ -331,9 +331,9 @@ public function testWebSearchExceptionSimilarOkInvalid() */ public function testWebSearchRegion() { - $this->_yahoo->webSearch('php', array('region' => 'nl')); + $this->_yahoo->webSearch('php', ['region' => 'nl']); try { - $this->_yahoo->webSearch('php', array('region' => 'oops')); + $this->_yahoo->webSearch('php', ['region' => 'oops']); $this->fail('Expected Zend_Service_Exception not thrown'); }catch (Zend_Service_Exception $e) { $this->assertContains("Invalid value for option 'region': oops", $e->getMessage()); @@ -347,7 +347,7 @@ public function testWebSearchRegion() */ public function testWebSearchForSite() { - $webResultSet = $this->_yahoo->webSearch('php', array('site' => 'www.php.net')); + $webResultSet = $this->_yahoo->webSearch('php', ['site' => 'www.php.net']); $this->assertTrue($webResultSet instanceof Zend_Service_Yahoo_WebResultSet); diff --git a/tests/Zend/Session/SaveHandler/DbTableTest.php b/tests/Zend/Session/SaveHandler/DbTableTest.php index 3ccecd79f1..06e68f57f5 100644 --- a/tests/Zend/Session/SaveHandler/DbTableTest.php +++ b/tests/Zend/Session/SaveHandler/DbTableTest.php @@ -42,22 +42,22 @@ class Zend_Session_SaveHandler_DbTableTest extends PHPUnit_Framework_TestCase /** * @var array */ - protected $_saveHandlerTableConfig = array( + protected $_saveHandlerTableConfig = [ 'name' => 'sessions', - 'primary' => array( + 'primary' => [ 'id', 'save_path', 'name', - ), + ], Zend_Session_SaveHandler_DbTable::MODIFIED_COLUMN => 'modified', Zend_Session_SaveHandler_DbTable::LIFETIME_COLUMN => 'lifetime', Zend_Session_SaveHandler_DbTable::DATA_COLUMN => 'data', - Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT => array( + Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT => [ Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT_SESSION_ID, Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT_SESSION_SAVE_PATH, Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT_SESSION_NAME, - ), - ); + ], + ]; /** * @var Zend_Db_Adapter_Abstract @@ -70,7 +70,7 @@ class Zend_Session_SaveHandler_DbTableTest extends PHPUnit_Framework_TestCase * * @var array */ - protected $_usedSaveHandlers = array(); + protected $_usedSaveHandlers = []; /** * Setup performed prior to each test method @@ -144,7 +144,7 @@ public function testPrimaryAssignmentIdNotSet() { $this->setExpectedException('Zend_Session_SaveHandler_Exception'); $config = $this->_saveHandlerTableConfig; - $config['primary'] = array('id'); + $config['primary'] = ['id']; $config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT] = Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT_SESSION_SAVE_PATH; $this->_usedSaveHandlers[] = @@ -157,7 +157,7 @@ public function testPrimaryAssignmentIdNotSet() public function testPrimaryAssignmentNotArray() { $config = $this->_saveHandlerTableConfig; - $config['primary'] = array('id'); + $config['primary'] = ['id']; $config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT] = Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT_SESSION_ID; $this->_usedSaveHandlers[] = @@ -237,9 +237,9 @@ public function testSessionIdPresent() //test that the session Id must be in the primary assignment config try { $config = $this->_saveHandlerTableConfig; - $config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT] = array( + $config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT] = [ Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT_SESSION_NAME, - ); + ]; $this->_usedSaveHandlers[] = $saveHandler = new Zend_Session_SaveHandler_DbTable($config); $this->fail(); @@ -340,7 +340,7 @@ public function testSessionSaving() $config = $this->_saveHandlerTableConfig; unset($config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT]); - $config['primary'] = array($config['primary'][0]); + $config['primary'] = [$config['primary'][0]]; $this->_setupDb($config['primary']); @@ -357,7 +357,7 @@ public function testSessionSaving() $session = new Zend_Session_Namespace('SaveHandler'); $session->testArray = $this->_saveHandlerTableConfig; - $tmp = array('SaveHandler' => serialize(array('testArray' => $this->_saveHandlerTableConfig))); + $tmp = ['SaveHandler' => serialize(['testArray' => $this->_saveHandlerTableConfig])]; $testAgainst = ''; foreach ($tmp as $key => $val) { $testAgainst .= $key . "|" . $val; @@ -376,7 +376,7 @@ public function testReadWrite() { $config = $this->_saveHandlerTableConfig; unset($config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT]); - $config['primary'] = array($config['primary'][0]); + $config['primary'] = [$config['primary'][0]]; $this->_setupDb($config['primary']); $this->_usedSaveHandlers[] = $saveHandler = new Zend_Session_SaveHandler_DbTable($config); @@ -407,7 +407,7 @@ public function testReadWriteTwice() { $config = $this->_saveHandlerTableConfig; unset($config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT]); - $config['primary'] = array($config['primary'][0]); + $config['primary'] = [$config['primary'][0]]; $this->_setupDb($config['primary']); $this->_usedSaveHandlers[] = $saveHandler = new Zend_Session_SaveHandler_DbTable($config); @@ -427,7 +427,7 @@ public function testReadWriteTwiceAndExpire() { $config = $this->_saveHandlerTableConfig; unset($config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT]); - $config['primary'] = array($config['primary'][0]); + $config['primary'] = [$config['primary'][0]]; $config['lifetime'] = 1; $this->_setupDb($config['primary']); @@ -457,7 +457,7 @@ public function testReadWriteThreeTimesAndGc() $config = $this->_saveHandlerTableConfig; unset($config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT]); - $config['primary'] = array($config['primary'][0]); + $config['primary'] = [$config['primary'][0]]; $config['lifetime'] = 1; $this->_setupDb($config['primary']); @@ -498,7 +498,7 @@ public function testSetLifetime() { $config = $this->_saveHandlerTableConfig; unset($config[Zend_Session_SaveHandler_DbTable::PRIMARY_ASSIGNMENT]); - $config['primary'] = array($config['primary'][0]); + $config['primary'] = [$config['primary'][0]]; $config['lifetime'] = 1; $this->_setupDb($config['primary']); @@ -527,12 +527,12 @@ public function testDestroyWithAutoQuoteIdentifiersEnabledAndDisabled() { $id = uniqid(); $config = $this->_saveHandlerTableConfig; - $configDb = array( - 'options' => array( + $configDb = [ + 'options' => [ 'autoQuoteIdentifiers' => false, - ), + ], 'profiler' => true - ); + ]; $this->_setupDb($config['primary'], $configDb); $config['db'] = $this->_db; @@ -545,12 +545,12 @@ public function testDestroyWithAutoQuoteIdentifiersEnabledAndDisabled() $partQueryExpected = "WHERE (id = '$id') AND (save_path = '') AND (name = '')"; $this->assertContains($partQueryExpected, $lastQuery); - $configDb = array( - 'options' => array( + $configDb = [ + 'options' => [ 'autoQuoteIdentifiers' => true, - ), + ], 'profiler' => true - ); + ]; $this->_setupDb($config['primary'], $configDb); $config['db'] = $this->_db; @@ -570,12 +570,12 @@ public function testDestroyWithAutoQuoteIdentifiersEnabledAndDisabled() public function testGcWithAutoQuoteIdentifiersEnabledAndDisabled() { $config = $this->_saveHandlerTableConfig; - $configDb = array( - 'options' => array( + $configDb = [ + 'options' => [ 'autoQuoteIdentifiers' => false, - ), + ], 'profiler' => true - ); + ]; $this->_setupDb($config['primary'], $configDb); $config['db'] = $this->_db; @@ -588,12 +588,12 @@ public function testGcWithAutoQuoteIdentifiersEnabledAndDisabled() $partQueryExpected = "WHERE (modified + lifetime < "; $this->assertContains($partQueryExpected, $lastQuery); - $configDb = array( - 'options' => array( + $configDb = [ + 'options' => [ 'autoQuoteIdentifiers' => true, - ), + ], 'profiler' => true - ); + ]; $this->_setupDb($config['primary'], $configDb); $config['db'] = $this->_db; @@ -613,15 +613,15 @@ public function testGcWithAutoQuoteIdentifiersEnabledAndDisabled() * @param array $primary * @return void */ - protected function _setupDb(array $primary, array $config = array()) + protected function _setupDb(array $primary, array $config = []) { if (!extension_loaded('pdo_sqlite')) { $this->markTestSkipped('The pdo_sqlite extension must be available and enabled for this test'); } - $this->_db = Zend_Db::factory('Pdo_Sqlite', array('dbname' => ':memory:') + $config); + $this->_db = Zend_Db::factory('Pdo_Sqlite', ['dbname' => ':memory:'] + $config); Zend_Db_Table_Abstract::setDefaultAdapter($this->_db); - $query = array(); + $query = []; $query[] = 'CREATE TABLE `Sessions` ( '; $query[] = '`id` varchar(32) NOT NULL, '; if (in_array('save_path', $primary)) { diff --git a/tests/Zend/Session/SessionTest.php b/tests/Zend/Session/SessionTest.php index b59c4a2b18..e3da21c663 100644 --- a/tests/Zend/Session/SessionTest.php +++ b/tests/Zend/Session/SessionTest.php @@ -57,7 +57,7 @@ class Zend_SessionTest extends PHPUnit_Framework_TestCase * * @return void */ - public function __construct($name = NULL, array $data = array(), $dataName = '') + public function __construct($name = NULL, array $data = [], $dataName = '') { parent::__construct($name, $data, $dataName); $this->_script = 'php ' @@ -168,17 +168,17 @@ public function testRegenerateId() public function testSetOptions() { try { - Zend_Session::setOptions(array('foo' => 'break me')); + Zend_Session::setOptions(['foo' => 'break me']); $this->fail('Expected Zend_Session_Exception not thrown when trying to set an invalid option'); } catch (Zend_Session_Exception $e) { $this->assertRegexp('/unknown.option/i', $e->getMessage()); } - Zend_Session::setOptions(array('save_path' => '1;777;/tmp')); + Zend_Session::setOptions(['save_path' => '1;777;/tmp']); - Zend_Session::setOptions(array('save_path' => '2;/tmp')); + Zend_Session::setOptions(['save_path' => '2;/tmp']); - Zend_Session::setOptions(array('save_path' => '/tmp')); + Zend_Session::setOptions(['save_path' => '/tmp']); } /** @@ -521,7 +521,7 @@ public function testUnlock() */ public function testUnLockAll() { - $sessions = array('one', 'two', 'default', 'three'); + $sessions = ['one', 'two', 'default', 'three']; foreach ($sessions as $namespace) { $s = new Zend_Session_Namespace($namespace); $s->a = 'apple'; @@ -1043,12 +1043,12 @@ public function testProcessSessionMetadataShouldNotThrowAnError() public function testGetNameSpaceMethod() { Zend_Session::$_unitTestEnabled = true; - $namespace = array( + $namespace = [ 'FooBar', 'Foo_Bar', 'Foo-Bar', 'Foo1000' - ); + ]; foreach ($namespace as $v) { $s = new Zend_Session_Namespace($v); $this->assertEquals($v, $s->getNamespace()); diff --git a/tests/Zend/Session/SessionTestHelper.php b/tests/Zend/Session/SessionTestHelper.php index 9bd5e04043..3d43754839 100644 --- a/tests/Zend/Session/SessionTestHelper.php +++ b/tests/Zend/Session/SessionTestHelper.php @@ -68,7 +68,7 @@ public function run(array $argv) */ public function doExpireAll(array $args) { - Zend_Session::setOptions(array('remember_me_seconds' => 15, 'gc_probability' => 2)); + Zend_Session::setOptions(['remember_me_seconds' => 15, 'gc_probability' => 2]); session_id($args[0]); if (isset($args[1]) && !empty($args[1])) { $s = new Zend_Session_Namespace($args[1]); @@ -140,7 +140,7 @@ public function doGetArray(array $args) } $result = ''; foreach ($s->getIterator() as $key => $val) { - $result .= "$key === ". (str_replace(array("\n", ' '),array(';',''), print_r($val, true))) .';'; + $result .= "$key === ". (str_replace(["\n", ' '],[';',''], print_r($val, true))) .';'; } // file_put_contents('out.sesstiontest.get', print_r($s->someArray, true)); Zend_Session::writeClose(); diff --git a/tests/Zend/Soap/AutoDiscoverTest.php b/tests/Zend/Soap/AutoDiscoverTest.php index cbb8737678..1d3aa42b31 100644 --- a/tests/Zend/Soap/AutoDiscoverTest.php +++ b/tests/Zend/Soap/AutoDiscoverTest.php @@ -49,7 +49,7 @@ public function setUp() // This has to be done because some CLI setups don't have $_SERVER variables // to simuulate that we have an actual webserver. if(!isset($_SERVER) || !is_array($_SERVER)) { - $_SERVER = array(); + $_SERVER = []; } $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['REQUEST_URI'] = '/my_script.php?wsdl'; @@ -59,7 +59,7 @@ public function setUp() protected function sanitizeWsdlXmlOutputForOsCompability($xmlstring) { - $xmlstring = str_replace(array("\r", "\n"), "", $xmlstring); + $xmlstring = str_replace(["\r", "\n"], "", $xmlstring); $xmlstring = preg_replace('/(>[\s]{1,}<)/', '', $xmlstring); return $xmlstring; } @@ -158,8 +158,8 @@ function testSetClassWithDifferentStyles() $scriptUri = 'http://localhost/my_script.php'; $server = new Zend_Soap_AutoDiscover(); - $server->setBindingStyle(array('style' => 'document', 'transport' => 'http://framework.zend.com')); - $server->setOperationBodyStyle(array('use' => 'literal', 'namespace' => 'http://framework.zend.com')); + $server->setBindingStyle(['style' => 'document', 'transport' => 'http://framework.zend.com']); + $server->setOperationBodyStyle(['use' => 'literal', 'namespace' => 'http://framework.zend.com']); $server->setClass('Zend_Soap_AutoDiscover_Test'); $dom = new DOMDocument(); ob_start(); @@ -382,8 +382,8 @@ function testAddFunctionSimpleWithDifferentStyle() $scriptUri = 'http://localhost/my_script.php'; $server = new Zend_Soap_AutoDiscover(); - $server->setBindingStyle(array('style' => 'document', 'transport' => 'http://framework.zend.com')); - $server->setOperationBodyStyle(array('use' => 'literal', 'namespace' => 'http://framework.zend.com')); + $server->setBindingStyle(['style' => 'document', 'transport' => 'http://framework.zend.com']); + $server->setOperationBodyStyle(['use' => 'literal', 'namespace' => 'http://framework.zend.com']); $server->addFunction('Zend_Soap_AutoDiscover_TestFunc'); $dom = new DOMDocument(); ob_start(); @@ -619,7 +619,7 @@ public function testSetNonStringNonZendUriUriThrowsException() { $server = new Zend_Soap_AutoDiscover(); try { - $server->setUri(array("bogus")); + $server->setUri(["bogus"]); $this->fail(); } catch(Zend_Soap_AutoDiscover_Exception $e) { @@ -708,7 +708,7 @@ public function testGetFunctions() $functions = $server->getFunctions(); $this->assertEquals( - array('Zend_Soap_AutoDiscover_TestFunc', 'testFunc1', 'testFunc2', 'testFunc3', 'testFunc4'), + ['Zend_Soap_AutoDiscover_TestFunc', 'testFunc1', 'testFunc2', 'testFunc3', 'testFunc4'], $functions ); } @@ -719,35 +719,35 @@ public function testGetFunctions() public function testUsingRequestUriWithoutParametersAsDefault() { // Apache - $_SERVER = array('REQUEST_URI' => '/my_script.php?wsdl', 'HTTP_HOST' => 'localhost'); + $_SERVER = ['REQUEST_URI' => '/my_script.php?wsdl', 'HTTP_HOST' => 'localhost']; $server = new Zend_Soap_AutoDiscover(); $uri = $server->getUri()->getUri(); $this->assertNotContains("?wsdl", $uri); $this->assertEquals("http://localhost/my_script.php", $uri); // Apache plus SSL - $_SERVER = array('REQUEST_URI' => '/my_script.php?wsdl', 'HTTP_HOST' => 'localhost', 'HTTPS' => 'on'); + $_SERVER = ['REQUEST_URI' => '/my_script.php?wsdl', 'HTTP_HOST' => 'localhost', 'HTTPS' => 'on']; $server = new Zend_Soap_AutoDiscover(); $uri = $server->getUri()->getUri(); $this->assertNotContains("?wsdl", $uri); $this->assertEquals("https://localhost/my_script.php", $uri); // IIS 5 + PHP as FastCGI - $_SERVER = array('ORIG_PATH_INFO' => '/my_script.php?wsdl', 'SERVER_NAME' => 'localhost'); + $_SERVER = ['ORIG_PATH_INFO' => '/my_script.php?wsdl', 'SERVER_NAME' => 'localhost']; $server = new Zend_Soap_AutoDiscover(); $uri = $server->getUri()->getUri(); $this->assertNotContains("?wsdl", $uri); $this->assertEquals("http://localhost/my_script.php", $uri); // IIS with ISAPI_Rewrite - $_SERVER = array('HTTP_X_REWRITE_URL' => '/my_script.php?wsdl', 'SERVER_NAME' => 'localhost'); + $_SERVER = ['HTTP_X_REWRITE_URL' => '/my_script.php?wsdl', 'SERVER_NAME' => 'localhost']; $server = new Zend_Soap_AutoDiscover(); $uri = $server->getUri()->getUri(); $this->assertNotContains("?wsdl", $uri); $this->assertEquals("http://localhost/my_script.php", $uri); // IIS with Microsoft Rewrite Module - $_SERVER = array('HTTP_X_ORIGINAL_URL' => '/my_script.php?wsdl', 'SERVER_NAME' => 'localhost'); + $_SERVER = ['HTTP_X_ORIGINAL_URL' => '/my_script.php?wsdl', 'SERVER_NAME' => 'localhost']; $server = new Zend_Soap_AutoDiscover(); $uri = $server->getUri()->getUri(); $this->assertNotContains("?wsdl", $uri); diff --git a/tests/Zend/Soap/ClientTest.php b/tests/Zend/Soap/ClientTest.php index d738f395ae..20f4fa33ff 100644 --- a/tests/Zend/Soap/ClientTest.php +++ b/tests/Zend/Soap/ClientTest.php @@ -67,13 +67,13 @@ public function testSetOptions() *************************************************************/ $client = new Zend_Soap_Client(); - $this->assertTrue($client->getOptions() == array('encoding' => 'UTF-8', 'soap_version' => SOAP_1_2)); + $this->assertTrue($client->getOptions() == ['encoding' => 'UTF-8', 'soap_version' => SOAP_1_2]); $ctx = stream_context_create(); - $nonWsdlOptions = array('soap_version' => SOAP_1_1, - 'classmap' => array('TestData1' => 'Zend_Soap_Client_TestData1', - 'TestData2' => 'Zend_Soap_Client_TestData2',), + $nonWsdlOptions = ['soap_version' => SOAP_1_1, + 'classmap' => ['TestData1' => 'Zend_Soap_Client_TestData1', + 'TestData2' => 'Zend_Soap_Client_TestData2',], 'encoding' => 'ISO-8859-1', 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', 'location' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', @@ -95,7 +95,7 @@ public function testSetOptions() 'cache_wsdl' => 8, 'features' => 4, - 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5); + 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5]; $client->setOptions($nonWsdlOptions); $this->assertTrue($client->getOptions() == $nonWsdlOptions); @@ -106,12 +106,12 @@ public function testSetOptions() *************************************************************/ $client1 = new Zend_Soap_Client(); - $this->assertTrue($client1->getOptions() == array('encoding' => 'UTF-8', 'soap_version' => SOAP_1_2)); + $this->assertTrue($client1->getOptions() == ['encoding' => 'UTF-8', 'soap_version' => SOAP_1_2]); - $wsdlOptions = array('soap_version' => SOAP_1_1, + $wsdlOptions = ['soap_version' => SOAP_1_1, 'wsdl' => dirname(__FILE__).'/_files/wsdl_example.wsdl', - 'classmap' => array('TestData1' => 'Zend_Soap_Client_TestData1', - 'TestData2' => 'Zend_Soap_Client_TestData2',), + 'classmap' => ['TestData1' => 'Zend_Soap_Client_TestData1', + 'TestData2' => 'Zend_Soap_Client_TestData2',], 'encoding' => 'ISO-8859-1', 'login' => 'http_login', @@ -127,7 +127,7 @@ public function testSetOptions() 'stream_context' => $ctx, - 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5); + 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5]; $client1->setOptions($wsdlOptions); $this->assertTrue($client1->getOptions() == $wsdlOptions); @@ -137,13 +137,13 @@ public function testGetOptions() { $client = new Zend_Soap_Client(); - $this->assertTrue($client->getOptions() == array('encoding' => 'UTF-8', 'soap_version' => SOAP_1_2)); + $this->assertTrue($client->getOptions() == ['encoding' => 'UTF-8', 'soap_version' => SOAP_1_2]); - $options = array('soap_version' => SOAP_1_1, + $options = ['soap_version' => SOAP_1_1, 'wsdl' => dirname(__FILE__).'/_files/wsdl_example.wsdl', - 'classmap' => array('TestData1' => 'Zend_Soap_Client_TestData1', - 'TestData2' => 'Zend_Soap_Client_TestData2',), + 'classmap' => ['TestData1' => 'Zend_Soap_Client_TestData1', + 'TestData2' => 'Zend_Soap_Client_TestData2',], 'encoding' => 'ISO-8859-1', 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', 'location' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', @@ -161,7 +161,7 @@ public function testGetOptions() 'local_cert' => dirname(__FILE__).'/_files/cert_file', 'passphrase' => 'some pass phrase', - 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5); + 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5]; $client->setOptions($options); $this->assertTrue($client->getOptions() == $options); @@ -178,19 +178,19 @@ public function testGetAndSetUserAgentOption() $client->setUserAgent('agent1'); $this->assertEquals('agent1', $client->getUserAgent()); - $client->setOptions(array( + $client->setOptions([ 'user_agent' => 'agent2' - )); + ]); $this->assertEquals('agent2', $client->getUserAgent()); - $client->setOptions(array( + $client->setOptions([ 'useragent' => 'agent3' - )); + ]); $this->assertEquals('agent3', $client->getUserAgent()); - $client->setOptions(array( + $client->setOptions([ 'userAgent' => 'agent4' - )); + ]); $this->assertEquals('agent4', $client->getUserAgent()); $options = $client->getOptions(); @@ -268,10 +268,10 @@ public function testGetAndSetExceptionsOption() $client = new Zend_Soap_Client(); $this->assertNull($client->getExceptions()); $this->assertEquals( - array( + [ 'encoding' => 'UTF-8', 'soap_version' => 2, - ), + ], $client->getOptions() ); @@ -281,17 +281,17 @@ public function testGetAndSetExceptionsOption() $client->setExceptions(false); $this->assertFalse($client->getExceptions()); - $client->setOptions(array('exceptions' => true)); + $client->setOptions(['exceptions' => true]); $this->assertTrue($client->getExceptions()); - $client = new Zend_Soap_Client(null, array('exceptions' => false)); + $client = new Zend_Soap_Client(null, ['exceptions' => false]); $this->assertFalse($client->getExceptions()); $this->assertEquals( - array( + [ 'encoding' => 'UTF-8', 'soap_version' => 2, 'exceptions' => false, - ), + ], $client->getOptions() ); } @@ -303,10 +303,10 @@ public function testGetFunctions() $client = new Zend_Soap_Client_Local($server, dirname(__FILE__) . '/_files/wsdl_example.wsdl'); - $this->assertTrue($client->getFunctions() == array('string testFunc1()', + $this->assertTrue($client->getFunctions() == ['string testFunc1()', 'string testFunc2(string $who)', 'string testFunc3(string $who, int $when)', - 'string testFunc4()')); + 'string testFunc4()']); } /** @@ -400,9 +400,9 @@ public function testSetOptionsWithZendConfig() { $ctx = stream_context_create(); - $nonWsdlOptions = array('soap_version' => SOAP_1_1, - 'classmap' => array('TestData1' => 'Zend_Soap_Client_TestData1', - 'TestData2' => 'Zend_Soap_Client_TestData2',), + $nonWsdlOptions = ['soap_version' => SOAP_1_1, + 'classmap' => ['TestData1' => 'Zend_Soap_Client_TestData1', + 'TestData2' => 'Zend_Soap_Client_TestData2',], 'encoding' => 'ISO-8859-1', 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', 'location' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', @@ -423,7 +423,7 @@ public function testSetOptionsWithZendConfig() 'stream_context' => $ctx, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5 - ); + ]; $config = new Zend_Config($nonWsdlOptions); @@ -533,7 +533,7 @@ public function testSetCookieIsDelegatedToSoapClient() $fixtureCookieKey = "foo"; $fixtureCookieValue = "bar"; - $clientMock = $this->getMock('SoapClient', array('__setCookie'), array(null, array('uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com'))); + $clientMock = $this->getMock('SoapClient', ['__setCookie'], [null, ['uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com']]); $clientMock->expects($this->once()) ->method('__setCookie') ->with($fixtureCookieKey, $fixtureCookieValue); @@ -546,7 +546,7 @@ public function testSetCookieIsDelegatedToSoapClient() public function testSetSoapClient() { - $clientMock = $this->getMock('SoapClient', array('__setCookie'), array(null, array('uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com'))); + $clientMock = $this->getMock('SoapClient', ['__setCookie'], [null, ['uri' => 'http://www.zend.com', 'location' => 'http://www.zend.com']]); $soap = new Zend_Soap_Client(); $soap->setSoapClient($clientMock); diff --git a/tests/Zend/Soap/ServerTest.php b/tests/Zend/Soap/ServerTest.php index 06b9fe8bf6..2c30aef47b 100644 --- a/tests/Zend/Soap/ServerTest.php +++ b/tests/Zend/Soap/ServerTest.php @@ -54,15 +54,15 @@ public function testSetOptions() { $server = new Zend_Soap_Server(); - $this->assertTrue($server->getOptions() == array('soap_version' => SOAP_1_2)); + $this->assertTrue($server->getOptions() == ['soap_version' => SOAP_1_2]); - $options = array('soap_version' => SOAP_1_1, + $options = ['soap_version' => SOAP_1_1, 'actor' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', - 'classmap' => array('TestData1' => 'Zend_Soap_Server_TestData1', - 'TestData2' => 'Zend_Soap_Server_TestData2',), + 'classmap' => ['TestData1' => 'Zend_Soap_Server_TestData1', + 'TestData2' => 'Zend_Soap_Server_TestData2',], 'encoding' => 'ISO-8859-1', 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php' - ); + ]; $server->setOptions($options); $this->assertTrue($server->getOptions() == $options); @@ -70,16 +70,16 @@ public function testSetOptions() public function testSetOptionsViaSecondConstructorArgument() { - $options = array( + $options = [ 'soap_version' => SOAP_1_1, 'actor' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', - 'classmap' => array( + 'classmap' => [ 'TestData1' => 'Zend_Soap_Server_TestData1', 'TestData2' => 'Zend_Soap_Server_TestData2', - ), + ], 'encoding' => 'ISO-8859-1', 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', - ); + ]; $server = new Zend_Soap_Server(null, $options); $this->assertTrue($server->getOptions() == $options); @@ -87,9 +87,9 @@ public function testSetOptionsViaSecondConstructorArgument() public function testSetWsiCompliantViaConstructor() { - $options = array( + $options = [ 'wsi_compliant' => true - ); + ]; $server = new Zend_Soap_Server(null, $options); $this->assertTrue($server->getWsiCompliant()); } @@ -108,9 +108,9 @@ public function testSetWsiCompliant() */ public function testSetOptionsWithFeaturesOption() { - $server = new Zend_Soap_Server(null, array( + $server = new Zend_Soap_Server(null, [ 'features' => SOAP_SINGLE_ELEMENT_ARRAYS - )); + ]); $this->assertEquals( SOAP_SINGLE_ELEMENT_ARRAYS, @@ -121,7 +121,7 @@ public function testSetOptionsWithFeaturesOption() public function testSetWsdlViaOptionsArrayIsPossible() { $server = new Zend_Soap_Server(); - $server->setOptions(array('wsdl' => 'http://www.example.com/test.wsdl')); + $server->setOptions(['wsdl' => 'http://www.example.com/test.wsdl']); $this->assertEquals('http://www.example.com/test.wsdl', $server->getWsdl()); } @@ -130,11 +130,11 @@ public function testGetOptions() { $server = new Zend_Soap_Server(); - $this->assertTrue($server->getOptions() == array('soap_version' => SOAP_1_2)); + $this->assertTrue($server->getOptions() == ['soap_version' => SOAP_1_2]); - $options = array('soap_version' => SOAP_1_1, + $options = ['soap_version' => SOAP_1_1, 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php' - ); + ]; $server->setOptions($options); $this->assertTrue($server->getOptions() == $options); @@ -149,7 +149,7 @@ public function testEncoding() $this->assertEquals('ISO-8859-1', $server->getEncoding()); try { - $server->setEncoding(array('UTF-8')); + $server->setEncoding(['UTF-8']); $this->fail('Non-string encoding values should fail'); } catch (Exception $e) { // success @@ -238,8 +238,8 @@ public function testSetClassmap() { $server = new Zend_Soap_Server(); - $classmap = array('TestData1' => 'Zend_Soap_Server_TestData1', - 'TestData2' => 'Zend_Soap_Server_TestData2'); + $classmap = ['TestData1' => 'Zend_Soap_Server_TestData1', + 'TestData2' => 'Zend_Soap_Server_TestData2']; $this->assertNull($server->getClassmap()); $server->setClassmap($classmap); @@ -251,7 +251,7 @@ public function testSetClassmap() // success } try { - $server->setClassmap(array('soapTypeName', 'bogusClassName')); + $server->setClassmap(['soapTypeName', 'bogusClassName']); $this->fail('Invalid class within classmap should fail'); } catch (Exception $e) { // success @@ -262,8 +262,8 @@ public function testGetClassmap() { $server = new Zend_Soap_Server(); - $classmap = array('TestData1' => 'Zend_Soap_Server_TestData1', - 'TestData2' => 'Zend_Soap_Server_TestData2'); + $classmap = ['TestData1' => 'Zend_Soap_Server_TestData1', + 'TestData2' => 'Zend_Soap_Server_TestData2']; $this->assertNull($server->getClassmap()); $server->setClassmap($classmap); @@ -302,13 +302,13 @@ public function testAddFunction() $server->addFunction('Zend_Soap_Server_TestFunc1'); // Array of correct functions should pass - $functions = array('Zend_Soap_Server_TestFunc2', + $functions = ['Zend_Soap_Server_TestFunc2', 'Zend_Soap_Server_TestFunc3', - 'Zend_Soap_Server_TestFunc4'); + 'Zend_Soap_Server_TestFunc4']; $server->addFunction($functions); $this->assertEquals( - array_merge(array('Zend_Soap_Server_TestFunc1'), $functions), + array_merge(['Zend_Soap_Server_TestFunc1'], $functions), $server->getFunctions() ); } @@ -341,9 +341,9 @@ public function testAddBogusFunctionsAsArray() $server = new Zend_Soap_Server(); try { - $functions = array('Zend_Soap_Server_TestFunc5', + $functions = ['Zend_Soap_Server_TestFunc5', 'bogus_function', - 'Zend_Soap_Server_TestFunc6'); + 'Zend_Soap_Server_TestFunc6']; $server->addFunction($functions); $this->fail('Invalid function within a set of functions should fail'); } catch (Zend_Soap_Server_Exception $e) { @@ -358,7 +358,7 @@ public function testAddAllFunctionsSoapConstant() // SOAP_FUNCTIONS_ALL as a value should pass $server->addFunction(SOAP_FUNCTIONS_ALL); $server->addFunction('substr'); - $this->assertEquals(array(SOAP_FUNCTIONS_ALL), $server->getFunctions()); + $this->assertEquals([SOAP_FUNCTIONS_ALL], $server->getFunctions()); } public function testSetClass() @@ -462,24 +462,24 @@ public function testGetFunctions() $server->addFunction('Zend_Soap_Server_TestFunc1'); - $functions = array('Zend_Soap_Server_TestFunc2', + $functions = ['Zend_Soap_Server_TestFunc2', 'Zend_Soap_Server_TestFunc3', - 'Zend_Soap_Server_TestFunc4'); + 'Zend_Soap_Server_TestFunc4']; $server->addFunction($functions); - $functions = array('Zend_Soap_Server_TestFunc3', + $functions = ['Zend_Soap_Server_TestFunc3', 'Zend_Soap_Server_TestFunc5', - 'Zend_Soap_Server_TestFunc6'); + 'Zend_Soap_Server_TestFunc6']; $server->addFunction($functions); - $allAddedFunctions = array( + $allAddedFunctions = [ 'Zend_Soap_Server_TestFunc1', 'Zend_Soap_Server_TestFunc2', 'Zend_Soap_Server_TestFunc3', 'Zend_Soap_Server_TestFunc4', 'Zend_Soap_Server_TestFunc5', 'Zend_Soap_Server_TestFunc6' - ); + ]; $this->assertTrue($server->getFunctions() == $allAddedFunctions); } @@ -489,7 +489,7 @@ public function testGetFunctionsWithClassAttached() $server->setClass('Zend_Soap_Server_TestClass'); $this->assertEquals( - array('testFunc1', 'testFunc2', 'testFunc3', 'testFunc4', 'testFunc5'), + ['testFunc1', 'testFunc2', 'testFunc3', 'testFunc4', 'testFunc5'], $server->getFunctions() ); } @@ -500,7 +500,7 @@ public function testGetFunctionsWithObjectAttached() $server->setObject(new Zend_Soap_Server_TestClass()); $this->assertEquals( - array('testFunc1', 'testFunc2', 'testFunc3', 'testFunc4', 'testFunc5'), + ['testFunc1', 'testFunc2', 'testFunc3', 'testFunc4', 'testFunc5'], $server->getFunctions() ); } @@ -556,7 +556,7 @@ public function testGetLastRequest() } $server = new Zend_Soap_Server(); - $server->setOptions(array('location'=>'test://', 'uri'=>'http://framework.zend.com')); + $server->setOptions(['location'=>'test://', 'uri'=>'http://framework.zend.com']); $server->setReturnResponse(true); $server->setClass('Zend_Soap_Server_TestClass'); @@ -587,8 +587,8 @@ public function testGetLastRequest() */ public function testWsiCompliant() { - $server = new Zend_Soap_Server(null, array('wsi_compliant' => true)); - $server->setOptions(array('location'=>'test://', 'uri'=>'http://framework.zend.com')); + $server = new Zend_Soap_Server(null, ['wsi_compliant' => true]); + $server->setOptions(['location'=>'test://', 'uri'=>'http://framework.zend.com']); $server->setReturnResponse(true); $server->setClass('Zend_Soap_Server_TestClass'); @@ -665,7 +665,7 @@ public function testGetLastResponse() } $server = new Zend_Soap_Server(); - $server->setOptions(array('location'=>'test://', 'uri'=>'http://framework.zend.com')); + $server->setOptions(['location'=>'test://', 'uri'=>'http://framework.zend.com']); $server->setReturnResponse(true); $server->setClass('Zend_Soap_Server_TestClass'); @@ -713,14 +713,14 @@ public function testHandle() } $server = new Zend_Soap_Server(); - $server->setOptions(array('location'=>'test://', 'uri'=>'http://framework.zend.com')); + $server->setOptions(['location'=>'test://', 'uri'=>'http://framework.zend.com']); $server->setClass('Zend_Soap_Server_TestClass'); $localClient = new Zend_Soap_Server_TestLocalSoapClient($server, null, - array('location'=>'test://', - 'uri'=>'http://framework.zend.com')); + ['location'=>'test://', + 'uri'=>'http://framework.zend.com']); // Local SOAP client call automatically invokes handle method of the provided SOAP server $this->assertEquals('Hello World!', $localClient->testFunc2('World')); @@ -757,7 +757,7 @@ public function testHandle() . '' . "\n"; $server1 = new Zend_Soap_Server(); - $server1->setOptions(array('location'=>'test://', 'uri'=>'http://framework.zend.com')); + $server1->setOptions(['location'=>'test://', 'uri'=>'http://framework.zend.com']); $server1->setClass('Zend_Soap_Server_TestClass'); $server1->setReturnResponse(true); @@ -773,13 +773,13 @@ public function testRegisterFaultException() $server = new Zend_Soap_Server(); $server->registerFaultException("Zend_Soap_Server_Exception"); - $server->registerFaultException(array("OutOfBoundsException", "BogusException")); + $server->registerFaultException(["OutOfBoundsException", "BogusException"]); - $this->assertEquals(array( + $this->assertEquals([ 'Zend_Soap_Server_Exception', 'OutOfBoundsException', 'BogusException', - ), $server->getFaultExceptions()); + ], $server->getFaultExceptions()); } /** @@ -789,13 +789,13 @@ public function testDeregisterFaultException() { $server = new Zend_Soap_Server(); - $server->registerFaultException(array("OutOfBoundsException", "BogusException")); + $server->registerFaultException(["OutOfBoundsException", "BogusException"]); $ret = $server->deregisterFaultException("BogusException"); $this->assertTrue($ret); - $this->assertEquals(array( + $this->assertEquals([ 'OutOfBoundsException', - ), $server->getFaultExceptions()); + ], $server->getFaultExceptions()); $ret = $server->deregisterFaultException("NonRegisteredException"); $this->assertFalse($ret); @@ -808,9 +808,9 @@ public function testGetFaultExceptions() { $server = new Zend_Soap_Server(); - $this->assertEquals(array(), $server->getFaultExceptions()); + $this->assertEquals([], $server->getFaultExceptions()); $server->registerFaultException("Exception"); - $this->assertEquals(array("Exception"), $server->getFaultExceptions()); + $this->assertEquals(["Exception"], $server->getFaultExceptions()); } public function testFaultWithTextMessage() @@ -846,7 +846,7 @@ public function testFaultWithRegisteredException() public function testFautlWithBogusInput() { $server = new Zend_Soap_Server(); - $fault = $server->fault(array("Here", "There", "Bogus")); + $fault = $server->fault(["Here", "There", "Bogus"]); $this->assertContains("Unknown error", $fault->getMessage()); } @@ -898,7 +898,7 @@ public function testErrorHandlingOfSoapServerChangesToThrowingSoapFaultWhenInHan } $server = new Zend_Soap_Server(); - $server->setOptions(array('location'=>'test://', 'uri'=>'http://framework.zend.com')); + $server->setOptions(['location'=>'test://', 'uri'=>'http://framework.zend.com']); $server->setReturnResponse(true); // Requesting Method with enforced parameter without it. @@ -929,13 +929,13 @@ public function testErrorHandlingOfSoapServerChangesToThrowingSoapFaultWhenInHan */ public function testServerAcceptsZendConfigObject() { - $options = array('soap_version' => SOAP_1_1, + $options = ['soap_version' => SOAP_1_1, 'actor' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', - 'classmap' => array('TestData1' => 'Zend_Soap_Server_TestData1', - 'TestData2' => 'Zend_Soap_Server_TestData2',), + 'classmap' => ['TestData1' => 'Zend_Soap_Server_TestData1', + 'TestData2' => 'Zend_Soap_Server_TestData2',], 'encoding' => 'ISO-8859-1', 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php' - ); + ]; $config = new Zend_Config($options); $server = new Zend_Soap_Server(); diff --git a/tests/Zend/Soap/TestAsset/commontypes.php b/tests/Zend/Soap/TestAsset/commontypes.php index 71f824d3c3..56fdeda383 100644 --- a/tests/Zend/Soap/TestAsset/commontypes.php +++ b/tests/Zend/Soap/TestAsset/commontypes.php @@ -76,7 +76,7 @@ function Zend_Soap_TestAsset_TestFunc6() */ function Zend_Soap_TestAsset_TestFunc7() { - return array('foo' => 'bar', 'baz' => true, 1 => false, 'bat' => 123); + return ['foo' => 'bar', 'baz' => true, 1 => false, 'bat' => 123]; } /** @@ -86,7 +86,7 @@ function Zend_Soap_TestAsset_TestFunc7() */ function Zend_Soap_TestAsset_TestFunc8() { - $return = (object) array('foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false); + $return = (object) ['foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false]; return $return; } @@ -209,10 +209,10 @@ public function add(AutoDiscoverTestClass1 $test) */ public function fetchAll() { - return array( + return [ new AutoDiscoverTestClass1(), new AutoDiscoverTestClass1(), - ); + ]; } /** @@ -251,7 +251,7 @@ class Zend_Soap_TestAsset_ComplexTypeA /** * @var Zend_Soap_TestAsset_ComplexTypeB[] */ - public $baz = array(); + public $baz = []; } /** @@ -292,7 +292,7 @@ class Zend_Soap_TestAsset_ComplexObjectStructure /** * @var array */ - public $array = array(1, 2, 3); + public $array = [1, 2, 3]; } /** diff --git a/tests/Zend/Soap/Wsdl/CompositeStrategyTest.php b/tests/Zend/Soap/Wsdl/CompositeStrategyTest.php index e7f91b9dbf..b4df5b0218 100644 --- a/tests/Zend/Soap/Wsdl/CompositeStrategyTest.php +++ b/tests/Zend/Soap/Wsdl/CompositeStrategyTest.php @@ -47,7 +47,7 @@ class Zend_Soap_Wsdl_CompositeStrategyTest extends PHPUnit_Framework_TestCase { public function testCompositeApiAddingStragiesToTypes() { - $strategy = new Zend_Soap_Wsdl_Strategy_Composite(array(), "Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence"); + $strategy = new Zend_Soap_Wsdl_Strategy_Composite([], "Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence"); $strategy->connectTypeToStrategy("Book", "Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex"); $bookStrategy = $strategy->getStrategyOfType("Book"); @@ -59,7 +59,7 @@ public function testCompositeApiAddingStragiesToTypes() public function testConstructorTypeMapSyntax() { - $typeMap = array("Book" => "Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex"); + $typeMap = ["Book" => "Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex"]; $strategy = new Zend_Soap_Wsdl_Strategy_Composite($typeMap, "Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence"); @@ -74,7 +74,7 @@ public function testCompositeThrowsExceptionOnInvalidType() { $strategy = new Zend_Soap_Wsdl_Strategy_Composite(); try { - $strategy->connectTypeToStrategy(array(), "strategy"); + $strategy->connectTypeToStrategy([], "strategy"); $this->fail(); } catch(Exception $e) { $this->assertTrue($e instanceof Zend_Soap_Wsdl_Exception); @@ -83,7 +83,7 @@ public function testCompositeThrowsExceptionOnInvalidType() public function testCompositeThrowsExceptionOnInvalidStrategy() { - $strategy = new Zend_Soap_Wsdl_Strategy_Composite(array(), "invalid"); + $strategy = new Zend_Soap_Wsdl_Strategy_Composite([], "invalid"); $strategy->connectTypeToStrategy("Book", "strategy"); try { @@ -103,7 +103,7 @@ public function testCompositeThrowsExceptionOnInvalidStrategy() public function testCompositeDelegatesAddingComplexTypesToSubStrategies() { - $strategy = new Zend_Soap_Wsdl_Strategy_Composite(array(), "Zend_Soap_Wsdl_Strategy_AnyType"); + $strategy = new Zend_Soap_Wsdl_Strategy_Composite([], "Zend_Soap_Wsdl_Strategy_AnyType"); $strategy->connectTypeToStrategy("Zend_Soap_Wsdl_Book", "Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex"); $strategy->connectTypeToStrategy("Zend_Soap_Wsdl_Cookie", "Zend_Soap_Wsdl_Strategy_DefaultComplexType"); diff --git a/tests/Zend/Soap/WsdlTest.php b/tests/Zend/Soap/WsdlTest.php index 25ca1e1d34..2db5901829 100644 --- a/tests/Zend/Soap/WsdlTest.php +++ b/tests/Zend/Soap/WsdlTest.php @@ -44,7 +44,7 @@ class Zend_Soap_WsdlTest extends PHPUnit_Framework_TestCase { protected function sanitizeWsdlXmlOutputForOsCompability($xmlstring) { - $xmlstring = str_replace(array("\r", "\n"), "", $xmlstring); + $xmlstring = str_replace(["\r", "\n"], "", $xmlstring); $xmlstring = preg_replace('/(>[\s]{1,}<)/', '', $xmlstring); return $xmlstring; } @@ -84,7 +84,7 @@ function testAddMessage() { $wsdl = new Zend_Soap_Wsdl('MyService', 'http://localhost/MyService.php'); - $messageParts = array(); + $messageParts = []; $messageParts['parameter1'] = $wsdl->getType('int'); $messageParts['parameter2'] = $wsdl->getType('string'); $messageParts['parameter3'] = $wsdl->getType('mixed'); @@ -192,14 +192,14 @@ function testAddBindingOperation() $wsdl->addBindingOperation($binding, 'operation1'); $wsdl->addBindingOperation($binding, 'operation2', - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"), - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/") + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"], + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"] ); $wsdl->addBindingOperation($binding, 'operation3', - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"), - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"), - array('name' => 'MyFault', 'use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/") + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"], + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"], + ['name' => 'MyFault', 'use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"] ); $this->assertEquals($this->sanitizeWsdlXmlOutputForOsCompability($wsdl->toXml()), @@ -249,8 +249,8 @@ function testAddSoapBinding() $wsdl->addBindingOperation($binding, 'operation1'); $wsdl->addBindingOperation($binding, 'operation2', - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"), - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/") + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"], + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"] ); $this->assertEquals($this->sanitizeWsdlXmlOutputForOsCompability($wsdl->toXml()), @@ -287,8 +287,8 @@ function testAddSoapBinding() $wsdl1->addBindingOperation($binding, 'operation1'); $wsdl1->addBindingOperation($binding, 'operation2', - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"), - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/") + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"], + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"] ); $this->assertEquals($this->sanitizeWsdlXmlOutputForOsCompability($wsdl1->toXml()), @@ -329,8 +329,8 @@ function testAddSoapOperation() $wsdl->addBindingOperation($binding, 'operation1'); $wsdl->addBindingOperation($binding, 'operation2', - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"), - array('use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/") + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"], + ['use' => 'encoded', 'encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/"] ); $this->assertEquals($this->sanitizeWsdlXmlOutputForOsCompability($wsdl->toXml()), @@ -413,7 +413,7 @@ public function testAddDocumentationToSetInsertsBefore() { $wsdl = new Zend_Soap_Wsdl('MyService', 'http://localhost/MyService.php'); - $messageParts = array(); + $messageParts = []; $messageParts['parameter1'] = $wsdl->getType('int'); $messageParts['parameter2'] = $wsdl->getType('string'); $messageParts['parameter3'] = $wsdl->getType('mixed'); @@ -577,7 +577,7 @@ function testAddingSameComplexTypeMoreThanOnceIsIgnored() $wsdl->addType('Zend_Soap_Wsdl_Test'); $types = $wsdl->getTypes(); $this->assertEquals(1, count($types)); - $this->assertEquals(array("Zend_Soap_Wsdl_Test"), $types); + $this->assertEquals(["Zend_Soap_Wsdl_Test"], $types); } catch(Zend_Soap_Wsdl_Exception $e) { $this->fail(); } @@ -587,10 +587,10 @@ function testUsingSameComplexTypeTwiceLeadsToReuseOfDefinition() { $wsdl = new Zend_Soap_Wsdl('MyService', 'http://localhost/MyService.php'); $wsdl->addComplexType('Zend_Soap_Wsdl_Test'); - $this->assertEquals(array('Zend_Soap_Wsdl_Test'), $wsdl->getTypes()); + $this->assertEquals(['Zend_Soap_Wsdl_Test'], $wsdl->getTypes()); $wsdl->addComplexType('Zend_Soap_Wsdl_Test'); - $this->assertEquals(array('Zend_Soap_Wsdl_Test'), $wsdl->getTypes()); + $this->assertEquals(['Zend_Soap_Wsdl_Test'], $wsdl->getTypes()); } function testAddComplexType() diff --git a/tests/Zend/Soap/_files/commontypes.php b/tests/Zend/Soap/_files/commontypes.php index d5460ad6b0..13553ee5fc 100644 --- a/tests/Zend/Soap/_files/commontypes.php +++ b/tests/Zend/Soap/_files/commontypes.php @@ -88,7 +88,7 @@ function Zend_Soap_AutoDiscover_TestFunc6() */ function Zend_Soap_AutoDiscover_TestFunc7() { - return array('foo' => 'bar', 'baz' => true, 1 => false, 'bat' => 123); + return ['foo' => 'bar', 'baz' => true, 1 => false, 'bat' => 123]; } /** @@ -98,7 +98,7 @@ function Zend_Soap_AutoDiscover_TestFunc7() */ function Zend_Soap_AutoDiscover_TestFunc8() { - $return = (object) array('foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false); + $return = (object) ['foo' => 'bar', 'baz' => true, 'bat' => 123, 'qux' => false]; return $return; } @@ -226,10 +226,10 @@ public function add(Zend_Soap_AutoDiscoverTestClass1 $test) */ public function fetchAll() { - return array( + return [ new Zend_Soap_AutoDiscoverTestClass1(), new Zend_Soap_AutoDiscoverTestClass1(), - ); + ]; } /** @@ -272,7 +272,7 @@ class Zend_Soap_Wsdl_ComplexTypeA /** * @var Zend_Soap_Wsdl_ComplexTypeB[] */ - public $baz = array(); + public $baz = []; } /** @@ -317,7 +317,7 @@ class Zend_Soap_Wsdl_ComplexObjectStructure /** * @var array */ - public $array = array(1, 2, 3); + public $array = [1, 2, 3]; } /** diff --git a/tests/Zend/Soap/_files/fulltests/server1.php b/tests/Zend/Soap/_files/fulltests/server1.php index e4f7ba4654..9a852bcfd8 100644 --- a/tests/Zend/Soap/_files/fulltests/server1.php +++ b/tests/Zend/Soap/_files/fulltests/server1.php @@ -53,7 +53,7 @@ public function request($request) $a->baz[] = $request; - return array($a); + return [$a]; } } @@ -88,7 +88,7 @@ class Zend_Soap_Wsdl_ComplexTypeA /** * @var Zend_Soap_Wsdl_ComplexTypeB[] */ - public $baz = array(); + public $baz = []; } if(isset($_GET['wsdl'])) { diff --git a/tests/Zend/Stdlib/CallbackHandlerTest.php b/tests/Zend/Stdlib/CallbackHandlerTest.php index bbbce75442..bd3b17c773 100644 --- a/tests/Zend/Stdlib/CallbackHandlerTest.php +++ b/tests/Zend/Stdlib/CallbackHandlerTest.php @@ -55,9 +55,9 @@ public function setUp() public function testCallbackShouldStoreMetadata() { - $handler = new Zend_Stdlib_CallbackHandler('rand', array('event' => 'foo')); + $handler = new Zend_Stdlib_CallbackHandler('rand', ['event' => 'foo']); $this->assertEquals('foo', $handler->getMetadatum('event')); - $this->assertEquals(array('event' => 'foo'), $handler->getMetadata()); + $this->assertEquals(['event' => 'foo'], $handler->getMetadata()); } public function testCallbackShouldBeStringIfNoHandlerPassedToConstructor() @@ -68,14 +68,14 @@ public function testCallbackShouldBeStringIfNoHandlerPassedToConstructor() public function testCallbackShouldBeArrayIfHandlerPassedToConstructor() { - $handler = new Zend_Stdlib_CallbackHandler(array('Zend_Stdlib_TestAsset_SignalHandlers_ObjectCallback', 'test')); - $this->assertSame(array('Zend_Stdlib_TestAsset_SignalHandlers_ObjectCallback', 'test'), $handler->getCallback()); + $handler = new Zend_Stdlib_CallbackHandler(['Zend_Stdlib_TestAsset_SignalHandlers_ObjectCallback', 'test']); + $this->assertSame(['Zend_Stdlib_TestAsset_SignalHandlers_ObjectCallback', 'test'], $handler->getCallback()); } public function testCallShouldInvokeCallbackWithSuppliedArguments() { - $handler = new Zend_Stdlib_CallbackHandler(array( $this, 'handleCall' )); - $args = array('foo', 'bar', 'baz'); + $handler = new Zend_Stdlib_CallbackHandler([ $this, 'handleCall' ]); + $args = ['foo', 'bar', 'baz']; $handler->call($args); $this->assertSame($args, $this->args); } @@ -88,12 +88,12 @@ public function testPassingInvalidCallbackShouldRaiseInvalidCallbackExceptionDur public function testCallShouldReturnTheReturnValueOfTheCallback() { - $handler = new Zend_Stdlib_CallbackHandler(array('Zend_Stdlib_TestAsset_SignalHandlers_ObjectCallback', 'test')); - if (!is_callable(array('Zend_Stdlib_TestAsset_SignalHandlers_ObjectCallback', 'test'))) { + $handler = new Zend_Stdlib_CallbackHandler(['Zend_Stdlib_TestAsset_SignalHandlers_ObjectCallback', 'test']); + if (!is_callable(['Zend_Stdlib_TestAsset_SignalHandlers_ObjectCallback', 'test'])) { echo "\nClass exists? " . var_export(class_exists('Zend_Stdlib_TestAsset_SignalHandlers_ObjectCallback'), 1) . "\n"; echo "Include path: " . get_include_path() . "\n"; } - $this->assertEquals('bar', $handler->call(array())); + $this->assertEquals('bar', $handler->call([])); } public function testStringCallbackResolvingToClassDefiningInvokeNameShouldRaiseException() @@ -120,7 +120,7 @@ public function testCallbackConsistingOfStringContextWithNonStaticMethodShouldRa $this->markTestSkipped('Behavior of is_callable changes between 5.2 and 5.3'); } $this->setExpectedException('Zend_Stdlib_Exception_InvalidCallbackException'); - $handler = new Zend_Stdlib_CallbackHandler(array('Zend_Stdlib_TestAsset_SignalHandlers_InstanceMethod', 'handler')); + $handler = new Zend_Stdlib_CallbackHandler(['Zend_Stdlib_TestAsset_SignalHandlers_InstanceMethod', 'handler']); } public function testStringCallbackConsistingOfNonStaticMethodShouldRaiseException() @@ -135,7 +135,7 @@ public function testStringCallbackConsistingOfNonStaticMethodShouldRaiseExceptio public function testCallbackToClassImplementingOverloadingButNotInvocableShouldRaiseException() { $this->setExpectedException('Zend_Stdlib_Exception_InvalidCallbackException'); - $handler = new Zend_Stdlib_CallbackHandler('foo', array( 'Zend_Stdlib_TestAsset_SignalHandlers_Overloadable', 'foo' )); + $handler = new Zend_Stdlib_CallbackHandler('foo', [ 'Zend_Stdlib_TestAsset_SignalHandlers_Overloadable', 'foo' ]); } public function handleCall() diff --git a/tests/Zend/Stdlib/PriorityQueueTest.php b/tests/Zend/Stdlib/PriorityQueueTest.php index 02438d961e..73b28cb23a 100644 --- a/tests/Zend/Stdlib/PriorityQueueTest.php +++ b/tests/Zend/Stdlib/PriorityQueueTest.php @@ -57,11 +57,11 @@ public function testSerializationAndDeserializationShouldMaintainState() $count = count($this->queue); $this->assertSame($count, count($unserialized), 'Expected count ' . $count . '; received ' . count($unserialized)); - $expected = array(); + $expected = []; foreach ($this->queue as $item) { $expected[] = $item; } - $test = array(); + $test = []; foreach ($unserialized as $item) { $test[] = $item; } @@ -70,46 +70,46 @@ public function testSerializationAndDeserializationShouldMaintainState() public function testRetrievingQueueAsArrayReturnsDataOnlyByDefault() { - $expected = array( + $expected = [ 'foo', 'bar', 'baz', 'bat', - ); + ]; $test = $this->queue->toArray(); $this->assertSame($expected, $test, var_export($test, 1)); } public function testCanCastToArrayOfPrioritiesOnly() { - $expected = array( + $expected = [ 3, 4, 2, 1, - ); + ]; $test = $this->queue->toArray(Zend_Stdlib_PriorityQueue::EXTR_PRIORITY); $this->assertSame($expected, $test, var_export($test, 1)); } public function testCanCastToArrayOfDataPriorityPairs() { - $expected = array( - array('data' => 'foo', 'priority' => 3), - array('data' => 'bar', 'priority' => 4), - array('data' => 'baz', 'priority' => 2), - array('data' => 'bat', 'priority' => 1), - ); + $expected = [ + ['data' => 'foo', 'priority' => 3], + ['data' => 'bar', 'priority' => 4], + ['data' => 'baz', 'priority' => 2], + ['data' => 'bat', 'priority' => 1], + ]; $test = $this->queue->toArray(Zend_Stdlib_PriorityQueue::EXTR_BOTH); $this->assertSame($expected, $test, var_export($test, 1)); } public function testCanIterateMultipleTimesAndReceiveSameResults() { - $expected = array('bar', 'foo', 'baz', 'bat'); + $expected = ['bar', 'foo', 'baz', 'bat']; for ($i = 1; $i < 3; $i++) { - $test = array(); + $test = []; foreach ($this->queue as $item) { $test[] = $item; } @@ -120,8 +120,8 @@ public function testCanIterateMultipleTimesAndReceiveSameResults() public function testCanRemoveItemFromQueue() { $this->queue->remove('baz'); - $expected = array('bar', 'foo', 'bat'); - $test = array(); + $expected = ['bar', 'foo', 'bat']; + $test = []; foreach ($this->queue as $item) { $test[] = $item; } diff --git a/tests/Zend/Stdlib/SplPriorityQueueTest.php b/tests/Zend/Stdlib/SplPriorityQueueTest.php index 1519cc72cd..c2e6e9227c 100644 --- a/tests/Zend/Stdlib/SplPriorityQueueTest.php +++ b/tests/Zend/Stdlib/SplPriorityQueueTest.php @@ -59,8 +59,8 @@ public function testMaintainsInsertOrderForDataOfEqualPriority() $queue->insert('baz', 1000); $queue->insert('bat', 1000); - $expected = array('foo', 'bar', 'baz', 'bat'); - $test = array(); + $expected = ['foo', 'bar', 'baz', 'bat']; + $test = []; foreach ($queue as $datum) { $test[] = $datum; } @@ -74,11 +74,11 @@ public function testSerializationAndDeserializationShouldMaintainState() $count = count($this->queue); $this->assertSame($count, count($unserialized), 'Expected count ' . $count . '; received ' . count($unserialized)); - $expected = array(); + $expected = []; foreach ($this->queue as $item) { $expected[] = $item; } - $test = array(); + $test = []; foreach ($unserialized as $item) { $test[] = $item; } @@ -87,12 +87,12 @@ public function testSerializationAndDeserializationShouldMaintainState() public function testCanRetrieveQueueAsArray() { - $expected = array( + $expected = [ 'bar', 'foo', 'baz', 'bat', - ); + ]; $test = $this->queue->toArray(); $this->assertSame($expected, $test, var_export($test, 1)); } diff --git a/tests/Zend/Tag/Cloud/CloudTest.php b/tests/Zend/Tag/Cloud/CloudTest.php index c0d5a13165..1f8f1b8e36 100644 --- a/tests/Zend/Tag/Cloud/CloudTest.php +++ b/tests/Zend/Tag/Cloud/CloudTest.php @@ -61,7 +61,7 @@ public function testSetCloudDecoratorViaArray() { $cloud = $this->_getCloud(); - $cloud->setCloudDecorator(array('decorator' => 'CloudDummy', 'options' => array('foo' => 'bar'))); + $cloud->setCloudDecorator(['decorator' => 'CloudDummy', 'options' => ['foo' => 'bar']]); $this->assertTrue($cloud->getCloudDecorator() instanceof Zend_Tag_Cloud_Decorator_Dummy_CloudDummy); $this->assertEquals('bar', $cloud->getCloudDecorator()->getFoo()); } @@ -91,7 +91,7 @@ public function testSetTagDecoratorViaArray() { $cloud = $this->_getCloud(); - $cloud->setTagDecorator(array('decorator' => 'TagDummy', 'options' => array('foo' => 'bar'))); + $cloud->setTagDecorator(['decorator' => 'TagDummy', 'options' => ['foo' => 'bar']]); $this->assertTrue($cloud->getTagDecorator() instanceof Zend_Tag_Cloud_Decorator_Dummy_TagDummy); $this->assertEquals('bar', $cloud->getTagDecorator()->getFoo()); } @@ -119,18 +119,18 @@ public function testSetInvalidTagDecorator() public function testSetPrefixPathViaOptions() { - $cloud = $this->_getCloud(array( - 'prefixPath' => array( + $cloud = $this->_getCloud([ + 'prefixPath' => [ 'prefix' => 'Zend_Tag_Cloud_Decorator_Dummy_', 'path' => dirname(__FILE__) . '/_classes' - ), - 'cloudDecorator' => array( + ], + 'cloudDecorator' => [ 'decorator' => 'CloudDummy1', - 'options' => array( + 'options' => [ 'foo' => 'bar' - ) - ) - ), false); + ] + ] + ], false); $this->assertTrue($cloud->getCloudDecorator() instanceof Zend_Tag_Cloud_Decorator_Dummy_CloudDummy1); $this->assertEquals('bar', $cloud->getCloudDecorator()->getFoo()); @@ -138,20 +138,20 @@ public function testSetPrefixPathViaOptions() public function testSetPrefixPathsViaOptions() { - $cloud = $this->_getCloud(array( - 'prefixPath' => array( - array( + $cloud = $this->_getCloud([ + 'prefixPath' => [ + [ 'prefix' => 'Zend_Tag_Cloud_Decorator_Dummy_', 'path' => dirname(__FILE__) . '/_classes' - ) - ), - 'cloudDecorator' => array( + ] + ], + 'cloudDecorator' => [ 'decorator' => 'CloudDummy2', - 'options' => array( + 'options' => [ 'foo' => 'bar' - ) - ) - ), false); + ] + ] + ], false); $this->assertTrue($cloud->getCloudDecorator() instanceof Zend_Tag_Cloud_Decorator_Dummy_CloudDummy2); $this->assertEquals('bar', $cloud->getCloudDecorator()->getFoo()); @@ -159,21 +159,21 @@ public function testSetPrefixPathsViaOptions() public function testSetPrefixPathsSkip() { - $cloud = $this->_getCloud(array( - 'prefixPath' => array( - array( + $cloud = $this->_getCloud([ + 'prefixPath' => [ + [ 'prefix' => 'foobar', - ) - ), - ), false); + ] + ], + ], false); $this->assertEquals(1, count($cloud->getPluginLoader()->getPaths())); } public function testSetPluginLoader() { - $loader = new Zend_Loader_PluginLoader(array('foo_' => 'bar/')); - $cloud = $this->_getCloud(array(), null); + $loader = new Zend_Loader_PluginLoader(['foo_' => 'bar/']); + $cloud = $this->_getCloud([], null); $cloud->setPluginLoader($loader); $paths = $cloud->getPluginLoader()->getPaths(); @@ -182,8 +182,8 @@ public function testSetPluginLoader() public function testSetPluginLoaderViaOptions() { - $loader = new Zend_Loader_PluginLoader(array('foo_' => 'bar/')); - $cloud = $this->_getCloud(array('pluginLoader' => $loader), null); + $loader = new Zend_Loader_PluginLoader(['foo_' => 'bar/']); + $cloud = $this->_getCloud(['pluginLoader' => $loader], null); $paths = $cloud->getPluginLoader()->getPaths(); $this->assertEquals('bar/', $paths['foo_'][0]); @@ -194,7 +194,7 @@ public function testAppendTagAsArray() $cloud = $this->_getCloud(); $list = $cloud->getItemList(); - $cloud->appendTag(array('title' => 'foo', 'weight' => 1)); + $cloud->appendTag(['title' => 'foo', 'weight' => 1]); $this->assertEquals('foo', $list[0]->getTitle()); } @@ -204,7 +204,7 @@ public function testAppendTagAsItem() $cloud = $this->_getCloud(); $list = $cloud->getItemList(); - $cloud->appendTag(new Zend_Tag_Item(array('title' => 'foo', 'weight' => 1))); + $cloud->appendTag(new Zend_Tag_Item(['title' => 'foo', 'weight' => 1])); $this->assertEquals('foo', $list[0]->getTitle()); } @@ -226,8 +226,8 @@ public function testSetTagsAsArray() $cloud = $this->_getCloud(); $list = $cloud->getItemList(); - $cloud->setTags(array(array('title' => 'foo', 'weight' => 1), - array('title' => 'bar', 'weight' => 2))); + $cloud->setTags([['title' => 'foo', 'weight' => 1], + ['title' => 'bar', 'weight' => 2]]); $this->assertEquals('foo', $list[0]->getTitle()); $this->assertEquals('bar', $list[1]->getTitle()); @@ -238,8 +238,8 @@ public function testSetTagsAsItem() $cloud = $this->_getCloud(); $list = $cloud->getItemList(); - $cloud->setTags(array(new Zend_Tag_Item(array('title' => 'foo', 'weight' => 1)), - new Zend_Tag_Item(array('title' => 'bar', 'weight' => 2)))); + $cloud->setTags([new Zend_Tag_Item(['title' => 'foo', 'weight' => 1]), + new Zend_Tag_Item(['title' => 'bar', 'weight' => 2])]); $this->assertEquals('foo', $list[0]->getTitle()); $this->assertEquals('bar', $list[1]->getTitle()); @@ -250,8 +250,8 @@ public function testSetTagsMixed() $cloud = $this->_getCloud(); $list = $cloud->getItemList(); - $cloud->setTags(array(array('title' => 'foo', 'weight' => 1), - new Zend_Tag_Item(array('title' => 'bar', 'weight' => 2)))); + $cloud->setTags([['title' => 'foo', 'weight' => 1], + new Zend_Tag_Item(['title' => 'bar', 'weight' => 2])]); $this->assertEquals('foo', $list[0]->getTitle()); $this->assertEquals('bar', $list[1]->getTitle()); @@ -262,7 +262,7 @@ public function testSetInvalidTags() $cloud = $this->_getCloud(); try { - $cloud->setTags(array('foo')); + $cloud->setTags(['foo']); $this->fail('An expected Zend_Tag_Cloud_Exception was not raised'); } catch (Zend_Tag_Cloud_Exception $e) { $this->assertEquals('Tag must be an instance of Zend_Tag_Taggable or an array', $e->getMessage()); @@ -271,7 +271,7 @@ public function testSetInvalidTags() public function testConstructorWithArray() { - $cloud = $this->_getCloud(array('tags' => array(array('title' => 'foo', 'weight' => 1)))); + $cloud = $this->_getCloud(['tags' => [['title' => 'foo', 'weight' => 1]]]); $list = $cloud->getItemList(); $this->assertEquals('foo', $list[0]->getTitle()); @@ -279,7 +279,7 @@ public function testConstructorWithArray() public function testConstructorWithConfig() { - $cloud = $this->_getCloud(new Zend_Config(array('tags' => array(array('title' => 'foo', 'weight' => 1))))); + $cloud = $this->_getCloud(new Zend_Config(['tags' => [['title' => 'foo', 'weight' => 1]]])); $list = $cloud->getItemList(); $this->assertEquals('foo', $list[0]->getTitle()); @@ -288,7 +288,7 @@ public function testConstructorWithConfig() public function testSetOptions() { $cloud = $this->_getCloud(); - $cloud->setOptions(array('tags' => array(array('title' => 'foo', 'weight' => 1)))); + $cloud->setOptions(['tags' => [['title' => 'foo', 'weight' => 1]]]); $list = $cloud->getItemList(); $this->assertEquals('foo', $list[0]->getTitle()); @@ -296,13 +296,13 @@ public function testSetOptions() public function testSkipOptions() { - $cloud = $this->_getCloud(array('options' => 'foobar')); + $cloud = $this->_getCloud(['options' => 'foobar']); // In case would fail due to an error } public function testRender() { - $cloud = $this->_getCloud(array('tags' => array(array('title' => 'foo', 'weight' => 1), array('title' => 'bar', 'weight' => 3)))); + $cloud = $this->_getCloud(['tags' => [['title' => 'foo', 'weight' => 1], ['title' => 'bar', 'weight' => 3]]]); $expected = '
        ' . '
      • foo
      • ' . '
      • bar
      • ' @@ -318,7 +318,7 @@ public function testRenderEmptyCloud() public function testRenderViaToString() { - $cloud = $this->_getCloud(array('tags' => array(array('title' => 'foo', 'weight' => 1), array('title' => 'bar', 'weight' => 3)))); + $cloud = $this->_getCloud(['tags' => [['title' => 'foo', 'weight' => 1], ['title' => 'bar', 'weight' => 3]]]); $expected = '
          ' . '
        • foo
        • ' . '
        • bar
        • ' diff --git a/tests/Zend/Tag/Cloud/Decorator/HtmlCloudTest.php b/tests/Zend/Tag/Cloud/Decorator/HtmlCloudTest.php index 36641107a9..01fa1c7b47 100644 --- a/tests/Zend/Tag/Cloud/Decorator/HtmlCloudTest.php +++ b/tests/Zend/Tag/Cloud/Decorator/HtmlCloudTest.php @@ -48,15 +48,15 @@ public function testDefaultOutput() { $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(); - $this->assertEquals('
            foo bar
          ', $decorator->render(array('foo', 'bar'))); + $this->assertEquals('
            foo bar
          ', $decorator->render(['foo', 'bar'])); } public function testNestedTags() { $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(); - $decorator->setHtmlTags(array('span', 'div' => array('id' => 'tag-cloud'))); + $decorator->setHtmlTags(['span', 'div' => ['id' => 'tag-cloud']]); - $this->assertEquals('
          foo bar
          ', $decorator->render(array('foo', 'bar'))); + $this->assertEquals('
          foo bar
          ', $decorator->render(['foo', 'bar'])); } public function testSeparator() @@ -64,34 +64,34 @@ public function testSeparator() $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(); $decorator->setSeparator('-'); - $this->assertEquals('
            foo-bar
          ', $decorator->render(array('foo', 'bar'))); + $this->assertEquals('
            foo-bar
          ', $decorator->render(['foo', 'bar'])); } public function testConstructorWithArray() { - $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(array('htmlTags' => array('div'), 'separator' => ' ')); + $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(['htmlTags' => ['div'], 'separator' => ' ']); - $this->assertEquals('
          foo bar
          ', $decorator->render(array('foo', 'bar'))); + $this->assertEquals('
          foo bar
          ', $decorator->render(['foo', 'bar'])); } public function testConstructorWithConfig() { - $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(new Zend_Config(array('htmlTags' => array('div'), 'separator' => ' '))); + $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(new Zend_Config(['htmlTags' => ['div'], 'separator' => ' '])); - $this->assertEquals('
          foo bar
          ', $decorator->render(array('foo', 'bar'))); + $this->assertEquals('
          foo bar
          ', $decorator->render(['foo', 'bar'])); } public function testSetOptions() { $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(); - $decorator->setOptions(array('htmlTags' => array('div'), 'separator' => ' ')); + $decorator->setOptions(['htmlTags' => ['div'], 'separator' => ' ']); - $this->assertEquals('
          foo bar
          ', $decorator->render(array('foo', 'bar'))); + $this->assertEquals('
          foo bar
          ', $decorator->render(['foo', 'bar'])); } public function testSkipOptions() { - $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(array('options' => 'foobar')); + $decorator = new Zend_Tag_Cloud_Decorator_HtmlCloud(['options' => 'foobar']); // In case would fail due to an error } } diff --git a/tests/Zend/Tag/Cloud/Decorator/HtmlTagTest.php b/tests/Zend/Tag/Cloud/Decorator/HtmlTagTest.php index 53ac038f50..396460f1e7 100644 --- a/tests/Zend/Tag/Cloud/Decorator/HtmlTagTest.php +++ b/tests/Zend/Tag/Cloud/Decorator/HtmlTagTest.php @@ -49,9 +49,9 @@ public static function main() public function testDefaultOutput() { $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(); - $expected = array('
        • foo
        • ', + $expected = ['
        • foo
        • ', '
        • bar
        • ', - '
        • baz
        • '); + '
        • baz
        • ']; $this->assertEquals($decorator->render($this->_getTagList()), $expected); } @@ -59,10 +59,10 @@ public function testDefaultOutput() public function testNestedTags() { $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(); - $decorator->setHtmlTags(array('span' => array('class' => 'tag'), 'li')); - $expected = array('
        • foo
        • ', + $decorator->setHtmlTags(['span' => ['class' => 'tag'], 'li']); + $expected = ['
        • foo
        • ', '
        • bar
        • ', - '
        • baz
        • '); + '
        • baz
        • ']; $this->assertEquals($decorator->render($this->_getTagList()), $expected); } @@ -74,9 +74,9 @@ public function testFontSizeSpread() ->setMinFontSize(5) ->setMaxFontSize(50); - $expected = array('
        • foo
        • ', + $expected = ['
        • foo
        • ', '
        • bar
        • ', - '
        • baz
        • '); + '
        • baz
        • ']; $this->assertEquals($decorator->render($this->_getTagList()), $expected); } @@ -84,11 +84,11 @@ public function testFontSizeSpread() public function testClassListSpread() { $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(); - $decorator->setClassList(array('small', 'medium', 'large')); + $decorator->setClassList(['small', 'medium', 'large']); - $expected = array('
        • foo
        • ', + $expected = ['
        • foo
        • ', '
        • bar
        • ', - '
        • baz
        • '); + '
        • baz
        • ']; $this->assertEquals($decorator->render($this->_getTagList()), $expected); } @@ -98,7 +98,7 @@ public function testEmptyClassList() $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(); try { - $decorator->setClassList(array()); + $decorator->setClassList([]); $this->fail('An expected Zend_Tag_Cloud_Decorator_Exception was not raised'); } catch (Zend_Tag_Cloud_Decorator_Exception $e) { $this->assertEquals($e->getMessage(), 'Classlist is empty'); @@ -110,7 +110,7 @@ public function testInvalidClassList() $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(); try { - $decorator->setClassList(array(array())); + $decorator->setClassList([[]]); $this->fail('An expected Zend_Tag_Cloud_Decorator_Exception was not raised'); } catch (Zend_Tag_Cloud_Decorator_Exception $e) { $this->assertEquals($e->getMessage(), 'Classlist contains an invalid classname'); @@ -155,7 +155,7 @@ public function testInvalidMaxFontSize() public function testConstructorWithArray() { - $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(array('minFontSize' => 5, 'maxFontSize' => 10, 'fontSizeUnit' => 'pt')); + $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(['minFontSize' => 5, 'maxFontSize' => 10, 'fontSizeUnit' => 'pt']); $this->assertEquals(5, $decorator->getMinFontSize()); $this->assertEquals(10, $decorator->getMaxFontSize()); @@ -164,7 +164,7 @@ public function testConstructorWithArray() public function testConstructorWithConfig() { - $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(new Zend_Config(array('minFontSize' => 5, 'maxFontSize' => 10, 'fontSizeUnit' => 'pt'))); + $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(new Zend_Config(['minFontSize' => 5, 'maxFontSize' => 10, 'fontSizeUnit' => 'pt'])); $this->assertEquals(5, $decorator->getMinFontSize()); $this->assertEquals(10, $decorator->getMaxFontSize()); @@ -174,7 +174,7 @@ public function testConstructorWithConfig() public function testSetOptions() { $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(); - $decorator->setOptions(array('minFontSize' => 5, 'maxFontSize' => 10, 'fontSizeUnit' => 'pt')); + $decorator->setOptions(['minFontSize' => 5, 'maxFontSize' => 10, 'fontSizeUnit' => 'pt']); $this->assertEquals(5, $decorator->getMinFontSize()); $this->assertEquals(10, $decorator->getMaxFontSize()); @@ -183,16 +183,16 @@ public function testSetOptions() public function testSkipOptions() { - $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(array('options' => 'foobar')); + $decorator = new Zend_Tag_Cloud_Decorator_HtmlTag(['options' => 'foobar']); // In case would fail due to an error } protected function _getTagList() { $list = new Zend_Tag_ItemList(); - $list[] = new Zend_Tag_Item(array('title' => 'foo', 'weight' => 1, 'params' => array('url' => 'http://first'))); - $list[] = new Zend_Tag_Item(array('title' => 'bar', 'weight' => 3, 'params' => array('url' => 'http://second'))); - $list[] = new Zend_Tag_Item(array('title' => 'baz', 'weight' => 10, 'params' => array('url' => 'http://third'))); + $list[] = new Zend_Tag_Item(['title' => 'foo', 'weight' => 1, 'params' => ['url' => 'http://first']]); + $list[] = new Zend_Tag_Item(['title' => 'bar', 'weight' => 3, 'params' => ['url' => 'http://second']]); + $list[] = new Zend_Tag_Item(['title' => 'baz', 'weight' => 10, 'params' => ['url' => 'http://third']]); return $list; } diff --git a/tests/Zend/Tag/ItemListTest.php b/tests/Zend/Tag/ItemListTest.php index aaa23e2d79..2b9d3ccd17 100644 --- a/tests/Zend/Tag/ItemListTest.php +++ b/tests/Zend/Tag/ItemListTest.php @@ -65,7 +65,7 @@ public function testSeekableIterator() { $list = new Zend_Tag_ItemList(); - $values = array('foo', 'bar', 'baz'); + $values = ['foo', 'bar', 'baz']; foreach ($values as $value) { $list[] = $this->_getItem($value); } @@ -105,14 +105,14 @@ public function testSpreadWeightValues() $list[] = $this->_getItem('bar', 5); $list[] = $this->_getItem('baz', 50); - $list->spreadWeightValues(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); + $list->spreadWeightValues([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - $weightValues = array(); + $weightValues = []; foreach ($list as $item) { $weightValues[] = $item->getParam('weightValue'); } - $expectedWeightValues = array(1, 2, 10); + $expectedWeightValues = [1, 2, 10]; $this->assertEquals($weightValues, $expectedWeightValues); } @@ -125,14 +125,14 @@ public function testSpreadWeightValuesWithSingleValue() $list[] = $this->_getItem('bar', 5); $list[] = $this->_getItem('baz', 50); - $list->spreadWeightValues(array('foobar')); + $list->spreadWeightValues(['foobar']); - $weightValues = array(); + $weightValues = []; foreach ($list as $item) { $weightValues[] = $item->getParam('weightValue'); } - $expectedWeightValues = array('foobar', 'foobar', 'foobar'); + $expectedWeightValues = ['foobar', 'foobar', 'foobar']; $this->assertEquals($weightValues, $expectedWeightValues); } @@ -142,7 +142,7 @@ public function testSpreadWeightValuesWithEmptyValuesArray() $list = new Zend_Tag_ItemList(); try { - $list->spreadWeightValues(array()); + $list->spreadWeightValues([]); $this->fail('An expected Zend_Tag_Exception was not raised'); } catch (Zend_Tag_Exception $e) { $this->assertEquals($e->getMessage(), 'Value list may not be empty'); @@ -151,7 +151,7 @@ public function testSpreadWeightValuesWithEmptyValuesArray() protected function _getItem($title = 'foo', $weight = 1) { - return new Zend_Tag_Item(array('title' => $title, 'weight' => $weight)); + return new Zend_Tag_Item(['title' => $title, 'weight' => $weight]); } } diff --git a/tests/Zend/Tag/ItemTest.php b/tests/Zend/Tag/ItemTest.php index 278e953b11..da43c1821d 100644 --- a/tests/Zend/Tag/ItemTest.php +++ b/tests/Zend/Tag/ItemTest.php @@ -45,13 +45,13 @@ public static function main() public function testConstuctor() { - $tag = new Zend_Tag_Item(array( + $tag = new Zend_Tag_Item([ 'title' => 'foo', 'weight' => 10, - 'params' => array( + 'params' => [ 'bar' => 'baz' - ) - )); + ] + ]); $this->assertEquals('foo', $tag->getTitle()); $this->assertEquals(10, $tag->getWeight()); @@ -60,14 +60,14 @@ public function testConstuctor() public function testSetOptions() { - $tag = new Zend_Tag_Item(array('title' => 'foo', 'weight' => 1)); - $tag->setOptions(array( + $tag = new Zend_Tag_Item(['title' => 'foo', 'weight' => 1]); + $tag->setOptions([ 'title' => 'bar', 'weight' => 10, - 'params' => array( + 'params' => [ 'bar' => 'baz' - ) - )); + ] + ]); $this->assertEquals('bar', $tag->getTitle()); $this->assertEquals(10, $tag->getWeight()); @@ -76,7 +76,7 @@ public function testSetOptions() public function testSetParam() { - $tag = new Zend_Tag_Item(array('title' => 'foo', 'weight' => 1)); + $tag = new Zend_Tag_Item(['title' => 'foo', 'weight' => 1]); $tag->setParam('bar', 'baz'); $this->assertEquals('baz', $tag->getParam('bar')); @@ -84,7 +84,7 @@ public function testSetParam() public function testSetTitle() { - $tag = new Zend_Tag_Item(array('title' => 'foo', 'weight' => 1)); + $tag = new Zend_Tag_Item(['title' => 'foo', 'weight' => 1]); $tag->setTitle('baz'); $this->assertEquals('baz', $tag->getTitle()); @@ -93,7 +93,7 @@ public function testSetTitle() public function testInvalidTitle() { try { - $tag = new Zend_Tag_Item(array('title' => 10, 'weight' => 1)); + $tag = new Zend_Tag_Item(['title' => 10, 'weight' => 1]); $this->fail('An expected Zend_Tag_Exception was not raised'); } catch (Zend_Tag_Exception $e) { $this->assertEquals($e->getMessage(), 'Title must be a string'); @@ -102,7 +102,7 @@ public function testInvalidTitle() public function testSetWeight() { - $tag = new Zend_Tag_Item(array('title' => 'foo', 'weight' => 1)); + $tag = new Zend_Tag_Item(['title' => 'foo', 'weight' => 1]); $tag->setWeight('10'); $this->assertEquals(10.0, $tag->getWeight()); @@ -112,7 +112,7 @@ public function testSetWeight() public function testInvalidWeight() { try { - $tag = new Zend_Tag_Item(array('title' => 'foo', 'weight' => 'foobar')); + $tag = new Zend_Tag_Item(['title' => 'foo', 'weight' => 'foobar']); $this->fail('An expected Zend_Tag_Exception was not raised'); } catch (Zend_Tag_Exception $e) { $this->assertEquals($e->getMessage(), 'Weight must be numeric'); @@ -121,7 +121,7 @@ public function testInvalidWeight() public function testSkipOptions() { - $tag = new Zend_Tag_Item(array('title' => 'foo', 'weight' => 1, 'param' => 'foobar')); + $tag = new Zend_Tag_Item(['title' => 'foo', 'weight' => 1, 'param' => 'foobar']); // In case would fail due to an error } @@ -138,7 +138,7 @@ public function testInvalidOptions() public function testMissingTitle() { try { - $tag = new Zend_Tag_Item(array('weight' => 1)); + $tag = new Zend_Tag_Item(['weight' => 1]); $this->fail('An expected Zend_Tag_Exception was not raised'); } catch (Zend_Tag_Exception $e) { $this->assertEquals($e->getMessage(), 'Title was not set'); @@ -148,7 +148,7 @@ public function testMissingTitle() public function testMissingWeight() { try { - $tag = new Zend_Tag_Item(array('title' => 'foo')); + $tag = new Zend_Tag_Item(['title' => 'foo']); $this->fail('An expected Zend_Tag_Exception was not raised'); } catch (Zend_Tag_Exception $e) { $this->assertEquals($e->getMessage(), 'Weight was not set'); @@ -157,7 +157,7 @@ public function testMissingWeight() public function testConfigOptions() { - $tag = new Zend_Tag_Item(new Zend_Config(array('title' => 'foo', 'weight' => 1))); + $tag = new Zend_Tag_Item(new Zend_Config(['title' => 'foo', 'weight' => 1])); $this->assertEquals($tag->getTitle(), 'foo'); $this->assertEquals($tag->getWeight(), 1); @@ -165,7 +165,7 @@ public function testConfigOptions() public function testGetNonSetParam() { - $tag = new Zend_Tag_Item(array('title' => 'foo', 'weight' => 1)); + $tag = new Zend_Tag_Item(['title' => 'foo', 'weight' => 1]); $this->assertNull($tag->getParam('foo')); } diff --git a/tests/Zend/Test/DbAdapterTest.php b/tests/Zend/Test/DbAdapterTest.php index b770e9a191..10f9fc05a8 100644 --- a/tests/Zend/Test/DbAdapterTest.php +++ b/tests/Zend/Test/DbAdapterTest.php @@ -45,10 +45,10 @@ public function setUp() public function testAppendStatementToStack() { - $stmt1 = Zend_Test_DbStatement::createSelectStatement( array() ); + $stmt1 = Zend_Test_DbStatement::createSelectStatement( [] ); $this->_adapter->appendStatementToStack($stmt1); - $stmt2 = Zend_Test_DbStatement::createSelectStatement( array() ); + $stmt2 = Zend_Test_DbStatement::createSelectStatement( [] ); $this->_adapter->appendStatementToStack($stmt2); $this->assertSame($stmt2, $this->_adapter->query("foo")); @@ -71,24 +71,24 @@ public function testLastInsertIdDefault() public function testListTablesDefault() { - $this->assertEquals(array(), $this->_adapter->listTables()); + $this->assertEquals([], $this->_adapter->listTables()); } public function testSetListTables() { - $this->_adapter->setListTables(array("foo", "bar")); - $this->assertEquals(array("foo", "bar"), $this->_adapter->listTables()); + $this->_adapter->setListTables(["foo", "bar"]); + $this->assertEquals(["foo", "bar"], $this->_adapter->listTables()); } public function testDescribeTableDefault() { - $this->assertEquals(array(), $this->_adapter->describeTable("foo")); + $this->assertEquals([], $this->_adapter->describeTable("foo")); } public function testDescribeTable() { - $this->_adapter->setDescribeTable("foo", array("bar")); - $this->assertEquals(array("bar"), $this->_adapter->describeTable("foo")); + $this->_adapter->setDescribeTable("foo", ["bar"]); + $this->assertEquals(["bar"], $this->_adapter->describeTable("foo")); } public function testConnect() @@ -139,12 +139,12 @@ public function testQueryProfiler_QueryStartEndsQueryProfiler() public function testQueryProfiler_QueryBindWithParams() { - $stmt = $this->_adapter->query("SELECT * FROM foo WHERE bar = ?", array(1234)); + $stmt = $this->_adapter->query("SELECT * FROM foo WHERE bar = ?", [1234]); $qp = $this->_adapter->getProfiler()->getLastQueryProfile(); /* @var $qp Zend_Db_Profiler_Query */ - $this->assertEquals(array(1 => 1234), $qp->getQueryParams()); + $this->assertEquals([1 => 1234], $qp->getQueryParams()); $this->assertEquals("SELECT * FROM foo WHERE bar = ?", $qp->getQuery()); } @@ -158,7 +158,7 @@ public function testQueryProfiler_PrepareBindExecute() $qp = $this->_adapter->getProfiler()->getLastQueryProfile(); /* @var $qp Zend_Db_Profiler_Query */ - $this->assertEquals(array(1 => 1234), $qp->getQueryParams()); + $this->assertEquals([1 => 1234], $qp->getQueryParams()); $this->assertEquals("SELECT * FROM foo WHERE bar = ?", $qp->getQuery()); } diff --git a/tests/Zend/Test/DbStatementTest.php b/tests/Zend/Test/DbStatementTest.php index 7162a454a4..317e184f55 100644 --- a/tests/Zend/Test/DbStatementTest.php +++ b/tests/Zend/Test/DbStatementTest.php @@ -48,7 +48,7 @@ public function testSetRowCount() public function testCreateSelectStatementWithRows() { - $rows = array("foo", "bar"); + $rows = ["foo", "bar"]; $stmt = Zend_Test_DbStatement::createSelectStatement($rows); @@ -82,7 +82,7 @@ public function testCreateDeleteStatementWithRowCount() public function testSetFetchRow() { - $row = array("foo"); + $row = ["foo"]; $stmt = new Zend_Test_DbStatement(); $stmt->append($row); @@ -98,7 +98,7 @@ public function testFetchDefault() public function testFetchResult_FromEmptyResultStack() { - $row = array("foo"); + $row = ["foo"]; $stmt = new Zend_Test_DbStatement(); $stmt->append($row); @@ -117,7 +117,7 @@ public function testFetchColumnDefault() public function testFetchColumn() { - $row = array("foo" => "bar", "bar" => "baz"); + $row = ["foo" => "bar", "bar" => "baz"]; $stmt = new Zend_Test_DbStatement(); $stmt->append($row); @@ -129,7 +129,7 @@ public function testFetchColumn_OutOfBounds() { $this->setExpectedException("Zend_Db_Statement_Exception"); - $row = array("foo" => "bar", "bar" => "baz"); + $row = ["foo" => "bar", "bar" => "baz"]; $stmt = new Zend_Test_DbStatement(); $stmt->append($row); @@ -139,7 +139,7 @@ public function testFetchColumn_OutOfBounds() public function testFetchObject() { - $row = array("foo" => "bar", "bar" => "baz"); + $row = ["foo" => "bar", "bar" => "baz"]; $stmt = new Zend_Test_DbStatement(); $stmt->append($row); @@ -154,7 +154,7 @@ public function testFetchObject_ClassNotExists_ThrowsException() { $this->setExpectedException("Zend_Db_Statement_Exception"); - $row = array("foo" => "bar", "bar" => "baz"); + $row = ["foo" => "bar", "bar" => "baz"]; $stmt = new Zend_Test_DbStatement(); $stmt->append($row); diff --git a/tests/Zend/Test/PHPUnit/ControllerTestCaseTest.php b/tests/Zend/Test/PHPUnit/ControllerTestCaseTest.php index 6c860a2484..005dde97f4 100644 --- a/tests/Zend/Test/PHPUnit/ControllerTestCaseTest.php +++ b/tests/Zend/Test/PHPUnit/ControllerTestCaseTest.php @@ -69,11 +69,11 @@ public static function main() */ public function setUp() { - $_SESSION = array(); + $_SESSION = []; $this->setExpectedException(null); $this->testCase = new Zend_Test_PHPUnit_ControllerTestCaseTest_Concrete(); $this->testCase->reset(); - $this->testCase->bootstrap = array($this, 'bootstrap'); + $this->testCase->bootstrap = [$this, 'bootstrap']; } /** @@ -249,7 +249,7 @@ public function testBootstrapShouldIncludeBootstrapFileSpecifiedInPublicBootstra public function testBootstrapShouldInvokeCallbackSpecifiedInPublicBootstrapProperty() { - $this->testCase->bootstrap = array($this, 'bootstrapCallback'); + $this->testCase->bootstrap = [$this, 'bootstrapCallback']; $this->testCase->bootstrap(); $controller = $this->testCase->getFrontController(); $this->assertSame(Zend_Registry::get('router'), $controller->getRouter()); @@ -607,8 +607,8 @@ public function testRouteAssertionShouldThrowExceptionForInvalidComparison() public function testResetShouldResetSessionArray() { $this->assertTrue(empty($_SESSION)); - $_SESSION = array('foo' => 'bar', 'bar' => 'baz'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz'), $_SESSION, var_export($_SESSION, 1)); + $_SESSION = ['foo' => 'bar', 'bar' => 'baz']; + $this->assertEquals(['foo' => 'bar', 'bar' => 'baz'], $_SESSION, var_export($_SESSION, 1)); $this->testCase->reset(); $this->assertTrue(empty($_SESSION)); } @@ -725,12 +725,12 @@ public function testSuperGlobalArraysShouldBeClearedDuringSetUp() public function testResetRequestShouldClearPostAndQueryParameters() { $this->testCase->getFrontController()->setControllerDirectory(dirname(__FILE__) . '/_files/application/controllers'); - $this->testCase->getRequest()->setPost(array( + $this->testCase->getRequest()->setPost([ 'foo' => 'bar', - )); - $this->testCase->getRequest()->setQuery(array( + ]); + $this->testCase->getRequest()->setQuery([ 'bar' => 'baz', - )); + ]); $this->testCase->dispatch('/zend-test-php-unit-foo/baz'); $this->testCase->resetRequest(); $this->assertTrue(empty($_POST)); @@ -743,13 +743,13 @@ public function testResetRequestShouldClearPostAndQueryParameters() public function testTestCaseShouldAllowUsingApplicationObjectAsBootstrap() { require_once 'Zend/Application.php'; - $application = new Zend_Application('testing', array( - 'resources' => array( - 'frontcontroller' => array( + $application = new Zend_Application('testing', [ + 'resources' => [ + 'frontcontroller' => [ 'controllerDirectory' => dirname(__FILE__) . '/_files/application/controllers', - ), - ), - )); + ], + ], + ]); $this->testCase->bootstrap = $application; $this->testCase->bootstrap(); $this->assertEquals( @@ -764,13 +764,13 @@ public function testTestCaseShouldAllowUsingApplicationObjectAsBootstrap() public function testWhenApplicationObjectUsedAsBootstrapTestCaseShouldExecuteBootstrapRunMethod() { require_once 'Zend/Application.php'; - $application = new Zend_Application('testing', array( - 'resources' => array( - 'frontcontroller' => array( + $application = new Zend_Application('testing', [ + 'resources' => [ + 'frontcontroller' => [ 'controllerDirectory' => dirname(__FILE__) . '/_files/application/controllers', - ), - ), - )); + ], + ], + ]); $this->testCase->bootstrap = $application; $this->testCase->bootstrap(); $this->testCase->dispatch('/'); @@ -800,10 +800,10 @@ public function testRedirectWorksAsExpectedFromHookMethodsInActionController($di */ public function providerRedirectWorksAsExpectedFromHookMethodsInActionController() { - return array( - array('/zend-test-redirect-from-init/baz'), - array('/zend-test-redirect-from-pre-dispatch/baz') - ); + return [ + ['/zend-test-redirect-from-init/baz'], + ['/zend-test-redirect-from-pre-dispatch/baz'] + ]; } /** @@ -861,12 +861,12 @@ public function testHeaderAssertionShouldDoNothingForValidComparisonWithZeroForV */ public function providerRedirectWorksAsExpectedFromHookMethodsInFrontControllerPlugin() { - return array( - array('RouteStartup'), - array('RouteShutdown'), - array('DispatchLoopStartup'), - array('PreDispatch') - ); + return [ + ['RouteStartup'], + ['RouteShutdown'], + ['DispatchLoopStartup'], + ['PreDispatch'] + ]; } } diff --git a/tests/Zend/Test/PHPUnit/Db/DataSet/DataSetTestCase.php b/tests/Zend/Test/PHPUnit/Db/DataSet/DataSetTestCase.php index c38d48ae2b..c39a110b8f 100644 --- a/tests/Zend/Test/PHPUnit/Db/DataSet/DataSetTestCase.php +++ b/tests/Zend/Test/PHPUnit/Db/DataSet/DataSetTestCase.php @@ -39,7 +39,7 @@ abstract class Zend_Test_PHPUnit_Db_DataSet_DataSetTestCase extends PHPUnit_Fram public function setUp() { - $this->connectionMock = $this->getMock('Zend_Test_PHPUnit_Db_Connection', array(), array(), '', false); + $this->connectionMock = $this->getMock('Zend_Test_PHPUnit_Db_Connection', [], [], '', false); } public function decorateConnectionMockWithZendAdapter() diff --git a/tests/Zend/Test/PHPUnit/Db/DataSet/DbRowsetTest.php b/tests/Zend/Test/PHPUnit/Db/DataSet/DbRowsetTest.php index fd2543d292..18bf81f186 100644 --- a/tests/Zend/Test/PHPUnit/Db/DataSet/DbRowsetTest.php +++ b/tests/Zend/Test/PHPUnit/Db/DataSet/DbRowsetTest.php @@ -37,10 +37,10 @@ class Zend_Test_PHPUnit_Db_DataSet_DbRowsetTest extends PHPUnit_Framework_TestCa { protected function getRowSet() { - $config = array( + $config = [ 'rowClass' => 'stdClass', - 'data' => array(array('foo' => 'bar'), array('foo' => 'baz')), - ); + 'data' => [['foo' => 'bar'], ['foo' => 'baz']], + ]; $rowset = new Zend_Db_Table_Rowset($config); return $rowset; } @@ -60,14 +60,14 @@ public function testRowsetGetSpecificValue() public function testRowsetGetSpecificRow() { $rowsetTable = new Zend_Test_PHPUnit_Db_DataSet_DbRowset($this->getRowSet(), "fooTable"); - $this->assertEquals(array("foo" => "baz"), $rowsetTable->getRow(1)); + $this->assertEquals(["foo" => "baz"], $rowsetTable->getRow(1)); } public function testRowset_ConstructWithDisconnectedRowset_NoTableName_ThrowsException() { $this->setExpectedException("Zend_Test_PHPUnit_Db_Exception"); - $rowset = $this->getMock('Zend_Db_Table_Rowset_Abstract', array(), array(), '', false); + $rowset = $this->getMock('Zend_Db_Table_Rowset_Abstract', [], [], '', false); $rowset->expects($this->once()) ->method('getTable') ->will($this->returnValue(null)); @@ -77,21 +77,21 @@ public function testRowset_ConstructWithDisconnectedRowset_NoTableName_ThrowsExc public function testRowset_WithNoRows_GetColumnsFromTable() { - $columns = array("foo", "bar"); + $columns = ["foo", "bar"]; - $tableMock = $this->getMock('Zend_Db_Table_Abstract', array(), array(), '', false); + $tableMock = $this->getMock('Zend_Db_Table_Abstract', [], [], '', false); $tableMock->expects($this->once()) ->method('info') ->with($this->equalTo('cols')) ->will($this->returnValue($columns)); - $rowset = $this->getMock('Zend_Db_Table_Rowset_Abstract', array(), array(), '', false); + $rowset = $this->getMock('Zend_Db_Table_Rowset_Abstract', [], [], '', false); $rowset->expects($this->exactly(2)) ->method('getTable') ->will($this->returnValue($tableMock)); $rowset->expects($this->once()) ->method('toArray') - ->will($this->returnValue( array() )); + ->will($this->returnValue( [] )); $rowsetTable = new Zend_Test_PHPUnit_Db_DataSet_DbRowset($rowset, "tableName"); } diff --git a/tests/Zend/Test/PHPUnit/Db/DataSet/DbTableDataSetTest.php b/tests/Zend/Test/PHPUnit/Db/DataSet/DbTableDataSetTest.php index 39d4e70965..499bd35c81 100644 --- a/tests/Zend/Test/PHPUnit/Db/DataSet/DbTableDataSetTest.php +++ b/tests/Zend/Test/PHPUnit/Db/DataSet/DbTableDataSetTest.php @@ -37,25 +37,25 @@ public function testAddTableAppendedToTableNames() { $fixtureTable = "foo"; - $table = $this->getMock('Zend_Db_Table', array(), array(), '', false); + $table = $this->getMock('Zend_Db_Table', [], [], '', false); $table->expects($this->at(0))->method('info')->with('name')->will($this->returnValue($fixtureTable)); $table->expects($this->at(1))->method('info')->with('name')->will($this->returnValue($fixtureTable)); - $table->expects($this->at(2))->method('info')->with('cols')->will($this->returnValue(array())); + $table->expects($this->at(2))->method('info')->with('cols')->will($this->returnValue([])); $dataSet = new Zend_Test_PHPUnit_Db_DataSet_DbTableDataSet(); $dataSet->addTable($table); - $this->assertEquals(array($fixtureTable), $dataSet->getTableNames()); + $this->assertEquals([$fixtureTable], $dataSet->getTableNames()); } public function testAddTableCreatesDbTableInstance() { $fixtureTable = "foo"; - $table = $this->getMock('Zend_Db_Table', array(), array(), '', false); + $table = $this->getMock('Zend_Db_Table', [], [], '', false); $table->expects($this->at(0))->method('info')->with('name')->will($this->returnValue($fixtureTable)); $table->expects($this->at(1))->method('info')->with('name')->will($this->returnValue($fixtureTable)); - $table->expects($this->at(2))->method('info')->with('cols')->will($this->returnValue(array())); + $table->expects($this->at(2))->method('info')->with('cols')->will($this->returnValue([])); $dataSet = new Zend_Test_PHPUnit_Db_DataSet_DbTableDataSet(); $dataSet->addTable($table); diff --git a/tests/Zend/Test/PHPUnit/Db/DataSet/DbTableTest.php b/tests/Zend/Test/PHPUnit/Db/DataSet/DbTableTest.php index 61e31ec087..cc178e8702 100644 --- a/tests/Zend/Test/PHPUnit/Db/DataSet/DbTableTest.php +++ b/tests/Zend/Test/PHPUnit/Db/DataSet/DbTableTest.php @@ -40,11 +40,11 @@ public function testLoadDataSetDelegatesWhereLimitOrderBy() $fixtureOffset = "offset"; $fixtureOrderBy = "order"; - $table = $this->getMock('Zend_Db_Table', array(), array(), '', false); + $table = $this->getMock('Zend_Db_Table', [], [], '', false); $table->expects($this->once()) ->method('fetchAll') ->with($fixtureWhere, $fixtureOrderBy, $fixtureLimit, $fixtureOffset) - ->will($this->returnValue(array())); + ->will($this->returnValue([])); $dataSet = new Zend_Test_PHPUnit_Db_DataSet_DbTable($table, $fixtureWhere, $fixtureOrderBy, $fixtureLimit, $fixtureOffset); $count = $dataSet->getRowCount(); @@ -54,7 +54,7 @@ public function testGetTableMetadata() { $fixtureTableName = "foo"; - $table = $this->getMock('Zend_Db_Table', array(), array(), '', false); + $table = $this->getMock('Zend_Db_Table', [], [], '', false); $table->expects($this->at(0)) ->method('info') ->with($this->equalTo('name')) @@ -62,23 +62,23 @@ public function testGetTableMetadata() $table->expects($this->at(1)) ->method('info') ->with($this->equalTo('cols')) - ->will($this->returnValue( array("foo", "bar") )); + ->will($this->returnValue( ["foo", "bar"] )); $table->expects($this->once()) ->method('fetchAll') - ->will($this->returnValue(array( array("foo" => 1, "bar" => 2) ))); + ->will($this->returnValue([ ["foo" => 1, "bar" => 2] ])); $dataSet = new Zend_Test_PHPUnit_Db_DataSet_DbTable($table); $this->assertEquals($fixtureTableName, $dataSet->getTableMetaData()->getTableName()); - $this->assertEquals(array("foo", "bar"), $dataSet->getTableMetaData()->getColumns()); + $this->assertEquals(["foo", "bar"], $dataSet->getTableMetaData()->getColumns()); } public function testLoadDataOnlyCalledOnce() { - $table = $this->getMock('Zend_Db_Table', array(), array(), '', false); + $table = $this->getMock('Zend_Db_Table', [], [], '', false); $table->expects($this->once()) ->method('fetchAll') - ->will($this->returnValue(array( array("foo" => 1, "bar" => 2) ))); + ->will($this->returnValue([ ["foo" => 1, "bar" => 2] ])); $dataSet = new Zend_Test_PHPUnit_Db_DataSet_DbTable($table); $dataSet->getRow(0); diff --git a/tests/Zend/Test/PHPUnit/Db/DataSet/QueryDataSetTest.php b/tests/Zend/Test/PHPUnit/Db/DataSet/QueryDataSetTest.php index c39144f0ab..1cc6bb77bd 100644 --- a/tests/Zend/Test/PHPUnit/Db/DataSet/QueryDataSetTest.php +++ b/tests/Zend/Test/PHPUnit/Db/DataSet/QueryDataSetTest.php @@ -62,7 +62,7 @@ public function testAddTableWithoutQueryParameterCreatesSelectWildcardAll() $fixtureTableName = "foo"; $adapterMock = $this->getMock('Zend_Test_DbAdapter'); - $selectMock = $this->getMock('Zend_Db_Select', array(), array($adapterMock)); + $selectMock = $this->getMock('Zend_Db_Select', [], [$adapterMock]); $adapterMock->expects($this->once()) ->method('select') diff --git a/tests/Zend/Test/PHPUnit/Db/DataSet/QueryTableTest.php b/tests/Zend/Test/PHPUnit/Db/DataSet/QueryTableTest.php index c7bd4f4f82..3bdf0bc83d 100644 --- a/tests/Zend/Test/PHPUnit/Db/DataSet/QueryTableTest.php +++ b/tests/Zend/Test/PHPUnit/Db/DataSet/QueryTableTest.php @@ -58,7 +58,7 @@ public function testCreateQueryTableWithZendDbConnection() public function testLoadDataExecutesQueryOnZendAdapter() { $statementMock = new Zend_Test_DbStatement(); - $statementMock->append(array('foo' => 'bar')); + $statementMock->append(['foo' => 'bar']); $adapterMock = new Zend_Test_DbAdapter(); $adapterMock->appendStatementToStack($statementMock); @@ -68,14 +68,14 @@ public function testLoadDataExecutesQueryOnZendAdapter() $data = $queryTable->getRow(0); $this->assertEquals( - array("foo" => "bar"), $data + ["foo" => "bar"], $data ); } public function testGetRowCountLoadsData() { $statementMock = new Zend_Test_DbStatement(); - $statementMock->append(array('foo' => 'bar')); + $statementMock->append(['foo' => 'bar']); $adapterMock = new Zend_Test_DbAdapter(); $adapterMock->appendStatementToStack($statementMock); @@ -92,7 +92,7 @@ public function testDataIsLoadedOnlyOnce() $fixtureSql = "SELECT * FROM foo"; $statementMock = new Zend_Test_DbStatement(); - $statementMock->append(array('foo' => 'bar')); + $statementMock->append(['foo' => 'bar']); $adapterMock = $this->getMock('Zend_Test_DbAdapter'); $adapterMock->expects($this->once()) ->method('query') @@ -105,7 +105,7 @@ public function testDataIsLoadedOnlyOnce() $this->assertEquals(1, $queryTable->getRowCount()); $this->assertEquals(1, $queryTable->getRowCount()); $row = $queryTable->getRow(0); - $this->assertEquals(array('foo' => 'bar'), $row); + $this->assertEquals(['foo' => 'bar'], $row); } public function testQueryTableWithoutRows() @@ -119,8 +119,8 @@ public function testQueryTableWithoutRows() $metadata = $queryTable->getTableMetaData(); $this->assertTrue($metadata instanceof PHPUnit_Extensions_Database_DataSet_ITableMetaData); - $this->assertEquals(array(), $metadata->getColumns()); - $this->assertEquals(array(), $metadata->getPrimaryKeys()); + $this->assertEquals([], $metadata->getColumns()); + $this->assertEquals([], $metadata->getPrimaryKeys()); $this->assertEquals("foo", $metadata->getTableName()); } } diff --git a/tests/Zend/Test/PHPUnit/Db/Integration/AbstractTestCase.php b/tests/Zend/Test/PHPUnit/Db/Integration/AbstractTestCase.php index c7508d8306..10de17bb56 100644 --- a/tests/Zend/Test/PHPUnit/Db/Integration/AbstractTestCase.php +++ b/tests/Zend/Test/PHPUnit/Db/Integration/AbstractTestCase.php @@ -58,15 +58,15 @@ public function testZendDbTableDataSet() "bar", $dataSet->getTableMetaData("bar")->getTableName() ); - $this->assertEquals(array("foo", "bar"), $dataSet->getTableNames()); + $this->assertEquals(["foo", "bar"], $dataSet->getTableNames()); } public function testZendDbTableEqualsXmlDataSet() { $fooTable = $this->createFooTable(); - $fooTable->insert(array("id" => null, "foo" => "foo", "bar" => "bar", "baz" => "baz")); - $fooTable->insert(array("id" => null, "foo" => "bar", "bar" => "bar", "baz" => "bar")); - $fooTable->insert(array("id" => null, "foo" => "baz", "bar" => "baz", "baz" => "baz")); + $fooTable->insert(["id" => null, "foo" => "foo", "bar" => "bar", "baz" => "baz"]); + $fooTable->insert(["id" => null, "foo" => "bar", "bar" => "bar", "baz" => "bar"]); + $fooTable->insert(["id" => null, "foo" => "baz", "bar" => "baz", "baz" => "baz"]); $dataSet = new Zend_Test_PHPUnit_Db_DataSet_DbTableDataSet(); $dataSet->addTable($fooTable); @@ -118,7 +118,7 @@ public function testSimpleTesterSetupAndRowsetEquals() */ public function createFooTable() { - $table = new Zend_Test_PHPUnit_Db_TableFoo(array('db' => $this->dbAdapter)); + $table = new Zend_Test_PHPUnit_Db_TableFoo(['db' => $this->dbAdapter]); return $table; } @@ -127,7 +127,7 @@ public function createFooTable() */ public function createBarTable() { - $table = new Zend_Test_PHPUnit_Db_TableBar(array('db' => $this->dbAdapter)); + $table = new Zend_Test_PHPUnit_Db_TableBar(['db' => $this->dbAdapter]); return $table; } } diff --git a/tests/Zend/Test/PHPUnit/Db/Integration/MysqlIntegrationTest.php b/tests/Zend/Test/PHPUnit/Db/Integration/MysqlIntegrationTest.php index 8f81712440..3abb2ed9b1 100644 --- a/tests/Zend/Test/PHPUnit/Db/Integration/MysqlIntegrationTest.php +++ b/tests/Zend/Test/PHPUnit/Db/Integration/MysqlIntegrationTest.php @@ -49,12 +49,12 @@ public function setUp() return; } - $params = array( + $params = [ 'host' => TESTS_ZEND_DB_ADAPTER_MYSQL_HOSTNAME, 'username' => TESTS_ZEND_DB_ADAPTER_MYSQL_USERNAME, 'password' => TESTS_ZEND_DB_ADAPTER_MYSQL_PASSWORD, 'dbname' => TESTS_ZEND_DB_ADAPTER_MYSQL_DATABASE, - ); + ]; $this->dbAdapter = Zend_Db::factory('pdo_mysql', $params); $this->dbAdapter->query("DROP TABLE IF EXISTS foo"); diff --git a/tests/Zend/Test/PHPUnit/Db/Integration/SqLiteIntegrationTest.php b/tests/Zend/Test/PHPUnit/Db/Integration/SqLiteIntegrationTest.php index bc7963f70b..989064e562 100644 --- a/tests/Zend/Test/PHPUnit/Db/Integration/SqLiteIntegrationTest.php +++ b/tests/Zend/Test/PHPUnit/Db/Integration/SqLiteIntegrationTest.php @@ -42,7 +42,7 @@ public function setUp() $this->markTestSkipped('SqLite is not included in PDO in this PHP installation.'); } - $this->dbAdapter = Zend_Db::factory('pdo_sqlite', array('dbname' => ':memory:')); + $this->dbAdapter = Zend_Db::factory('pdo_sqlite', ['dbname' => ':memory:']); $this->dbAdapter->query( 'CREATE TABLE "foo" (id INTEGER PRIMARY KEY AUTOINCREMENT, foo VARCHAR, bar VARCHAR, baz VARCHAR)' ); diff --git a/tests/Zend/Test/PHPUnit/Db/Metadata/GenericTest.php b/tests/Zend/Test/PHPUnit/Db/Metadata/GenericTest.php index 91a2370bd4..263cfb88ab 100644 --- a/tests/Zend/Test/PHPUnit/Db/Metadata/GenericTest.php +++ b/tests/Zend/Test/PHPUnit/Db/Metadata/GenericTest.php @@ -55,31 +55,31 @@ public function testGetColumnNames() $this->adapterMock->expects($this->once()) ->method('describeTable') ->with($fixtureTableName) - ->will($this->returnValue(array("foo" => 1, "bar" => 2))); + ->will($this->returnValue(["foo" => 1, "bar" => 2])); $data = $this->metadata->getTableColumns($fixtureTableName); - $this->assertEquals(array("foo", "bar"), $data); + $this->assertEquals(["foo", "bar"], $data); } public function testGetTableNames() { $this->adapterMock->expects($this->once()) ->method('listTables') - ->will($this->returnValue(array("foo"))); + ->will($this->returnValue(["foo"])); $tables = $this->metadata->getTableNames(); - $this->assertEquals(array("foo"), $tables); + $this->assertEquals(["foo"], $tables); } public function testGetTablePrimaryKey() { $fixtureTableName = "foo"; - $tableMeta = array( - array('PRIMARY' => false, 'COLUMN_NAME' => 'foo'), - array('PRIMARY' => true, 'COLUMN_NAME' => 'bar'), - array('PRIMARY' => true, 'COLUMN_NAME' => 'baz'), - ); + $tableMeta = [ + ['PRIMARY' => false, 'COLUMN_NAME' => 'foo'], + ['PRIMARY' => true, 'COLUMN_NAME' => 'bar'], + ['PRIMARY' => true, 'COLUMN_NAME' => 'baz'], + ]; $this->adapterMock->expects($this->once()) ->method('describeTable') @@ -87,7 +87,7 @@ public function testGetTablePrimaryKey() ->will($this->returnValue($tableMeta)); $primaryKey = $this->metadata->getTablePrimaryKeys($fixtureTableName); - $this->assertEquals(array("bar", "baz"), $primaryKey); + $this->assertEquals(["bar", "baz"], $primaryKey); } public function testGetAllowCascading() diff --git a/tests/Zend/Test/PHPUnit/Db/Operation/InsertTest.php b/tests/Zend/Test/PHPUnit/Db/Operation/InsertTest.php index 64423968a9..7f511d830e 100644 --- a/tests/Zend/Test/PHPUnit/Db/Operation/InsertTest.php +++ b/tests/Zend/Test/PHPUnit/Db/Operation/InsertTest.php @@ -48,13 +48,13 @@ public function testInsertDataSetUsingAdapterInsert() $testAdapter = $this->getMock('Zend_Test_DbAdapter'); $testAdapter->expects($this->at(0)) ->method('insert') - ->with('foo', array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz')); + ->with('foo', ['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz']); $testAdapter->expects($this->at(1)) ->method('insert') - ->with('foo', array('foo' => 'bar', 'bar' => 'bar', 'baz' => 'bar')); + ->with('foo', ['foo' => 'bar', 'bar' => 'bar', 'baz' => 'bar']); $testAdapter->expects($this->at(2)) ->method('insert') - ->with('foo', array('foo' => 'baz', 'bar' => 'baz', 'baz' => 'baz')); + ->with('foo', ['foo' => 'baz', 'bar' => 'baz', 'baz' => 'baz']); $connection = new Zend_Test_PHPUnit_Db_Connection($testAdapter, "schema"); diff --git a/tests/Zend/Test/PHPUnit/Db/TestCaseTest.php b/tests/Zend/Test/PHPUnit/Db/TestCaseTest.php index a2d6f99470..84fec8bd85 100644 --- a/tests/Zend/Test/PHPUnit/Db/TestCaseTest.php +++ b/tests/Zend/Test/PHPUnit/Db/TestCaseTest.php @@ -54,7 +54,7 @@ protected function getConnection() { if($this->_connectionMock == null) { $this->_connectionMock = $this->getMock( - 'Zend_Test_PHPUnit_Db_Connection', array(), array(new Zend_Test_DbAdapter(), "schema") + 'Zend_Test_PHPUnit_Db_Connection', [], [new Zend_Test_DbAdapter(), "schema"] ); } return $this->_connectionMock; @@ -67,7 +67,7 @@ protected function getConnection() */ protected function getDataSet() { - return new PHPUnit_Extensions_Database_DataSet_CompositeDataSet(array()); + return new PHPUnit_Extensions_Database_DataSet_CompositeDataSet([]); } public function testDatabaseTesterIsInitialized() @@ -82,28 +82,28 @@ public function testDatabaseTesterNestsDefaultConnection() public function testCheckZendDbConnectionConvenienceMethodReturnType() { - $mock = $this->getMock('Zend_Db_Adapter_Pdo_Sqlite', array('delete'), array(), "Zend_Db_Adapter_Mock", false); + $mock = $this->getMock('Zend_Db_Adapter_Pdo_Sqlite', ['delete'], [], "Zend_Db_Adapter_Mock", false); $this->assertTrue($this->createZendDbConnection($mock, "test") instanceof Zend_Test_PHPUnit_Db_Connection); } public function testCreateDbTableDataSetConvenienceMethodReturnType() { - $tableMock = $this->getMock('Zend_Db_Table', array(), array(), "", false); - $tableDataSet = $this->createDbTableDataSet(array($tableMock)); + $tableMock = $this->getMock('Zend_Db_Table', [], [], "", false); + $tableDataSet = $this->createDbTableDataSet([$tableMock]); $this->assertTrue($tableDataSet instanceof Zend_Test_PHPUnit_Db_DataSet_DbTableDataSet); } public function testCreateDbTableConvenienceMethodReturnType() { - $mock = $this->getMock('Zend_Db_Table', array(), array(), "", false); + $mock = $this->getMock('Zend_Db_Table', [], [], "", false); $table = $this->createDbTable($mock); $this->assertTrue($table instanceof Zend_Test_PHPUnit_Db_DataSet_DbTable); } public function testCreateDbRowsetConvenienceMethodReturnType() { - $mock = $this->getMock('Zend_Db_Table_Rowset', array(), array(array())); - $mock->expects($this->once())->method('toArray')->will($this->returnValue(array("foo" => 1, "bar" => 1))); + $mock = $this->getMock('Zend_Db_Table_Rowset', [], [[]]); + $mock->expects($this->once())->method('toArray')->will($this->returnValue(["foo" => 1, "bar" => 1])); $rowset = $this->createDbRowset($mock, "fooTable"); diff --git a/tests/Zend/Test/PHPUnit/_files/application/controllers/ZendTestPhpUnitFooController.php b/tests/Zend/Test/PHPUnit/_files/application/controllers/ZendTestPhpUnitFooController.php index f22796b6c5..ab602a0206 100644 --- a/tests/Zend/Test/PHPUnit/_files/application/controllers/ZendTestPhpUnitFooController.php +++ b/tests/Zend/Test/PHPUnit/_files/application/controllers/ZendTestPhpUnitFooController.php @@ -40,6 +40,6 @@ public function bazAction() public function sessionAction() { $this->_helper->viewRenderer->setNoRender(true); - $_SESSION = array('foo' => 'bar', 'bar' => 'baz'); + $_SESSION = ['foo' => 'bar', 'bar' => 'baz']; } } diff --git a/tests/Zend/Text/FigletTest.php b/tests/Zend/Text/FigletTest.php index bbfb03a5ae..a478dbb841 100644 --- a/tests/Zend/Text/FigletTest.php +++ b/tests/Zend/Text/FigletTest.php @@ -66,37 +66,37 @@ public function testStandardAlignLeft() public function testStandardAlignCenter() { - $figlet = new Zend_Text_Figlet(array('justification' => Zend_Text_Figlet::JUSTIFICATION_CENTER)); + $figlet = new Zend_Text_Figlet(['justification' => Zend_Text_Figlet::JUSTIFICATION_CENTER]); $this->_equalAgainstFile($figlet->render('Dummy'), 'StandardAlignCenter.figlet'); } public function testStandardAlignRight() { - $figlet = new Zend_Text_Figlet(array('justification' => Zend_Text_Figlet::JUSTIFICATION_RIGHT)); + $figlet = new Zend_Text_Figlet(['justification' => Zend_Text_Figlet::JUSTIFICATION_RIGHT]); $this->_equalAgainstFile($figlet->render('Dummy'), 'StandardAlignRight.figlet'); } public function testStandardRightToLeftAlignLeft() { - $figlet = new Zend_Text_Figlet(array('justification' => Zend_Text_Figlet::JUSTIFICATION_LEFT, - 'rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT)); + $figlet = new Zend_Text_Figlet(['justification' => Zend_Text_Figlet::JUSTIFICATION_LEFT, + 'rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT]); $this->_equalAgainstFile($figlet->render('Dummy'), 'StandardRightToLeftAlignLeft.figlet'); } public function testStandardRightToLeftAlignCenter() { - $figlet = new Zend_Text_Figlet(array('justification' => Zend_Text_Figlet::JUSTIFICATION_CENTER, - 'rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT)); + $figlet = new Zend_Text_Figlet(['justification' => Zend_Text_Figlet::JUSTIFICATION_CENTER, + 'rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT]); $this->_equalAgainstFile($figlet->render('Dummy'), 'StandardRightToLeftAlignCenter.figlet'); } public function testStandardRightToLeftAlignRight() { - $figlet = new Zend_Text_Figlet(array('rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT)); + $figlet = new Zend_Text_Figlet(['rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT]); $this->_equalAgainstFile($figlet->render('Dummy'), 'StandardRightToLeftAlignRight.figlet'); } @@ -152,7 +152,7 @@ public function testIncorrectEncoding() public function testNonExistentFont() { try { - $figlet = new Zend_Text_Figlet(array('font' => dirname(__FILE__) . '/Figlet/NonExistentFont.flf')); + $figlet = new Zend_Text_Figlet(['font' => dirname(__FILE__) . '/Figlet/NonExistentFont.flf']); $this->fail('An expected Zend_Text_Figlet_Exception has not been raised'); } catch (Zend_Text_Figlet_Exception $expected) { $this->assertContains('Font file not found', $expected->getMessage()); @@ -162,7 +162,7 @@ public function testNonExistentFont() public function testInvalidFont() { try { - $figlet = new Zend_Text_Figlet(array('font' => dirname(__FILE__) . '/Figlet/InvalidFont.flf')); + $figlet = new Zend_Text_Figlet(['font' => dirname(__FILE__) . '/Figlet/InvalidFont.flf']); $this->fail('An expected Zend_Text_Figlet_Exception has not been raised'); } catch (Zend_Text_Figlet_Exception $expected) { $this->assertContains('Not a FIGlet 2 font file', $expected->getMessage()); @@ -171,13 +171,13 @@ public function testInvalidFont() public function testGzippedFont() { - $figlet = new Zend_Text_Figlet(array('font' => dirname(__FILE__) . '/Figlet/GzippedFont.gz')); + $figlet = new Zend_Text_Figlet(['font' => dirname(__FILE__) . '/Figlet/GzippedFont.gz']); $this->_equalAgainstFile($figlet->render('Dummy'), 'StandardAlignLeft.figlet'); } public function testConfig() { - $config = new Zend_Config(array('justification' => Zend_Text_Figlet::JUSTIFICATION_RIGHT)); + $config = new Zend_Config(['justification' => Zend_Text_Figlet::JUSTIFICATION_RIGHT]); $figlet = new Zend_Text_Figlet($config); $this->_equalAgainstFile($figlet->render('Dummy'), 'StandardAlignRight.figlet'); @@ -185,51 +185,51 @@ public function testConfig() public function testOutputWidth() { - $figlet = new Zend_Text_Figlet(array('outputWidth' => 50, - 'justification' => Zend_Text_Figlet::JUSTIFICATION_RIGHT)); + $figlet = new Zend_Text_Figlet(['outputWidth' => 50, + 'justification' => Zend_Text_Figlet::JUSTIFICATION_RIGHT]); $this->_equalAgainstFile($figlet->render('Dummy'), 'OutputWidth50AlignRight.figlet'); } public function testSmushModeRemoved() { - $figlet = new Zend_Text_Figlet(array('smushMode' => -1)); + $figlet = new Zend_Text_Figlet(['smushMode' => -1]); $this->_equalAgainstFile($figlet->render('Dummy'), 'NoSmush.figlet'); } public function testSmushModeRemovedRightToLeft() { - $figlet = new Zend_Text_Figlet(array('smushMode' => -1, - 'rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT)); + $figlet = new Zend_Text_Figlet(['smushMode' => -1, + 'rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT]); $this->_equalAgainstFile($figlet->render('Dummy'), 'NoSmushRightToLeft.figlet'); } public function testSmushModeInvalid() { - $figlet = new Zend_Text_Figlet(array('smushMode' => -5)); + $figlet = new Zend_Text_Figlet(['smushMode' => -5]); $this->_equalAgainstFile($figlet->render('Dummy'), 'StandardAlignLeft.figlet'); } public function testSmushModeTooSmall() { - $figlet = new Zend_Text_Figlet(array('smushMode' => -2)); + $figlet = new Zend_Text_Figlet(['smushMode' => -2]); $this->_equalAgainstFile($figlet->render('Dummy'), 'StandardAlignLeft.figlet'); } public function testSmushModeDefault() { - $figlet = new Zend_Text_Figlet(array('smushMode' => 0)); + $figlet = new Zend_Text_Figlet(['smushMode' => 0]); $this->_equalAgainstFile($figlet->render('Dummy'), 'SmushDefault.figlet'); } public function testSmushModeForced() { - $figlet = new Zend_Text_Figlet(array('smushMode' => 5)); + $figlet = new Zend_Text_Figlet(['smushMode' => 5]); $this->_equalAgainstFile($figlet->render('Dummy'), 'SmushForced.figlet'); } @@ -243,7 +243,7 @@ public function testWordWrapLeftToRight() public function testWordWrapRightToLeft() { - $figlet = new Zend_Text_Figlet(array('rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT)); + $figlet = new Zend_Text_Figlet(['rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT]); $this->_equalAgainstFile($figlet->render('Dummy Dummy Dummy'), 'WordWrapRightToLeft.figlet'); } @@ -257,7 +257,7 @@ public function testCharWrapLeftToRight() public function testCharWrapRightToLeft() { - $figlet = new Zend_Text_Figlet(array('rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT)); + $figlet = new Zend_Text_Figlet(['rightToLeft' => Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT]); $this->_equalAgainstFile($figlet->render('DummyDumDummy'), 'CharWrapRightToLeft.figlet'); } @@ -271,7 +271,7 @@ public function testParagraphOff() public function testParagraphOn() { - $figlet = new Zend_Text_Figlet(array('handleParagraphs' => true)); + $figlet = new Zend_Text_Figlet(['handleParagraphs' => true]); $this->_equalAgainstFile($figlet->render("Dum\nDum\n\nDum\n"), 'ParagraphOn.figlet'); } diff --git a/tests/Zend/Text/TableTest.php b/tests/Zend/Text/TableTest.php index 5a93e366d3..bee2374257 100644 --- a/tests/Zend/Text/TableTest.php +++ b/tests/Zend/Text/TableTest.php @@ -194,7 +194,7 @@ public function testUnicodeStringPadding() $row->appendColumn(new Zend_Text_Table_Column('Eté')); $row->appendColumn(new Zend_Text_Table_Column('Ete')); - $this->assertEquals($row->render(array(10, 10), $decorator), "│Eté │Ete │\n"); + $this->assertEquals($row->render([10, 10], $decorator), "│Eté │Ete │\n"); } public function testRowColumnsWithColSpan() @@ -206,7 +206,7 @@ public function testRowColumnsWithColSpan() $row->appendColumn(new Zend_Text_Table_Column('foobar')); $row->appendColumn(new Zend_Text_Table_Column('foobar', null, 2)); - $this->assertEquals($row->render(array(10, 10, 10), $decorator), "│foobar │foobar │\n"); + $this->assertEquals($row->render([10, 10, 10], $decorator), "│foobar │foobar │\n"); } public function testRowWithNoColumns() @@ -215,7 +215,7 @@ public function testRowWithNoColumns() $row = new Zend_Text_Table_Row(); - $this->assertEquals($row->render(array(10, 10, 10), $decorator), "│ │\n"); + $this->assertEquals($row->render([10, 10, 10], $decorator), "│ │\n"); } public function testRowNotEnoughColumnWidths() @@ -227,7 +227,7 @@ public function testRowNotEnoughColumnWidths() $row->appendColumn(new Zend_Text_Table_Column()); try { - $row->render(array(10), $decorator); + $row->render([10], $decorator); $this->fail('An expected Zend_Text_Table_Exception has not been raised'); } catch (Zend_Text_Table_Exception $expected) { $this->assertContains('Too many columns', $expected->getMessage()); @@ -253,7 +253,7 @@ public function testRowAutoInsertColumns() $row = new Zend_Text_Table_Row(); $row->appendColumn(new Zend_Text_Table_Column('foobar')); - $this->assertEquals($row->render(array(10, 10, 10), $decorator), "│foobar │ │\n"); + $this->assertEquals($row->render([10, 10, 10], $decorator), "│foobar │ │\n"); } public function testRowMultiLine() @@ -264,7 +264,7 @@ public function testRowMultiLine() $row->appendColumn(new Zend_Text_Table_Column("foo\nbar")); $row->appendColumn(new Zend_Text_Table_Column("foobar")); - $this->assertEquals($row->render(array(10, 10), $decorator), "│foo │foobar │\n│bar │ │\n"); + $this->assertEquals($row->render([10, 10], $decorator), "│foo │foobar │\n│bar │ │\n"); } public function testUnicodeRowMultiLine() @@ -275,13 +275,13 @@ public function testUnicodeRowMultiLine() $row->appendColumn(new Zend_Text_Table_Column("föö\nbär")); $row->appendColumn(new Zend_Text_Table_Column("fööbär")); - $this->assertEquals($row->render(array(3, 10), $decorator), "│föö│fööbär │\n│bär│ │\n"); + $this->assertEquals($row->render([3, 10], $decorator), "│föö│fööbär │\n│bär│ │\n"); } public function testTableConstructInvalidColumnWidths() { try { - $table = new Zend_Text_Table(array('columnWidths' => array())); + $table = new Zend_Text_Table(['columnWidths' => []]); $this->fail('An expected Zend_Text_Table_Exception has not been raised'); } catch (Zend_Text_Table_Exception $expected) { $this->assertContains('You must supply at least one column', $expected->getMessage()); @@ -291,7 +291,7 @@ public function testTableConstructInvalidColumnWidths() public function testTableConstructInvalidColumnWidthsItem() { try { - $table = new Zend_Text_Table(array('columnWidths' => array('foo'))); + $table = new Zend_Text_Table(['columnWidths' => ['foo']]); $this->fail('An expected Zend_Text_Table_Exception has not been raised'); } catch (Zend_Text_Table_Exception $expected) { $this->assertContains('Column 0 has an invalid column width', $expected->getMessage()); @@ -300,7 +300,7 @@ public function testTableConstructInvalidColumnWidthsItem() public function testTableDecoratorLoaderSimple() { - $table = new Zend_Text_Table(array('columnWidths' => array(10), 'decorator' => 'ascii')); + $table = new Zend_Text_Table(['columnWidths' => [10], 'decorator' => 'ascii']); $row = new Zend_Text_Table_Row(); $row->createColumn('foobar'); @@ -313,7 +313,7 @@ public function testTableDecoratorEncodingDefault() { Zend_Text_Table::setOutputCharset('iso-8859-15'); - $table = new Zend_Text_Table(array('columnWidths' => array(10))); + $table = new Zend_Text_Table(['columnWidths' => [10]]); $row = new Zend_Text_Table_Row(); $row->createColumn('foobar'); @@ -324,7 +324,7 @@ public function testTableDecoratorEncodingDefault() public function testTableDecoratorLoaderAdvanced() { - $table = new Zend_Text_Table(array('columnWidths' => array(10), 'decorator' => new Zend_Text_Table_Decorator_Ascii())); + $table = new Zend_Text_Table(['columnWidths' => [10], 'decorator' => new Zend_Text_Table_Decorator_Ascii()]); $row = new Zend_Text_Table_Row(); $row->createColumn('foobar'); @@ -335,7 +335,7 @@ public function testTableDecoratorLoaderAdvanced() public function testTableSimpleRow() { - $table = new Zend_Text_Table(array('columnWidths' => array(10))); + $table = new Zend_Text_Table(['columnWidths' => [10]]); $row = new Zend_Text_Table_Row(); $row->createColumn('foobar'); @@ -346,11 +346,11 @@ public function testTableSimpleRow() public function testDefaultColumnAlign() { - $table = new Zend_Text_Table(array('columnWidths' => array(10))); + $table = new Zend_Text_Table(['columnWidths' => [10]]); $table->setDefaultColumnAlign(0, Zend_Text_Table_Column::ALIGN_CENTER); - $table->appendRow(array('foobar')); + $table->appendRow(['foobar']); $this->assertEquals($table->render(), "┌──────────┐\n│ foobar │\n└──────────┘\n"); } @@ -382,7 +382,7 @@ public function testRowGetInvalidColumn() public function testTableWithoutRows() { - $table = new Zend_Text_Table(array('columnWidths' => array(10))); + $table = new Zend_Text_Table(['columnWidths' => [10]]); try { $table->render(); @@ -394,7 +394,7 @@ public function testTableWithoutRows() public function testTableColSpanWithMultipleRows() { - $table = new Zend_Text_Table(array('columnWidths' => array(10, 10))); + $table = new Zend_Text_Table(['columnWidths' => [10, 10]]); $row = new Zend_Text_Table_Row(); $row->appendColumn(new Zend_Text_Table_Column('foobar')); @@ -414,7 +414,7 @@ public function testTableColSpanWithMultipleRows() public function testTableComplex() { - $table = new Zend_Text_Table(array('columnWidths' => array(10, 10, 10))); + $table = new Zend_Text_Table(['columnWidths' => [10, 10, 10]]); $row = new Zend_Text_Table_Row(); $row->appendColumn(new Zend_Text_Table_Column('foobar')); @@ -449,7 +449,7 @@ public function testTableComplex() public function testTableMagicToString() { - $table = new Zend_Text_Table(array('columnWidths' => array(10))); + $table = new Zend_Text_Table(['columnWidths' => [10]]); $row = new Zend_Text_Table_Row(); $row->appendColumn(new Zend_Text_Table_Column('foobar')); diff --git a/tests/Zend/TimeSyncTest.php b/tests/Zend/TimeSyncTest.php index 2a98081daa..590e8d4ff3 100644 --- a/tests/Zend/TimeSyncTest.php +++ b/tests/Zend/TimeSyncTest.php @@ -35,7 +35,7 @@ */ class Zend_TimeSyncTest extends PHPUnit_Framework_TestCase { - public $timeservers = array( + public $timeservers = [ // invalid servers 'server_a' => 'ntp://be.foo.bar.org', 'server_b' => 'sntp://be.foo.bar.org', @@ -45,7 +45,7 @@ class Zend_TimeSyncTest extends PHPUnit_Framework_TestCase 'server_d' => 'ntp://be.pool.ntp.org', 'server_e' => 'ntp://time.windows.com', 'server_f' => 'sntp://time-C.timefreq.bldrdoc.gov' - ); + ]; /** * Test for object initialisation @@ -141,7 +141,7 @@ public function testSetOption() $timeout = 5; $server = new Zend_TimeSync(); - $server->setOptions(array('timeout' => $timeout)); + $server->setOptions(['timeout' => $timeout]); $this->assertEquals($timeout, $server->getOptions('timeout')); } @@ -153,10 +153,10 @@ public function testSetOption() */ public function testSetOptions() { - $options = array( + $options = [ 'timeout' => 5, 'foo' => 'bar' - ); + ]; $server = new Zend_TimeSync(); $server->setOptions($options); @@ -292,10 +292,10 @@ public function testGetSntpDate() */ public function testGetInvalidDate() { - $servers = array( + $servers = [ 'server_a' => 'dummy-ntp-timeserver.com', 'server_b' => 'another-dummy-ntp-timeserver.com' - ); + ]; $server = new Zend_TimeSync($servers); diff --git a/tests/Zend/Tool/Framework/Client/ResponseTest.php b/tests/Zend/Tool/Framework/Client/ResponseTest.php index bf6d83598e..6e7924665b 100644 --- a/tests/Zend/Tool/Framework/Client/ResponseTest.php +++ b/tests/Zend/Tool/Framework/Client/ResponseTest.php @@ -46,7 +46,7 @@ class Zend_Tool_Framework_Client_ResponseTest extends PHPUnit_Framework_TestCase */ protected $_response = null; - protected $_responseBuffer = array(); + protected $_responseBuffer = []; public function setup() { @@ -76,7 +76,7 @@ public function testContentCanBeAppended() public function testContentCallback() { - $this->_response->setContentCallback(array($this, '_responseCallback')); + $this->_response->setContentCallback([$this, '_responseCallback']); $this->_response->appendContent('foo'); $this->assertEquals('foo', implode('', $this->_responseBuffer)); $this->_response->appendContent('bar'); @@ -120,8 +120,8 @@ public function testResponseWillApplyDecorator() { $separator = new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator(); $this->_response->addContentDecorator($separator); - $this->_response->appendContent('foo', array('separator' => true)); - $this->_response->appendContent('boo', array('separator' => true)); + $this->_response->appendContent('foo', ['separator' => true]); + $this->_response->appendContent('boo', ['separator' => true]); $this->assertEquals('foo' . PHP_EOL . 'boo' . PHP_EOL, $this->_response->__toString()); } @@ -129,8 +129,8 @@ public function testResponseWillIgnoreUnknownDecoratorOptions() { $separator = new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator(); $this->_response->addContentDecorator($separator); - $this->_response->appendContent('foo', array('foo' => 'foo')); - $this->_response->appendContent('boo', array('bar' => 'bar')); + $this->_response->appendContent('foo', ['foo' => 'foo']); + $this->_response->appendContent('boo', ['bar' => 'bar']); $this->assertEquals('fooboo', $this->_response->__toString()); } @@ -138,7 +138,7 @@ public function testResponseWillApplyDecoratorWithDefaultOptions() { $separator = new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator(); $this->_response->addContentDecorator($separator); - $this->_response->setDefaultDecoratorOptions(array('separator' => true)); + $this->_response->setDefaultDecoratorOptions(['separator' => true]); $this->_response->appendContent('foo'); $this->_response->appendContent('boo'); $this->assertEquals('foo' . PHP_EOL . 'boo' . PHP_EOL, $this->_response->__toString()); diff --git a/tests/Zend/Tool/Framework/Manifest/ProviderMetadataTest.php b/tests/Zend/Tool/Framework/Manifest/ProviderMetadataTest.php index 18d210724e..2b8fd2c62c 100644 --- a/tests/Zend/Tool/Framework/Manifest/ProviderMetadataTest.php +++ b/tests/Zend/Tool/Framework/Manifest/ProviderMetadataTest.php @@ -63,14 +63,14 @@ public function testConstructorWillAcceptAndPersistValues() { $obj1 = new ArrayObject(); - $metadata = new Zend_Tool_Framework_Manifest_ProviderMetadata(array( + $metadata = new Zend_Tool_Framework_Manifest_ProviderMetadata([ 'name' => 'Foo', 'providerName' => 'FooBar', 'actionName' => 'BarBaz', 'specialtyName' => 'FooBarBaz', 'value' => 'Bar', 'reference' => $obj1 - )); + ]); $this->assertEquals('Foo', $metadata->getName()); $this->assertEquals('FooBar', $metadata->getProviderName()); @@ -84,14 +84,14 @@ public function testSetOptionsPersistValues() { $obj1 = new ArrayObject(); - $this->_metadata->setOptions(array( + $this->_metadata->setOptions([ 'name' => 'Foo', 'providerName' => 'FooBar', 'actionName' => 'BarBaz', 'specialtyName' => 'FooBarBaz', 'value' => 'Bar', 'reference' => $obj1 - )); + ]); $this->assertEquals('Foo', $this->_metadata->getName()); $this->assertEquals('FooBar', $this->_metadata->getProviderName()); @@ -117,14 +117,14 @@ public function testMetadataObjectCanCastToStringRepresentation() { $obj1 = new ArrayObject(); - $this->_metadata->setOptions(array( + $this->_metadata->setOptions([ 'name' => 'Foo', 'providerName' => 'FooBar', 'actionName' => 'BarBaz', 'specialtyName' => 'FooBarBaz', 'value' => 'Bar', 'reference' => $obj1 - )); + ]); $this->assertEquals('Type: Provider, Name: Foo, Value: Bar (ProviderName: FooBar, ActionName: BarBaz, SpecialtyName: FooBarBaz)', (string) $this->_metadata); } diff --git a/tests/Zend/Tool/Framework/Manifest/RepositoryTest.php b/tests/Zend/Tool/Framework/Manifest/RepositoryTest.php index 39e2517982..57e235454f 100644 --- a/tests/Zend/Tool/Framework/Manifest/RepositoryTest.php +++ b/tests/Zend/Tool/Framework/Manifest/RepositoryTest.php @@ -175,26 +175,26 @@ public function testRepositoryIsIterable() public function testManifestGetMetadatasCollectionSearchWorks() { - $metadata1 = new Zend_Tool_Framework_Metadata_Basic(array( + $metadata1 = new Zend_Tool_Framework_Metadata_Basic([ 'name' => 'Foo', 'value' => 'Bar', - )); + ]); - $metadata2 = new Zend_Tool_Framework_Metadata_Basic(array( + $metadata2 = new Zend_Tool_Framework_Metadata_Basic([ 'name' => 'Bar', 'value' => 'Baz', - )); + ]); - $metadata3 = new Zend_Tool_Framework_Metadata_Basic(array( + $metadata3 = new Zend_Tool_Framework_Metadata_Basic([ 'name' => 'Baz', 'value' => 'Foo', - )); + ]); $this->_repository->addMetadata($metadata1); $this->_repository->addMetadata($metadata2); $this->_repository->addMetadata($metadata3); - $resultMetadatas = $this->_repository->getMetadatas(array('name' => 'Bar')); + $resultMetadatas = $this->_repository->getMetadatas(['name' => 'Bar']); $this->assertEquals(1, count($resultMetadatas)); $this->assertTrue($metadata2 === array_shift($resultMetadatas)); @@ -203,55 +203,55 @@ public function testManifestGetMetadatasCollectionSearchWorks() public function testManifestGetMetadataSingularSearchWorks() { - $metadata1 = new Zend_Tool_Framework_Metadata_Basic(array( + $metadata1 = new Zend_Tool_Framework_Metadata_Basic([ 'name' => 'Foo', 'value' => 'Bar', - )); + ]); - $metadata2 = new Zend_Tool_Framework_Metadata_Basic(array( + $metadata2 = new Zend_Tool_Framework_Metadata_Basic([ 'name' => 'Bar', 'value' => 'Baz', - )); + ]); - $metadata3 = new Zend_Tool_Framework_Metadata_Basic(array( + $metadata3 = new Zend_Tool_Framework_Metadata_Basic([ 'name' => 'Baz', 'value' => 'Foo', - )); + ]); $this->_repository->addMetadata($metadata1); $this->_repository->addMetadata($metadata2); $this->_repository->addMetadata($metadata3); - $resultMetadata = $this->_repository->getMetadata(array('name' => 'Baz')); + $resultMetadata = $this->_repository->getMetadata(['name' => 'Baz']); $this->assertTrue($metadata3 === $resultMetadata); } public function testManifestGetMetadatasCollectionSearchWorksWithNonExistentProperties() { - $metadata1 = new Zend_Tool_Framework_Metadata_Basic(array( + $metadata1 = new Zend_Tool_Framework_Metadata_Basic([ 'name' => 'Foo', 'value' => 'Bar', - )); + ]); - $metadata2 = new Zend_Tool_Framework_Metadata_Basic(array( + $metadata2 = new Zend_Tool_Framework_Metadata_Basic([ 'name' => 'Bar', 'value' => 'Baz', - )); + ]); - $metadata3 = new Zend_Tool_Framework_Metadata_Basic(array( + $metadata3 = new Zend_Tool_Framework_Metadata_Basic([ 'name' => 'Baz', 'value' => 'Foo', - )); + ]); $this->_repository->addMetadata($metadata1); $this->_repository->addMetadata($metadata2); $this->_repository->addMetadata($metadata3); - $resultMetadatas = $this->_repository->getMetadatas(array('name' => 'Bar', 'blah' => 'boo')); + $resultMetadatas = $this->_repository->getMetadatas(['name' => 'Bar', 'blah' => 'boo']); $this->assertEquals(1, count($resultMetadatas)); - $resultMetadatas = $this->_repository->getMetadatas(array('name' => 'Bar', 'blah' => 'boo'), false); + $resultMetadatas = $this->_repository->getMetadatas(['name' => 'Bar', 'blah' => 'boo'], false); $this->assertEquals(0, count($resultMetadatas)); //$this->assertTrue($metadata2 === array_shift($resultMetadatas)); diff --git a/tests/Zend/Tool/Framework/Manifest/_files/ManifestBadMetadata.php b/tests/Zend/Tool/Framework/Manifest/_files/ManifestBadMetadata.php index b07016bae4..32789f1542 100644 --- a/tests/Zend/Tool/Framework/Manifest/_files/ManifestBadMetadata.php +++ b/tests/Zend/Tool/Framework/Manifest/_files/ManifestBadMetadata.php @@ -36,10 +36,10 @@ class Zend_Tool_Framework_Manifest_ManifestBadMetadata public function getMetadata() { - return array( - new Zend_Tool_Framework_Metadata_Basic(array('name' => 'FooTwo', 'value' => 'Baz1')), + return [ + new Zend_Tool_Framework_Metadata_Basic(['name' => 'FooTwo', 'value' => 'Baz1']), new ArrayObject() - ); + ]; } diff --git a/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodOne.php b/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodOne.php index 2623c759b1..8942efa279 100644 --- a/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodOne.php +++ b/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodOne.php @@ -60,7 +60,7 @@ public function getActions() public function getMetadata() { - return new Zend_Tool_Framework_Metadata_Basic(array('name' => 'FooOne', 'value' => 'Bar')); + return new Zend_Tool_Framework_Metadata_Basic(['name' => 'FooOne', 'value' => 'Bar']); } } diff --git a/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodTwo.php b/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodTwo.php index ff5e02046f..667da55c4c 100644 --- a/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodTwo.php +++ b/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodTwo.php @@ -58,25 +58,25 @@ public function getIndex() public function getProviders() { - return array( + return [ new Zend_Tool_Framework_Manifest_ProviderTwo() - ); + ]; } public function getActions() { - return array( + return [ new Zend_Tool_Framework_Manifest_ActionTwo(), 'Foo' - ); + ]; } public function getMetadata() { - return array( - new Zend_Tool_Framework_Metadata_Basic(array('name' => 'FooTwo', 'value' => 'Baz1')), - new Zend_Tool_Framework_Metadata_Basic(array('name' => 'FooThree', 'value' => 'Baz2')) - ); + return [ + new Zend_Tool_Framework_Metadata_Basic(['name' => 'FooTwo', 'value' => 'Baz1']), + new Zend_Tool_Framework_Metadata_Basic(['name' => 'FooThree', 'value' => 'Baz2']) + ]; } diff --git a/tests/Zend/Tool/Framework/Metadata/ActionMetadataTest.php b/tests/Zend/Tool/Framework/Metadata/ActionMetadataTest.php index e174a40ede..f425b4c5e3 100644 --- a/tests/Zend/Tool/Framework/Metadata/ActionMetadataTest.php +++ b/tests/Zend/Tool/Framework/Metadata/ActionMetadataTest.php @@ -63,12 +63,12 @@ public function testConstructorWillAcceptAndPersistValues() { $obj1 = new ArrayObject(); - $metadata = new Zend_Tool_Framework_Manifest_ActionMetadata(array( + $metadata = new Zend_Tool_Framework_Manifest_ActionMetadata([ 'name' => 'Foo', 'actionName' => 'BarBaz', 'value' => 'Bar', 'reference' => $obj1 - )); + ]); $this->assertEquals('Foo', $metadata->getName()); $this->assertEquals('BarBaz', $metadata->getActionName()); @@ -80,12 +80,12 @@ public function testSetOptionsPersistValues() { $obj1 = new ArrayObject(); - $this->_metadata->setOptions(array( + $this->_metadata->setOptions([ 'name' => 'Foo', 'actionName' => 'BarBaz', 'value' => 'Bar', 'reference' => $obj1 - )); + ]); $this->assertEquals('Foo', $this->_metadata->getName()); $this->assertEquals('BarBaz', $this->_metadata->getActionName()); @@ -103,12 +103,12 @@ public function testMetadataObjectCanCastToStringRepresentation() { $obj1 = new ArrayObject(); - $this->_metadata->setOptions(array( + $this->_metadata->setOptions([ 'name' => 'Foo', 'actionName' => 'BarBaz', 'value' => 'Bar', 'reference' => $obj1 - )); + ]); $this->assertEquals('Type: Action, Name: Foo, Value: Bar (ActionName: BarBaz)', (string) $this->_metadata); } diff --git a/tests/Zend/Tool/Framework/Metadata/MetadataTest.php b/tests/Zend/Tool/Framework/Metadata/MetadataTest.php index de970df537..15bb58f2fb 100644 --- a/tests/Zend/Tool/Framework/Metadata/MetadataTest.php +++ b/tests/Zend/Tool/Framework/Metadata/MetadataTest.php @@ -58,11 +58,11 @@ public function testConstructorWillAcceptAndPersistValues() { $obj1 = new ArrayObject(); - $metadata = new Zend_Tool_Framework_Manifest_Metadata(array( + $metadata = new Zend_Tool_Framework_Manifest_Metadata([ 'name' => 'Foo', 'value' => 'Bar', 'reference' => $obj1 - )); + ]); $this->assertEquals('Foo', $metadata->getName()); $this->assertEquals('Bar', $metadata->getValue()); @@ -73,11 +73,11 @@ public function testSetOptionsPersistValues() { $obj1 = new ArrayObject(); - $this->_metadata->setOptions(array( + $this->_metadata->setOptions([ 'name' => 'Foo', 'value' => 'Bar', 'reference' => $obj1 - )); + ]); $this->assertEquals('Foo', $this->_metadata->getName()); $this->assertEquals('Bar', $this->_metadata->getValue()); @@ -107,11 +107,11 @@ public function testGetAttributesReturnsProperValues() { $obj1 = new ArrayObject(); - $this->_metadata->setOptions(array( + $this->_metadata->setOptions([ 'name' => 'Foo', 'value' => null, 'reference' => $obj1 - )); + ]); $attributes = $this->_metadata->getAttributes(); @@ -142,11 +142,11 @@ public function testMetadataObjectCanCastToStringRepresentation() { $obj1 = new ArrayObject(); - $this->_metadata->setOptions(array( + $this->_metadata->setOptions([ 'name' => 'Foo', 'value' => 'Bar', 'reference' => $obj1 - )); + ]); $this->assertEquals('Type: Global, Name: Foo, Value: Bar', (string) $this->_metadata); } diff --git a/tests/Zend/Tool/Framework/Provider/SignatureTest.php b/tests/Zend/Tool/Framework/Provider/SignatureTest.php index 2cdd848b75..eb21c3144d 100644 --- a/tests/Zend/Tool/Framework/Provider/SignatureTest.php +++ b/tests/Zend/Tool/Framework/Provider/SignatureTest.php @@ -106,7 +106,7 @@ public function testGetProviderReflectionWillReturnZendReflectionClassObject() public function testGetSpecialtiesReturnsParsedSpecialties() { - $this->assertEquals(array('_Global', 'Hi', 'BloodyMurder', 'ForYourTeam'), $this->_targetSignature->getSpecialties()); + $this->assertEquals(['_Global', 'Hi', 'BloodyMurder', 'ForYourTeam'], $this->_targetSignature->getSpecialties()); } public function testGetSpecialtiesReturnsParsedSpecialtiesFromMethodInsteadOfProperty() @@ -114,7 +114,7 @@ public function testGetSpecialtiesReturnsParsedSpecialtiesFromMethodInsteadOfPro $signature = new Zend_Tool_Framework_Provider_Signature(new Zend_Tool_Framework_Provider_ProviderFullFeatured2()); $signature->setRegistry($this->_registry); $signature->process(); - $this->assertEquals(array('_Global', 'Hi', 'BloodyMurder', 'ForYourTeam'), $signature->getSpecialties()); + $this->assertEquals(['_Global', 'Hi', 'BloodyMurder', 'ForYourTeam'], $signature->getSpecialties()); } /** diff --git a/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured.php b/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured.php index b50846efb3..b12298a10b 100644 --- a/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured.php +++ b/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured.php @@ -32,7 +32,7 @@ class Zend_Tool_Framework_Provider_ProviderFullFeatured extends Zend_Tool_Framework_Provider_Abstract { - protected $_specialties = array('Hi', 'BloodyMurder', 'ForYourTeam'); + protected $_specialties = ['Hi', 'BloodyMurder', 'ForYourTeam']; public function getName() { @@ -71,7 +71,7 @@ protected function _iAmNotCallable() public function _testReturnInternals() { - return array($this->_registry->getRequest(), $this->_registry->getResponse()); + return [$this->_registry->getRequest(), $this->_registry->getResponse()]; } } diff --git a/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured2.php b/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured2.php index 4f30fffa7c..bfd568e853 100644 --- a/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured2.php +++ b/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured2.php @@ -39,7 +39,7 @@ public function getName() public function getSpecialties() { - return array('Hi', 'BloodyMurder', 'ForYourTeam'); + return ['Hi', 'BloodyMurder', 'ForYourTeam']; } /** diff --git a/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeaturedBadSpecialties2.php b/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeaturedBadSpecialties2.php index 8167f4333a..b5fbb797f9 100644 --- a/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeaturedBadSpecialties2.php +++ b/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeaturedBadSpecialties2.php @@ -34,7 +34,7 @@ class Zend_Tool_Framework_Provider_ProviderFullFeaturedBadSpecialties2 extends Z public function getSpecialties() { - return new ArrayObject(array('Hi', 'BloodyMurder', 'ForYourTeam')); + return new ArrayObject(['Hi', 'BloodyMurder', 'ForYourTeam']); } } diff --git a/tests/Zend/Tool/Framework/_files/EmptyLoader.php b/tests/Zend/Tool/Framework/_files/EmptyLoader.php index f38272f3a0..b10c1fa3aa 100644 --- a/tests/Zend/Tool/Framework/_files/EmptyLoader.php +++ b/tests/Zend/Tool/Framework/_files/EmptyLoader.php @@ -33,6 +33,6 @@ class Zend_Tool_Framework_EmptyLoader extends Zend_Tool_Framework_Loader_Abstrac { protected function _getFiles() { - return array(); + return []; } } diff --git a/tests/Zend/Tool/Project/ProfileTest.php b/tests/Zend/Tool/Project/ProfileTest.php index e9844893ed..d2cac20b0d 100644 --- a/tests/Zend/Tool/Project/ProfileTest.php +++ b/tests/Zend/Tool/Project/ProfileTest.php @@ -69,8 +69,8 @@ public function teardown() public function testAttibuteGettersAndSettersWork() { - $profile = new Zend_Tool_Project_Profile(array('foo' => 'bar')); - $profile->setAttributes(array('baz' => 'BAZ')); + $profile = new Zend_Tool_Project_Profile(['foo' => 'bar']); + $profile->setAttributes(['baz' => 'BAZ']); $profile->setAttribute('boof', 'foob'); $this->assertEquals('foob', $profile->getAttribute('boof')); @@ -98,10 +98,10 @@ public function testProfileLoadsFromExistingFileGivenProjectDirectory() public function testProfileLoadsFromExistingFileGivenProfileFile() { - $profile = new Zend_Tool_Project_Profile(array( + $profile = new Zend_Tool_Project_Profile([ 'projectProfileFile' => $this->_projectProfileFile, 'projectDirectory' => $this->_projectDirectory - )); + ]); $profile->loadFromFile(); $projectDirectoryResource = $profile->current(); @@ -142,7 +142,7 @@ public function testProfileFromVariousSourcesIsLoadableFromFile() public function testLoadFromDataIsSameAsLoadFromFile() { - $profile = new Zend_Tool_Project_Profile(array('projectProfileFile' => $this->_projectProfileFile)); + $profile = new Zend_Tool_Project_Profile(['projectProfileFile' => $this->_projectProfileFile]); $profile->setAttribute('projectDirectory', $this->_projectDirectory); $profile->loadFromFile(); @@ -158,7 +158,7 @@ public function testProfileCanReturnStorageData() { $this->_standardProfileFromData->loadFromData(); $expectedValue = ' '; - $this->assertEquals($expectedValue, str_replace(array("\r\n", "\n"), '', $this->_standardProfileFromData->storeToData())); + $this->assertEquals($expectedValue, str_replace(["\r\n", "\n"], '', $this->_standardProfileFromData->storeToData())); } public function testProfileCanSaveStorageDataToFile() @@ -171,10 +171,10 @@ public function testProfileCanSaveStorageDataToFile() public function testProfileCanFindResource() { - $profile = new Zend_Tool_Project_Profile(array( + $profile = new Zend_Tool_Project_Profile([ 'projectProfileFile' => $this->_projectProfileFile, 'projectDirectory' => $this->_projectDirectory - )); + ]); $profile->loadFromFile(); $modelsDirectoryResource = $profile->search('modelsDirectory'); @@ -182,7 +182,7 @@ public function testProfileCanFindResource() $this->assertEquals('Zend_Tool_Project_Profile_Resource', get_class($modelsDirectoryResource)); $this->assertEquals('Zend_Tool_Project_Context_Zf_ModelsDirectory', get_class($modelsDirectoryResource->getContext())); - $publicIndexFile = $profile->search(array('publicDirectory', 'publicIndexFile')); + $publicIndexFile = $profile->search(['publicDirectory', 'publicIndexFile']); $this->assertEquals('Zend_Tool_Project_Profile_Resource', get_class($publicIndexFile)); $this->assertEquals('Zend_Tool_Project_Context_Zf_PublicIndexFile', get_class($publicIndexFile->getContext())); diff --git a/tests/Zend/Translate/Adapter/ArrayTest.php b/tests/Zend/Translate/Adapter/ArrayTest.php index d553d97f92..9aa6bda270 100644 --- a/tests/Zend/Translate/Adapter/ArrayTest.php +++ b/tests/Zend/Translate/Adapter/ArrayTest.php @@ -75,8 +75,8 @@ public function tearDown() public function testCreate() { - set_error_handler(array($this, 'errorHandlerIgnore')); - $adapter = new Zend_Translate_Adapter_Array(array()); + set_error_handler([$this, 'errorHandlerIgnore']); + $adapter = new Zend_Translate_Adapter_Array([]); restore_error_handler(); $this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array); @@ -97,7 +97,7 @@ public function testCreate() public function testToString() { - $adapter = new Zend_Translate_Adapter_Array(array('msg1' => 'Message 1 (en)', 'msg2' => 'Message 2 (en)', 'msg3' => 'Message 3 (en)'), 'en'); + $adapter = new Zend_Translate_Adapter_Array(['msg1' => 'Message 1 (en)', 'msg2' => 'Message 2 (en)', 'msg3' => 'Message 3 (en)'], 'en'); $this->assertEquals('Array', $adapter->toString()); } @@ -141,7 +141,7 @@ public function testLoadTranslationData() $this->assertContains('does not exist', $e->getMessage()); } - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.php', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.php', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } @@ -149,8 +149,8 @@ public function testLoadTranslationData() public function testOptions() { $adapter = new Zend_Translate_Adapter_Array(dirname(__FILE__) . '/_files/translation_en.php', 'en'); - $adapter->setOptions(array('testoption' => 'testkey')); - $expected = array( + $adapter->setOptions(['testoption' => 'testkey']); + $expected = [ 'testoption' => 'testkey', 'clear' => false, 'content' => dirname(__FILE__) . '/_files/translation_en.php', @@ -162,7 +162,7 @@ public function testOptions() 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false, - ); + ]; $options = $adapter->getOptions(); @@ -180,7 +180,7 @@ public function testClearing() $adapter = new Zend_Translate_Adapter_Array(dirname(__FILE__) . '/_files/translation_en.php', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 6', $adapter->translate('Message 6')); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.php', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.php', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Message 4', $adapter->translate('Message 4')); } @@ -200,7 +200,7 @@ public function testLocale() $this->assertContains('does not exist', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter->setLocale('de'); restore_error_handler(); $this->assertEquals('de', $adapter->getLocale()); @@ -209,9 +209,9 @@ public function testLocale() public function testList() { $adapter = new Zend_Translate_Adapter_Array(dirname(__FILE__) . '/_files/translation_en.php', 'en'); - $this->assertEquals(array('en' => 'en'), $adapter->getList()); - $adapter->addTranslation(array('msg1'), 'de'); - $this->assertEquals(array('en' => 'en', 'de' => 'de'), $adapter->getList()); + $this->assertEquals(['en' => 'en'], $adapter->getList()); + $adapter->addTranslation(['msg1'], 'de'); + $this->assertEquals(['en' => 'en', 'de' => 'de'], $adapter->getList()); $this->assertTrue($adapter->isAvailable('de')); $locale = new Zend_Locale('en'); $this->assertTrue($adapter->isAvailable($locale)); @@ -221,16 +221,16 @@ public function testList() public function testOptionLocaleDirectory() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Array(dirname(__FILE__) . '/_files/testarray', 'de_AT', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('de_AT' => 'de_AT', 'en_GB' => 'en_GB', 'ja' => 'ja'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Array(dirname(__FILE__) . '/_files/testarray', 'de_AT', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['de_AT' => 'de_AT', 'en_GB' => 'en_GB', 'ja' => 'ja'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } public function testOptionLocaleFilename() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Array(dirname(__FILE__) . '/_files/testarray', 'de_DE', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('de_DE' => 'de_DE', 'en_US' => 'en_US', 'ja' => 'ja'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Array(dirname(__FILE__) . '/_files/testarray', 'de_DE', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['de_DE' => 'de_DE', 'en_US' => 'en_US', 'ja' => 'ja'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } @@ -242,15 +242,15 @@ public function testLoadArrayFile() public function testDisablingNotices() { - set_error_handler(array($this, 'errorHandlerIgnore')); - $adapter = new Zend_Translate_Adapter_Array(array()); + set_error_handler([$this, 'errorHandlerIgnore']); + $adapter = new Zend_Translate_Adapter_Array([]); $this->assertTrue($this->_errorOccurred); restore_error_handler(); $this->_errorOccurred = false; $this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array); - set_error_handler(array($this, 'errorHandlerIgnore')); - $adapter = new Zend_Translate_Adapter_Array(array(), 'en', array('disableNotices' => true)); + set_error_handler([$this, 'errorHandlerIgnore']); + $adapter = new Zend_Translate_Adapter_Array([], 'en', ['disableNotices' => true]); $this->assertFalse($this->_errorOccurred); restore_error_handler(); $this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array); @@ -284,8 +284,8 @@ public function testCaching() { require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', - array('lifetime' => 120, 'automatic_serialization' => true), - array('cache_dir' => dirname(__FILE__) . '/_files/')); + ['lifetime' => 120, 'automatic_serialization' => true], + ['cache_dir' => dirname(__FILE__) . '/_files/']); $this->assertFalse(Zend_Translate_Adapter_Array::hasCache()); Zend_Translate_Adapter_Array::setCache($cache); @@ -315,8 +315,8 @@ public function testLoadingFilesIntoCacheAfterwards() { require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', - array('lifetime' => 120, 'automatic_serialization' => true), - array('cache_dir' => dirname(__FILE__) . '/_files/')); + ['lifetime' => 120, 'automatic_serialization' => true], + ['cache_dir' => dirname(__FILE__) . '/_files/']); $this->assertFalse(Zend_Translate_Adapter_Array::hasCache()); Zend_Translate_Adapter_Array::setCache($cache); @@ -326,7 +326,7 @@ public function testLoadingFilesIntoCacheAfterwards() $cache = Zend_Translate_Adapter_Array::getCache(); $this->assertTrue($cache instanceof Zend_Cache_Core); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en.php', 'ru', array('reload' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en.php', 'ru', ['reload' => true]); $test = $adapter->getMessages('all'); $this->assertEquals(6, count($test['ru'])); } diff --git a/tests/Zend/Translate/Adapter/CsvTest.php b/tests/Zend/Translate/Adapter/CsvTest.php index 5d81af27ab..b88d1604ac 100644 --- a/tests/Zend/Translate/Adapter/CsvTest.php +++ b/tests/Zend/Translate/Adapter/CsvTest.php @@ -65,7 +65,7 @@ public function testCreate() $this->assertContains('Error opening translation file', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/failed.csv', 'en'); restore_error_handler(); } @@ -112,7 +112,7 @@ public function testLoadTranslationData() $this->assertContains('does not exist', $e->getMessage()); } - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.csv', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.csv', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } @@ -120,8 +120,8 @@ public function testLoadTranslationData() public function testOptions() { $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_en.csv', 'en'); - $adapter->setOptions(array('testoption' => 'testkey')); - $expected = array( + $adapter->setOptions(['testoption' => 'testkey']); + $expected = [ 'delimiter' => ';', 'testoption' => 'testkey', 'clear' => false, @@ -136,7 +136,7 @@ public function testOptions() 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false, - ); + ]; $options = $adapter->getOptions(); foreach ($expected as $key => $value) { @@ -153,7 +153,7 @@ public function testClearing() $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_en.csv', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 60', $adapter->translate('Message 60')); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.csv', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.csv', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Message 4', $adapter->translate('Message 4')); } @@ -173,7 +173,7 @@ public function testLocale() $this->assertContains('does not exist', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter->setLocale('de'); restore_error_handler(); $this->assertEquals('de', $adapter->getLocale()); @@ -182,9 +182,9 @@ public function testLocale() public function testList() { $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_en.csv', 'en'); - $this->assertEquals(array('en' => 'en'), $adapter->getList()); + $this->assertEquals(['en' => 'en'], $adapter->getList()); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en.csv', 'de'); - $this->assertEquals(array('en' => 'en', 'de' => 'de'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'de' => 'de'], $adapter->getList()); $this->assertTrue($adapter->isAvailable('de')); $locale = new Zend_Locale('en'); $this->assertTrue($adapter->isAvailable($locale)); @@ -194,22 +194,22 @@ public function testList() public function testOptionLocaleDirectory() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/testcsv', 'de_AT', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('de_AT' => 'de_AT', 'en_GB' => 'en_GB'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/testcsv', 'de_AT', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['de_AT' => 'de_AT', 'en_GB' => 'en_GB'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } public function testOptionLocaleFilename() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/testcsv', 'de_DE', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('de_DE' => 'de_DE', 'en_US' => 'en_US'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/testcsv', 'de_DE', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['de_DE' => 'de_DE', 'en_US' => 'en_US'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } public function testOtherDelimiter() { - $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_otherdelimiter.csv', 'en', array('delimiter' => ',')); + $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_otherdelimiter.csv', 'en', ['delimiter' => ',']); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 4 (en)', $adapter->translate('Message 4,')); $this->assertEquals('Message 5, (en)', $adapter->translate('Message 5')); diff --git a/tests/Zend/Translate/Adapter/GettextTest.php b/tests/Zend/Translate/Adapter/GettextTest.php index 065be795e9..5f985a17ba 100644 --- a/tests/Zend/Translate/Adapter/GettextTest.php +++ b/tests/Zend/Translate/Adapter/GettextTest.php @@ -116,7 +116,7 @@ public function testLoadTranslationData() $this->assertContains('does not exist', $e->getMessage()); } - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.mo', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.mo', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } @@ -124,8 +124,8 @@ public function testLoadTranslationData() public function testOptions() { $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/translation_en.mo', 'en'); - $adapter->setOptions(array('testoption' => 'testkey')); - $expected = array( + $adapter->setOptions(['testoption' => 'testkey']); + $expected = [ 'testoption' => 'testkey', 'clear' => false, 'content' => dirname(__FILE__) . '/_files/translation_en.mo', @@ -137,7 +137,7 @@ public function testOptions() 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false, - ); + ]; $options = $adapter->getOptions(); foreach ($expected as $key => $value) { @@ -154,7 +154,7 @@ public function testClearing() $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/translation_en.mo', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 6', $adapter->translate('Message 6')); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.mo', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.mo', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Message 4', $adapter->translate('Message 4')); } @@ -174,7 +174,7 @@ public function testLocale() $this->assertContains('does not exist', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter->setLocale('de'); restore_error_handler(); $this->assertEquals('de', $adapter->getLocale()); @@ -183,9 +183,9 @@ public function testLocale() public function testList() { $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/translation_en.mo', 'en'); - $this->assertEquals(array('en' => 'en'), $adapter->getList()); + $this->assertEquals(['en' => 'en'], $adapter->getList()); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en.mo', 'de'); - $this->assertEquals(array('en' => 'en', 'de' => 'de'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'de' => 'de'], $adapter->getList()); $this->assertTrue($adapter->isAvailable('de')); $locale = new Zend_Locale('en'); $this->assertTrue($adapter->isAvailable($locale)); @@ -195,16 +195,16 @@ public function testList() public function testOptionLocaleDirectory() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/testmo/', 'de_AT', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('de_AT' => 'de_AT', 'en_GB' => 'en_GB'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/testmo/', 'de_AT', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['de_AT' => 'de_AT', 'en_GB' => 'en_GB'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } public function testOptionLocaleFilename() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/testmo/', 'de_DE', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('de_DE' => 'de_DE', 'en_US' => 'en_US'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Gettext(dirname(__FILE__) . '/_files/testmo/', 'de_DE', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['de_DE' => 'de_DE', 'en_US' => 'en_US'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } diff --git a/tests/Zend/Translate/Adapter/IniTest.php b/tests/Zend/Translate/Adapter/IniTest.php index dd546b08d2..3bb003cf29 100644 --- a/tests/Zend/Translate/Adapter/IniTest.php +++ b/tests/Zend/Translate/Adapter/IniTest.php @@ -58,7 +58,7 @@ public function testCreate() $this->assertContains('not found', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/failed.ini', 'en'); restore_error_handler(); } @@ -109,7 +109,7 @@ public function testLoadTranslationData() $this->assertContains('The given Language', $e->getMessage()); } - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.ini', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.ini', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message_1')); $this->assertEquals('Nachricht 8', $adapter->translate('Message_8')); } @@ -117,8 +117,8 @@ public function testLoadTranslationData() public function testOptions() { $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/translation_en.ini', 'en'); - $adapter->setOptions(array('testoption' => 'testkey')); - $expected = array( + $adapter->setOptions(['testoption' => 'testkey']); + $expected = [ 'testoption' => 'testkey', 'clear' => false, 'content' => dirname(__FILE__) . '/_files/translation_en.ini', @@ -130,7 +130,7 @@ public function testOptions() 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false, - ); + ]; $options = $adapter->getOptions(); foreach ($expected as $key => $value) { @@ -147,7 +147,7 @@ public function testClearing() $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/translation_en.ini', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message_1')); $this->assertEquals('Message_6', $adapter->translate('Message_6')); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.ini', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.ini', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message_1')); $this->assertEquals('Message_4', $adapter->translate('Message_4')); } @@ -167,7 +167,7 @@ public function testLocale() $this->assertContains('The given Language', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter->setLocale('de'); restore_error_handler(); $this->assertEquals('de', $adapter->getLocale()); @@ -176,9 +176,9 @@ public function testLocale() public function testList() { $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/translation_en.ini', 'en'); - $this->assertEquals(array('en' => 'en'), $adapter->getList()); + $this->assertEquals(['en' => 'en'], $adapter->getList()); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en.ini', 'de'); - $this->assertEquals(array('en' => 'en', 'de' => 'de'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'de' => 'de'], $adapter->getList()); $this->assertTrue($adapter->isAvailable('de')); $locale = new Zend_Locale('en'); $this->assertTrue($adapter->isAvailable($locale)); @@ -188,16 +188,16 @@ public function testList() public function testOptionLocaleDirectory() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/testini', 'de_AT', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('de_AT' => 'de_AT', 'en_GB' => 'en_GB'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/testini', 'de_AT', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['de_AT' => 'de_AT', 'en_GB' => 'en_GB'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message_8')); } public function testOptionLocaleFilename() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/testini', 'de_DE', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('de_DE' => 'de_DE', 'en_US' => 'en_US'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Ini(dirname(__FILE__) . '/_files/testini', 'de_DE', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['de_DE' => 'de_DE', 'en_US' => 'en_US'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message_8')); } diff --git a/tests/Zend/Translate/Adapter/QtTest.php b/tests/Zend/Translate/Adapter/QtTest.php index 679b4b253e..914da429c4 100644 --- a/tests/Zend/Translate/Adapter/QtTest.php +++ b/tests/Zend/Translate/Adapter/QtTest.php @@ -121,7 +121,7 @@ public function testLoadTranslationData() $this->assertContains('does not exist', $e->getMessage()); } - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.ts', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.ts', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } @@ -129,8 +129,8 @@ public function testLoadTranslationData() public function testOptions() { $adapter = new Zend_Translate_Adapter_Qt(dirname(__FILE__) . '/_files/translation_en.ts', 'en'); - $adapter->setOptions(array('testoption' => 'testkey')); - $expected = array( + $adapter->setOptions(['testoption' => 'testkey']); + $expected = [ 'testoption' => 'testkey', 'clear' => false, 'content' => dirname(__FILE__) . '/_files/translation_en.ts', @@ -142,7 +142,7 @@ public function testOptions() 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false - ); + ]; $options = $adapter->getOptions(); foreach ($expected as $key => $value) { @@ -159,7 +159,7 @@ public function testClearing() $adapter = new Zend_Translate_Adapter_Qt(dirname(__FILE__) . '/_files/translation_en.ts', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 6', $adapter->translate('Message 6')); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.ts', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.ts', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Message 4', $adapter->translate('Message 4')); } @@ -179,7 +179,7 @@ public function testLocale() $this->assertContains('does not exist', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter->setLocale('it'); restore_error_handler(); $this->assertEquals('it', $adapter->getLocale()); @@ -188,9 +188,9 @@ public function testLocale() public function testList() { $adapter = new Zend_Translate_Adapter_Qt(dirname(__FILE__) . '/_files/translation_en.ts', 'en'); - $this->assertEquals(array('en' => 'en'), $adapter->getList()); + $this->assertEquals(['en' => 'en'], $adapter->getList()); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.ts', 'de'); - $this->assertEquals(array('en' => 'en', 'de' => 'de'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'de' => 'de'], $adapter->getList()); $this->assertTrue($adapter->isAvailable('en')); $locale = new Zend_Locale('en'); $this->assertTrue($adapter->isAvailable($locale)); @@ -200,16 +200,16 @@ public function testList() public function testOptionLocaleDirectory() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Qt(dirname(__FILE__) . '/_files/testts', 'de_AT', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('de_AT' => 'de_AT', 'en_GB' => 'en_GB'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Qt(dirname(__FILE__) . '/_files/testts', 'de_AT', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['de_AT' => 'de_AT', 'en_GB' => 'en_GB'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } public function testOptionLocaleFilename() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Qt(dirname(__FILE__) . '/_files/testts', 'de_DE', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('de_DE' => 'de_DE', 'en_US' => 'en_US'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Qt(dirname(__FILE__) . '/_files/testts', 'de_DE', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['de_DE' => 'de_DE', 'en_US' => 'en_US'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } diff --git a/tests/Zend/Translate/Adapter/TbxTest.php b/tests/Zend/Translate/Adapter/TbxTest.php index 503670c512..ce31547155 100644 --- a/tests/Zend/Translate/Adapter/TbxTest.php +++ b/tests/Zend/Translate/Adapter/TbxTest.php @@ -120,7 +120,7 @@ public function testLoadTranslationData() $this->assertContains('does not exist', $e->getMessage()); } - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tbx', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tbx', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } @@ -128,8 +128,8 @@ public function testLoadTranslationData() public function testOptions() { $adapter = new Zend_Translate_Adapter_Tbx(dirname(__FILE__) . '/_files/translation_en.tbx', 'en'); - $adapter->setOptions(array('testoption' => 'testkey')); - $expected = array( + $adapter->setOptions(['testoption' => 'testkey']); + $expected = [ 'testoption' => 'testkey', 'clear' => false, 'content' => dirname(__FILE__) . '/_files/translation_en.tbx', @@ -141,7 +141,7 @@ public function testOptions() 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false, - ); + ]; $options = $adapter->getOptions(); foreach ($expected as $key => $value) { @@ -158,7 +158,7 @@ public function testClearing() $adapter = new Zend_Translate_Adapter_Tbx(dirname(__FILE__) . '/_files/translation_en.tbx', 'fr'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 4 (en)', $adapter->translate('Message 4')); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tbx', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tbx', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Message 4', $adapter->translate('Message 4')); } @@ -178,7 +178,7 @@ public function testLocale() $this->assertContains('does not exist', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter->setLocale('ru'); restore_error_handler(); $this->assertEquals('ru', $adapter->getLocale()); @@ -187,9 +187,9 @@ public function testLocale() public function testList() { $adapter = new Zend_Translate_Adapter_Tbx(dirname(__FILE__) . '/_files/translation_en.tbx', 'en'); - $this->assertEquals(array('en' => 'en', 'fr' => 'fr'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'fr' => 'fr'], $adapter->getList()); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tbx', 'de'); - $this->assertEquals(array('en' => 'en', 'de' => 'de', 'fr' => 'fr'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'de' => 'de', 'fr' => 'fr'], $adapter->getList()); $this->assertTrue($adapter->isAvailable('fr')); $locale = new Zend_Locale('en'); $this->assertTrue( $adapter->isAvailable($locale)); @@ -199,16 +199,16 @@ public function testList() public function testOptionLocaleDirectory() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Tbx(dirname(__FILE__) . '/_files/testtbx', 'de', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('en' => 'en', 'fr' => 'fr', 'de' => 'de'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Tbx(dirname(__FILE__) . '/_files/testtbx', 'de', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['en' => 'en', 'fr' => 'fr', 'de' => 'de'], $adapter->getList()); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); } public function testOptionLocaleFilename() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Tbx(dirname(__FILE__) . '/_files/testtbx', 'de', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('en' => 'en', 'fr' => 'fr', 'de' => 'de'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Tbx(dirname(__FILE__) . '/_files/testtbx', 'de', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['en' => 'en', 'fr' => 'fr', 'de' => 'de'], $adapter->getList()); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); } diff --git a/tests/Zend/Translate/Adapter/TmxTest.php b/tests/Zend/Translate/Adapter/TmxTest.php index 03995ccc46..76f51c299e 100644 --- a/tests/Zend/Translate/Adapter/TmxTest.php +++ b/tests/Zend/Translate/Adapter/TmxTest.php @@ -121,7 +121,7 @@ public function testLoadTranslationData() $this->assertContains('does not exist', $e->getMessage()); } - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tmx', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tmx', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } @@ -129,8 +129,8 @@ public function testLoadTranslationData() public function testOptions() { $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/translation_en.tmx', 'en'); - $adapter->setOptions(array('testoption' => 'testkey')); - $expected = array( + $adapter->setOptions(['testoption' => 'testkey']); + $expected = [ 'testoption' => 'testkey', 'clear' => false, 'content' => dirname(__FILE__) . '/_files/translation_en.tmx', @@ -142,7 +142,7 @@ public function testOptions() 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false - ); + ]; $options = $adapter->getOptions(); foreach ($expected as $key => $value) { @@ -159,7 +159,7 @@ public function testClearing() $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/translation_en.tmx', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 5 (en)', $adapter->translate('Message 5')); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tmx', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tmx', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Message 4', $adapter->translate('Message 4')); } @@ -179,7 +179,7 @@ public function testLocale() $this->assertContains('does not exist', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter->setLocale('it'); restore_error_handler(); $this->assertEquals('it', $adapter->getLocale()); @@ -188,9 +188,9 @@ public function testLocale() public function testList() { $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/translation_en.tmx', 'en'); - $this->assertEquals(array('en' => 'en', 'fr' => 'fr'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'fr' => 'fr'], $adapter->getList()); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.tmx', 'fr'); - $this->assertEquals(array('en' => 'en', 'de' => 'de', 'fr' => 'fr'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'de' => 'de', 'fr' => 'fr'], $adapter->getList()); $this->assertTrue($adapter->isAvailable('fr')); $locale = new Zend_Locale('en'); $this->assertTrue($adapter->isAvailable($locale)); @@ -200,16 +200,16 @@ public function testList() public function testOptionLocaleDirectory() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/testtmx', 'de', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('de' => 'de', 'en' => 'en', 'fr' => 'fr'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/testtmx', 'de', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['de' => 'de', 'en' => 'en', 'fr' => 'fr'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } public function testOptionLocaleFilename() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/testtmx', 'de', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('de' => 'de', 'en' => 'en', 'fr' => 'fr'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/testtmx', 'de', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['de' => 'de', 'en' => 'en', 'fr' => 'fr'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } @@ -241,7 +241,7 @@ public function testWithoutEncoding() */ public function testTranslate_ZF8375() { - $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/translation_en_8375.tmx', 'en', array('disableNotices' => true)); + $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/translation_en_8375.tmx', 'en', ['disableNotices' => true]); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 1 (en)', $adapter->_('Message 1')); $this->assertEquals('Message 6', $adapter->translate('Message 6')); @@ -253,7 +253,7 @@ public function testTranslate_ZF8375() public function testUseId() { - $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/translation_en2.tmx', 'en', array('useId' => false)); + $adapter = new Zend_Translate_Adapter_Tmx(dirname(__FILE__) . '/_files/translation_en2.tmx', 'en', ['useId' => false]); $this->assertEquals(false, $adapter->getOptions('useId')); $this->assertEquals('Message 1 (en)', $adapter->translate('Nachricht 1')); $this->assertEquals('Message 1 (en)', $adapter->_('Nachricht 1')); diff --git a/tests/Zend/Translate/Adapter/XliffTest.php b/tests/Zend/Translate/Adapter/XliffTest.php index 5c2e16f25e..6d679c2da2 100644 --- a/tests/Zend/Translate/Adapter/XliffTest.php +++ b/tests/Zend/Translate/Adapter/XliffTest.php @@ -121,7 +121,7 @@ public function testLoadTranslationData() $this->assertContains('does not exist', $e->getMessage()); } - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xliff', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xliff', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Message 4', $adapter->translate('Message 4')); } @@ -129,8 +129,8 @@ public function testLoadTranslationData() public function testOptions() { $adapter = new Zend_Translate_Adapter_Xliff(dirname(__FILE__) . '/_files/translation_en.xliff', 'en'); - $adapter->setOptions(array('testoption' => 'testkey')); - $expected = array( + $adapter->setOptions(['testoption' => 'testkey']); + $expected = [ 'testoption' => 'testkey', 'clear' => false, 'content' => dirname(__FILE__) . '/_files/translation_en.xliff', @@ -142,7 +142,7 @@ public function testOptions() 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false, - ); + ]; $options = $adapter->getOptions(); foreach ($expected as $key => $value) { @@ -159,7 +159,7 @@ public function testClearing() $adapter = new Zend_Translate_Adapter_Xliff(dirname(__FILE__) . '/_files/translation_en.xliff', 'fr'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 6', $adapter->translate('Message 6')); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xliff', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xliff', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Message 5', $adapter->translate('Message 5')); } @@ -179,7 +179,7 @@ public function testLocale() $this->assertContains('does not exist', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter->setLocale('it'); restore_error_handler(); $this->assertEquals('it', $adapter->getLocale()); @@ -188,9 +188,9 @@ public function testLocale() public function testList() { $adapter = new Zend_Translate_Adapter_Xliff(dirname(__FILE__) . '/_files/translation_en.xliff', 'en'); - $this->assertEquals(array('en' => 'en', 'fr' => 'fr'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'fr' => 'fr'], $adapter->getList()); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xliff', 'de'); - $this->assertEquals(array('en' => 'en', 'de' => 'de', 'fr' => 'fr'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'de' => 'de', 'fr' => 'fr'], $adapter->getList()); $this->assertTrue($adapter->isAvailable('de')); $locale = new Zend_Locale('en'); $this->assertTrue($adapter->isAvailable($locale)); @@ -200,22 +200,22 @@ public function testList() public function testOptionLocaleDirectory() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Xliff(dirname(__FILE__) . '/_files/testxliff', 'de', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('de' => 'de', 'en' => 'en', 'fr' => 'fr'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Xliff(dirname(__FILE__) . '/_files/testxliff', 'de', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['de' => 'de', 'en' => 'en', 'fr' => 'fr'], $adapter->getList()); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); } public function testOptionLocaleFilename() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_Xliff(dirname(__FILE__) . '/_files/testxliff', 'de', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('de' => 'de', 'en' => 'en', 'fr' => 'fr'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_Xliff(dirname(__FILE__) . '/_files/testxliff', 'de', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['de' => 'de', 'en' => 'en', 'fr' => 'fr'], $adapter->getList()); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); } public function testIsoEncoding() { - $adapter = new Zend_Translate_Adapter_Xliff(dirname(__FILE__) . '/_files/translation_en3.xliff', 'en', array('useId' => false)); + $adapter = new Zend_Translate_Adapter_Xliff(dirname(__FILE__) . '/_files/translation_en3.xliff', 'en', ['useId' => false]); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 1 (en)', $adapter->_('Message 1')); diff --git a/tests/Zend/Translate/Adapter/XmlTmTest.php b/tests/Zend/Translate/Adapter/XmlTmTest.php index 2015ed19d2..937ea9e3c7 100644 --- a/tests/Zend/Translate/Adapter/XmlTmTest.php +++ b/tests/Zend/Translate/Adapter/XmlTmTest.php @@ -121,7 +121,7 @@ public function testLoadTranslationData() $this->assertContains('does not exist', $e->getMessage()); } - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xmltm', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xmltm', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); } @@ -129,8 +129,8 @@ public function testLoadTranslationData() public function testOptions() { $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/translation_en.xmltm', 'en'); - $adapter->setOptions(array('testoption' => 'testkey')); - $expected = array( + $adapter->setOptions(['testoption' => 'testkey']); + $expected = [ 'testoption' => 'testkey', 'clear' => false, 'content' => dirname(__FILE__) . '/_files/translation_en.xmltm', @@ -142,7 +142,7 @@ public function testOptions() 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false, - ); + ]; $options = $adapter->getOptions(); foreach ($expected as $key => $value) { @@ -159,7 +159,7 @@ public function testClearing() $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/translation_en.xmltm', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 5 (en)', $adapter->translate('Message 5')); - $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xmltm', 'de', array('clear' => true)); + $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xmltm', 'de', ['clear' => true]); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); $this->assertEquals('Message 5', $adapter->translate('Message 5')); } @@ -179,7 +179,7 @@ public function testLocale() $this->assertContains('does not exist', $e->getMessage()); } - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $adapter->setLocale('ar'); restore_error_handler(); $this->assertEquals('ar', $adapter->getLocale()); @@ -188,9 +188,9 @@ public function testLocale() public function testList() { $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/translation_en.xmltm', 'en'); - $this->assertEquals(array('en' => 'en'), $adapter->getList()); + $this->assertEquals(['en' => 'en'], $adapter->getList()); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en2.xmltm', 'de'); - $this->assertEquals(array('en' => 'en', 'de' => 'de'), $adapter->getList()); + $this->assertEquals(['en' => 'en', 'de' => 'de'], $adapter->getList()); $this->assertFalse($adapter->isAvailable('fr')); $locale = new Zend_Locale('en'); $this->assertTrue($adapter->isAvailable($locale)); @@ -200,16 +200,16 @@ public function testList() public function testOptionLocaleDirectory() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/testxmltm', 'de_AT', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('de_AT' => 'de_AT', 'en_GB' => 'en_GB'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/testxmltm', 'de_AT', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['de_AT' => 'de_AT', 'en_GB' => 'en_GB'], $adapter->getList()); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); } public function testOptionLocaleFilename() { require_once 'Zend/Translate.php'; - $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/testxmltm', 'de_DE', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('de_DE' => 'de_DE', 'en_US' => 'en_US'), $adapter->getList()); + $adapter = new Zend_Translate_Adapter_XmlTm(dirname(__FILE__) . '/_files/testxmltm', 'de_DE', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['de_DE' => 'de_DE', 'en_US' => 'en_US'], $adapter->getList()); $this->assertEquals('Nachricht 1', $adapter->translate('Message 1')); } diff --git a/tests/Zend/Translate/Adapter/_files/testarray/de_AT/LC_TEST/translation-de_DE.php b/tests/Zend/Translate/Adapter/_files/testarray/de_AT/LC_TEST/translation-de_DE.php index 1fee016287..56f5458434 100644 --- a/tests/Zend/Translate/Adapter/_files/testarray/de_AT/LC_TEST/translation-de_DE.php +++ b/tests/Zend/Translate/Adapter/_files/testarray/de_AT/LC_TEST/translation-de_DE.php @@ -20,7 +20,7 @@ * @version $Id$ */ -return array( +return [ 'Message 1' => 'Nachricht 1', 'Message 8' => 'Nachricht 8' -); +]; diff --git a/tests/Zend/Translate/Adapter/_files/testarray/en_GB/LC_OTHER/translation-en_US.php b/tests/Zend/Translate/Adapter/_files/testarray/en_GB/LC_OTHER/translation-en_US.php index db9a038b64..b9779ef8ce 100644 --- a/tests/Zend/Translate/Adapter/_files/testarray/en_GB/LC_OTHER/translation-en_US.php +++ b/tests/Zend/Translate/Adapter/_files/testarray/en_GB/LC_OTHER/translation-en_US.php @@ -20,11 +20,11 @@ * @version $Id$ */ -return array( +return [ 'Message 1' => 'Message 1 (en)', 'Message 2' => 'Message 2 (en)', 'Message 3' => 'Message 3 (en)', 'Message 4' => 'Message 4 (en)', 'Cooking furniture' => 'Küchen Möbel (en)', 'Küchen Möbel' => 'Cooking furniture (en)' -); +]; diff --git a/tests/Zend/Translate/Adapter/_files/testarray/ja/translation-ja.php b/tests/Zend/Translate/Adapter/_files/testarray/ja/translation-ja.php index 75101573f0..d1f047f79c 100644 --- a/tests/Zend/Translate/Adapter/_files/testarray/ja/translation-ja.php +++ b/tests/Zend/Translate/Adapter/_files/testarray/ja/translation-ja.php @@ -20,11 +20,11 @@ * @version $Id: translation-en_US.php 17573 2009-08-13 18:01:41Z alexander $ */ -return array( +return [ 'Message 1' => 'Message 1 (ja)', 'Message 2' => 'Message 2 (ja)', 'Message 3' => 'Message 3 (ja)', 'Message 4' => 'Message 4 (ja)', 'Cooking furniture' => 'Küchen Möbel (ja)', 'Küchen Möbel' => 'Cooking furniture (ja)' -); +]; diff --git a/tests/Zend/Translate/Adapter/_files/translation_empty.php b/tests/Zend/Translate/Adapter/_files/translation_empty.php index 09cf2c4a94..2cb7aee25b 100644 --- a/tests/Zend/Translate/Adapter/_files/translation_empty.php +++ b/tests/Zend/Translate/Adapter/_files/translation_empty.php @@ -20,4 +20,4 @@ * @version $Id$ */ -return array(); +return []; diff --git a/tests/Zend/Translate/Adapter/_files/translation_en.php b/tests/Zend/Translate/Adapter/_files/translation_en.php index db9a038b64..b9779ef8ce 100644 --- a/tests/Zend/Translate/Adapter/_files/translation_en.php +++ b/tests/Zend/Translate/Adapter/_files/translation_en.php @@ -20,11 +20,11 @@ * @version $Id$ */ -return array( +return [ 'Message 1' => 'Message 1 (en)', 'Message 2' => 'Message 2 (en)', 'Message 3' => 'Message 3 (en)', 'Message 4' => 'Message 4 (en)', 'Cooking furniture' => 'Küchen Möbel (en)', 'Küchen Möbel' => 'Cooking furniture (en)' -); +]; diff --git a/tests/Zend/Translate/Adapter/_files/translation_en2.php b/tests/Zend/Translate/Adapter/_files/translation_en2.php index 1fee016287..56f5458434 100644 --- a/tests/Zend/Translate/Adapter/_files/translation_en2.php +++ b/tests/Zend/Translate/Adapter/_files/translation_en2.php @@ -20,7 +20,7 @@ * @version $Id$ */ -return array( +return [ 'Message 1' => 'Nachricht 1', 'Message 8' => 'Nachricht 8' -); +]; diff --git a/tests/Zend/TranslateTest.php b/tests/Zend/TranslateTest.php index 3145042ea1..cb6c65cadf 100644 --- a/tests/Zend/TranslateTest.php +++ b/tests/Zend/TranslateTest.php @@ -65,26 +65,26 @@ public function setUp() public function testCreate() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('1' => '1')); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['1' => '1']); $this->assertTrue($lang instanceof Zend_Translate); } public function testLocaleInitialization() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'message1'), 'en'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'message1'], 'en'); $this->assertEquals('en', $lang->getLocale()); } public function testDefaultLocale() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'message1')); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'message1']); $defaultLocale = new Zend_Locale(); $this->assertEquals($defaultLocale->toString(), $lang->getLocale()); } public function testGetAdapter() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY , array('1' => '1'), 'en'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY , ['1' => '1'], 'en'); $this->assertTrue($lang->getAdapter() instanceof Zend_Translate_Adapter_Array); $lang = new Zend_Translate(Zend_Translate::AN_GETTEXT , dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.mo', 'en'); @@ -112,7 +112,7 @@ public function testGetAdapter() public function testSetAdapter() { $lang = new Zend_Translate(Zend_Translate::AN_GETTEXT , dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.mo', 'en'); - $lang->setAdapter(Zend_Translate::AN_ARRAY, array('de' => 'de')); + $lang->setAdapter(Zend_Translate::AN_ARRAY, ['de' => 'de']); $this->assertTrue($lang->getAdapter() instanceof Zend_Translate_Adapter_Array); try { @@ -125,29 +125,29 @@ public function testSetAdapter() public function testAddTranslation() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); $this->assertEquals('msg2', $lang->_('msg2')); - $lang->addTranslation(array('msg2' => 'Message 2'), 'en'); + $lang->addTranslation(['msg2' => 'Message 2'], 'en'); $this->assertEquals('Message 2', $lang->_('msg2')); $this->assertEquals('msg3', $lang->_('msg3')); - $lang->addTranslation(array('msg3' => 'Message 3'), 'en', array('clear' => true)); + $lang->addTranslation(['msg3' => 'Message 3'], 'en', ['clear' => true]); $this->assertEquals('msg2', $lang->_('msg2')); $this->assertEquals('Message 3', $lang->_('msg3')); } public function testGetLocale() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); $this->assertEquals('en', $lang->getLocale()); } public function testSetLocale() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'ru'); $this->assertEquals('ru', $lang->getLocale()); $lang->setLocale('en'); @@ -162,8 +162,8 @@ public function testSetLocale() public function testSetLanguage() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'ru'); $this->assertEquals('ru', $lang->getLocale()); $lang->setLocale('en'); @@ -172,8 +172,8 @@ public function testSetLanguage() public function testGetLanguageList() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'ru'); $this->assertEquals(2, count($lang->getList())); $this->assertTrue(in_array('en', $lang->getList())); $this->assertTrue(in_array('ru', $lang->getList())); @@ -181,8 +181,8 @@ public function testGetLanguageList() public function testIsAvailable() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'ru'); $this->assertTrue( $lang->isAvailable('en')); $this->assertTrue( $lang->isAvailable('ru')); $this->assertFalse($lang->isAvailable('fr')); @@ -190,8 +190,8 @@ public function testIsAvailable() public function testTranslate() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1 (en)'), 'en'); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1 (en)'], 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'ru'); $this->assertEquals('Message 1 (en)', $lang->_('msg1', 'en' )); $this->assertEquals('Message 1 (ru)', $lang->_('msg1' )); $this->assertEquals('msg2', $lang->_('msg2', 'en' )); @@ -204,7 +204,7 @@ public function testTranslate() public function testIsTranslated() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1 (en)'), 'en_US'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1 (en)'], 'en_US'); $this->assertTrue( $lang->isTranslated('msg1' )); $this->assertFalse($lang->isTranslated('msg2' )); $this->assertFalse($lang->isTranslated('msg1', false, 'en')); @@ -214,7 +214,7 @@ public function testIsTranslated() public function testWithOption() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV , dirname(__FILE__) . '/Translate/Adapter/_files/translation_otherdelimiter.csv', 'en', array('delimiter' => ',')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV , dirname(__FILE__) . '/Translate/Adapter/_files/translation_otherdelimiter.csv', 'en', ['delimiter' => ',']); $this->assertEquals('Message 1 (en)', $lang->translate('Message 1')); $this->assertEquals('Message 4 (en)', $lang->translate('Message 4,')); $this->assertEquals('Message 5, (en)', $lang->translate('Message 5')); @@ -222,15 +222,15 @@ public function testWithOption() public function testDirectorySearch() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files/testcsv', 'de_AT', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); - $this->assertEquals(array('de_AT' => 'de_AT', 'en_GB' => 'en_GB'), $lang->getList()); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files/testcsv', 'de_AT', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); + $this->assertEquals(['de_AT' => 'de_AT', 'en_GB' => 'en_GB'], $lang->getList()); $this->assertEquals('Nachricht 8', $lang->translate('Message 8')); } public function testFileSearch() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files/testcsv', 'de_DE', array('scan' => Zend_Translate::LOCALE_FILENAME)); - $this->assertEquals(array('de_DE' => 'de_DE', 'en_US' => 'en_US'), $lang->getList()); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files/testcsv', 'de_DE', ['scan' => Zend_Translate::LOCALE_FILENAME]); + $this->assertEquals(['de_DE' => 'de_DE', 'en_US' => 'en_US'], $lang->getList()); $this->assertEquals('Nachricht 8', $lang->translate('Message 8')); } @@ -238,15 +238,15 @@ public function testTestingCacheHandling() { require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', - array('lifetime' => 120, 'automatic_serialization' => true), - array('cache_dir' => dirname(__FILE__) . '/_files/')); + ['lifetime' => 120, 'automatic_serialization' => true], + ['cache_dir' => dirname(__FILE__) . '/_files/']); Zend_Translate::setCache($cache); $cache = Zend_Translate::getCache(); $this->assertTrue($cache instanceof Zend_Cache_Core); $this->assertTrue(Zend_Translate::hasCache()); - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1 (en)'), 'en'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1 (en)'], 'en'); $adapter = $lang->getAdapter(); $this->assertTrue($adapter instanceof Zend_Translate_Adapter_Array); $adaptercache = $adapter->getCache(); @@ -261,7 +261,7 @@ public function testTestingCacheHandling() public function testExceptionWhenNoAdapterClassWasSet() { try { - $lang = new Zend_Translate('Zend_Locale', dirname(__FILE__) . '/Translate/_files/test2', null, array('scan' => Zend_Translate::LOCALE_FILENAME)); + $lang = new Zend_Translate('Zend_Locale', dirname(__FILE__) . '/Translate/_files/test2', null, ['scan' => Zend_Translate::LOCALE_FILENAME]); $this->fail('Exception due to false adapter class expected'); } catch (Zend_Translate_Exception $e) { $this->assertContains('does not extend Zend_Translate_Adapter', $e->getMessage()); @@ -275,7 +275,7 @@ public function testZF3679() require_once 'Zend/Registry.php'; Zend_Registry::set('Zend_Locale', $locale); - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'message1'), 'de_AT'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'message1'], 'de_AT'); $this->assertEquals('de_AT', $lang->getLocale()); Zend_Registry::_unsetInstance(); } @@ -285,8 +285,8 @@ public function testZF3679() */ public function testCamelCasedOptions() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files/translation_otherdelimiter.csv', 'en', array('delimiter' => ',')); - $lang->setOptions(array('myOption' => true)); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files/translation_otherdelimiter.csv', 'en', ['delimiter' => ',']); + $lang->setOptions(['myOption' => true]); $this->assertTrue($lang->getOptions('myOption')); } @@ -295,18 +295,18 @@ public function testCamelCasedOptions() */ public function testPathNameWithColonResolution() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/../Adapter/_files', 'en', array('delimiter' => ',')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/../Adapter/_files', 'en', ['delimiter' => ',']); $this->assertEquals('en', $lang->getLocale()); } public function testUntranslatedMessageWithTriggeredError() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', array('delimiter' => ',')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', ['delimiter' => ',']); $this->assertEquals('ignored', $lang->translate('ignored')); $this->_errorOccured = false; - $lang->setOptions(array('logUntranslated' => true)); - set_error_handler(array($this, 'errorHandlerIgnore')); + $lang->setOptions(['logUntranslated' => true]); + set_error_handler([$this, 'errorHandlerIgnore']); $this->assertEquals('ignored', $lang->translate('ignored')); $this->assertTrue($this->_errorOccured); restore_error_handler(); @@ -314,7 +314,7 @@ public function testUntranslatedMessageWithTriggeredError() public function testLogUntranslatedMessage() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', array('delimiter' => ',')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', ['delimiter' => ',']); $this->assertEquals('ignored', $lang->translate('ignored')); $stream = fopen('php://memory', 'w+'); @@ -323,7 +323,7 @@ public function testLogUntranslatedMessage() require_once 'Zend/Log.php'; $log = new Zend_Log($writer); - $lang->setOptions(array('logUntranslated' => true, 'log' => $log)); + $lang->setOptions(['logUntranslated' => true, 'log' => $log]); $this->assertEquals('ignored', $lang->translate('ignored')); rewind($stream); @@ -332,9 +332,9 @@ public function testLogUntranslatedMessage() public function testSettingUnknownLocaleWithTriggeredError() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', array('delimiter' => ',')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', ['delimiter' => ',']); $this->_errorOccured = false; - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $lang->setLocale('ru'); $this->assertEquals('ru', $lang->getLocale('ru')); $this->assertTrue($this->_errorOccured); @@ -343,7 +343,7 @@ public function testSettingUnknownLocaleWithTriggeredError() public function testSettingUnknownLocaleWritingToLog() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', array('delimiter' => ',')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', ['delimiter' => ',']); $stream = fopen('php://memory', 'w+'); require_once 'Zend/Log/Writer/Stream.php'; @@ -351,7 +351,7 @@ public function testSettingUnknownLocaleWritingToLog() require_once 'Zend/Log.php'; $log = new Zend_Log($writer); - $lang->setOptions(array('log' => $log)); + $lang->setOptions(['log' => $log]); $lang->setLocale('ru'); rewind($stream); @@ -360,10 +360,10 @@ public function testSettingUnknownLocaleWritingToLog() public function testSettingNoLogAsLog() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', array('delimiter' => ',')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', ['delimiter' => ',']); try { - $lang->setOptions(array('log' => 'nolog')); + $lang->setOptions(['log' => 'nolog']); $this->fail(); } catch (Zend_Translate_Exception $e) { $this->assertContains('Instance of Zend_Log expected', $e->getMessage()); @@ -372,7 +372,7 @@ public function testSettingNoLogAsLog() public function testSettingUnknownLocaleWritingToSelfDefinedLog() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', array('delimiter' => ',')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', ['delimiter' => ',']); $this->assertEquals('ignored', $lang->translate('ignored')); $stream = fopen('php://memory', 'w+'); @@ -381,7 +381,7 @@ public function testSettingUnknownLocaleWritingToSelfDefinedLog() require_once 'Zend/Log.php'; $log = new Zend_Log($writer); - $lang->setOptions(array('logUntranslated' => true, 'log' => $log, 'logMessage' => 'Self defined log message')); + $lang->setOptions(['logUntranslated' => true, 'log' => $log, 'logMessage' => 'Self defined log message']); $this->assertEquals('ignored', $lang->translate('ignored')); rewind($stream); @@ -395,16 +395,16 @@ public function testGetOptionsFromCache() { require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', - array('lifetime' => 120, 'automatic_serialization' => true), - array('cache_dir' => dirname(__FILE__) . '/_files/')); + ['lifetime' => 120, 'automatic_serialization' => true], + ['cache_dir' => dirname(__FILE__) . '/_files/']); Zend_Translate::setCache($cache); - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', array('delimiter' => ',')); - $lang->setOptions(array('logMessage' => 'test')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', ['delimiter' => ',']); + $lang->setOptions(['logMessage' => 'test']); $this->assertEquals('test', $lang->getOptions('logMessage')); unset($lang); - $lang2 = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', array('delimiter' => ',')); + $lang2 = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', ['delimiter' => ',']); $this->assertEquals('test', $lang2->getOptions('logMessage')); } @@ -413,11 +413,11 @@ public function testGetOptionsFromCache() */ public function testSetLocaleAsOption() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru'); - $lang->setOptions(array('locale' => 'ru')); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'ru'); + $lang->setOptions(['locale' => 'ru']); $this->assertEquals('ru', $lang->getLocale()); - $lang->setOptions(array('locale' => 'en')); + $lang->setOptions(['locale' => 'en']); $this->assertEquals('en', $lang->getLocale()); } @@ -426,7 +426,7 @@ public function testSetLocaleAsOption() */ public function testGettingAllOptions() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); $this->assertTrue(is_array($lang->getOptions())); } @@ -435,7 +435,7 @@ public function testGettingAllOptions() */ public function testGettingUnknownOption() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); $this->assertEquals(null, $lang->getOptions('unknown')); } @@ -444,10 +444,10 @@ public function testGettingUnknownOption() */ public function testGettingAllMessageIds() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1', 'msg2' => 'Message 2'), 'en'); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru'); - $this->assertEquals(array('msg1'), $lang->getMessageIds()); - $this->assertEquals(array('msg1', 'msg2'), $lang->getMessageIds('en')); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1', 'msg2' => 'Message 2'], 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'ru'); + $this->assertEquals(['msg1'], $lang->getMessageIds()); + $this->assertEquals(['msg1', 'msg2'], $lang->getMessageIds('en')); } /** @@ -455,8 +455,8 @@ public function testGettingAllMessageIds() */ public function testGettingSingleMessageIds() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1', 'msg2' => 'Message 2'), 'en'); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1', 'msg2' => 'Message 2'], 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'ru'); $this->assertEquals('msg1', $lang->getMessageId('Message 1 (ru)')); $this->assertEquals('msg2', $lang->getMessageId('Message 2', 'en')); $this->assertFalse($lang->getMessageId('Message 5')); @@ -467,16 +467,16 @@ public function testGettingSingleMessageIds() */ public function testGettingAllMessages() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1', 'msg2' => 'Message 2'), 'en'); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'ru'); - $this->assertEquals(array('msg1' => 'Message 1 (ru)'), $lang->getMessages()); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1', 'msg2' => 'Message 2'], 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'ru'); + $this->assertEquals(['msg1' => 'Message 1 (ru)'], $lang->getMessages()); $this->assertEquals( - array('msg1' => 'Message 1', 'msg2' => 'Message 2'), + ['msg1' => 'Message 1', 'msg2' => 'Message 2'], $lang->getMessages('en')); $this->assertEquals( - array( - 'en' => array('msg1' => 'Message 1', 'msg2' => 'Message 2'), - 'ru' => array('msg1' => 'Message 1 (ru)')), + [ + 'en' => ['msg1' => 'Message 1', 'msg2' => 'Message 2'], + 'ru' => ['msg1' => 'Message 1 (ru)']], $lang->getMessages('all')); } @@ -487,16 +487,16 @@ public function testGettingPlurals() { $lang = new Zend_Translate( Zend_Translate::AN_ARRAY, - array('singular' => - array('plural_0 (en)', + ['singular' => + ['plural_0 (en)', 'plural_1 (en)', 'plural_2 (en)', - 'plural_3 (en)'), - 'plural' => ''), 'en' + 'plural_3 (en)'], + 'plural' => ''], 'en' ); - $this->assertEquals('plural_0 (en)', $lang->translate(array('singular', 'plural', 1))); - $this->assertEquals('plural_1 (en)', $lang->translate(array('singular', 'plural', 2))); + $this->assertEquals('plural_0 (en)', $lang->translate(['singular', 'plural', 1])); + $this->assertEquals('plural_1 (en)', $lang->translate(['singular', 'plural', 2])); $this->assertEquals('plural_0 (en)', $lang->plural('singular', 'plural', 1)); $this->assertEquals('plural_1 (en)', $lang->plural('singular', 'plural', 2)); @@ -509,17 +509,17 @@ public function testGettingPluralsFromLoweredLocale() { $lang = new Zend_Translate( Zend_Translate::AN_ARRAY, - array('singular' => - array('plural_0 (en)', + ['singular' => + ['plural_0 (en)', 'plural_1 (en)', 'plural_2 (en)', - 'plural_3 (en)'), - 'plural' => ''), 'en' + 'plural_3 (en)'], + 'plural' => ''], 'en' ); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'en_US'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'en_US'); $lang->setLocale('en_US'); - $this->assertEquals('plural_0 (en)', $lang->translate(array('singular', 'plural', 1))); + $this->assertEquals('plural_0 (en)', $lang->translate(['singular', 'plural', 1])); $this->assertEquals('plural_0 (en)', $lang->plural('singular', 'plural', 1)); } @@ -530,17 +530,17 @@ public function testGettingPluralsFromUnknownLocale() { $lang = new Zend_Translate( Zend_Translate::AN_ARRAY, - array('singular' => - array('plural_0 (en)', + ['singular' => + ['plural_0 (en)', 'plural_1 (en)', 'plural_2 (en)', - 'plural_3 (en)'), - 'plural' => ''), 'en' + 'plural_3 (en)'], + 'plural' => ''], 'en' ); - $this->assertEquals('singular', $lang->translate(array('singular', 'plural', 1), 'ru')); + $this->assertEquals('singular', $lang->translate(['singular', 'plural', 1], 'ru')); $this->assertEquals('singular', $lang->plural('singular', 'plural', 1, 'ru')); - $this->assertEquals('plural', $lang->translate(array('singular', 'plural', 'plural2', 2, 'en'), 'ru')); + $this->assertEquals('plural', $lang->translate(['singular', 'plural', 'plural2', 2, 'en'], 'ru')); $this->assertEquals('plural', $lang->plural('singular', 'plural', 2, 'ru')); } @@ -548,9 +548,9 @@ public function testPluralsWithGettext() { $lang = new Zend_Translate(Zend_Translate::AN_GETTEXT , dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.mo', 'en'); - $this->assertEquals('Message 5 (en) Plural 0', $lang->translate(array('Message 5', 'Message 5 Plural', 1))); + $this->assertEquals('Message 5 (en) Plural 0', $lang->translate(['Message 5', 'Message 5 Plural', 1])); $this->assertEquals('Message 5 (en) Plural 0', $lang->plural('Message 5', 'Message 5 Plural', 1)); - $this->assertEquals('Message 5 (en) Plural 1', $lang->translate(array('Message 5', 'Message 5 Plural', 2))); + $this->assertEquals('Message 5 (en) Plural 1', $lang->translate(['Message 5', 'Message 5 Plural', 2])); $this->assertEquals('Message 5 (en) Plural 1', $lang->plural('Message 5', 'Message 5 Plural', 2)); } @@ -558,9 +558,9 @@ public function testPluralsWithCsv() { $lang = new Zend_Translate(Zend_Translate::AN_CSV , dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.csv', 'en'); - $this->assertEquals('Message 6 (en) Plural 0', $lang->translate(array('Message 6', 'Message 6 Plural1', 1))); + $this->assertEquals('Message 6 (en) Plural 0', $lang->translate(['Message 6', 'Message 6 Plural1', 1])); $this->assertEquals('Message 6 (en) Plural 0', $lang->plural('Message 6', 'Message 6 Plural1', 1)); - $this->assertEquals('Message 6 (en) Plural 1', $lang->translate(array('Message 6', 'Message 6 Plural1', 2))); + $this->assertEquals('Message 6 (en) Plural 1', $lang->translate(['Message 6', 'Message 6 Plural1', 2])); $this->assertEquals('Message 6 (en) Plural 1', $lang->plural('Message 6', 'Message 6 Plural1', 2)); } @@ -569,10 +569,10 @@ public function testPluralsWithCsv() */ public function testAddTranslationAfterwards() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'Message 1'], 'en'); $this->assertEquals('Message 1', $lang->_('msg1')); - $lang->addTranslation(array('msg1' => 'Message 1 (en)'), 'en'); + $lang->addTranslation(['msg1' => 'Message 1 (en)'], 'en'); $this->assertEquals('Message 1 (en)', $lang->_('msg1')); } @@ -581,11 +581,11 @@ public function testAddTranslationAfterwards() */ public function testUseNumericTranslations() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array(0 => 'Message 1', 2 => 'Message 2'), 'en'); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, [0 => 'Message 1', 2 => 'Message 2'], 'en'); $this->assertEquals('Message 1', $lang->_(0)); $this->assertEquals('Message 2', $lang->_(2)); - $lang->addTranslation(array(4 => 'Message 4'), 'en'); + $lang->addTranslation([4 => 'Message 4'], 'en'); $this->assertEquals('Message 4', $lang->_(4)); } @@ -594,7 +594,7 @@ public function testUseNumericTranslations() */ public function testDontLogUntranslatedMessageWithIsTranslated() { - $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', array('delimiter' => ',')); + $lang = new Zend_Translate(Zend_Translate::AN_CSV, dirname(__FILE__) . '/Translate/Adapter/_files', 'en', ['delimiter' => ',']); $this->assertFalse($lang->isTranslated('ignored')); $stream = fopen('php://memory', 'w+'); @@ -603,7 +603,7 @@ public function testDontLogUntranslatedMessageWithIsTranslated() require_once 'Zend/Log.php'; $log = new Zend_Log($writer); - $lang->setOptions(array('logUntranslated' => true, 'log' => $log)); + $lang->setOptions(['logUntranslated' => true, 'log' => $log]); $this->assertFalse($lang->isTranslated('ignored')); rewind($stream); @@ -615,7 +615,7 @@ public function testDontLogUntranslatedMessageWithIsTranslated() */ public function testMultiFolderScan() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, dirname(__FILE__) . '/Translate/Adapter/_files/testarray', 'en_GB', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, dirname(__FILE__) . '/Translate/Adapter/_files/testarray', 'en_GB', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); $this->assertEquals('Message 1 (ja)', $lang->_('Message 1', 'ja' )); $this->assertEquals('Message 1 (en)', $lang->_('Message 1' )); } @@ -625,9 +625,9 @@ public function testMultiFolderScan() */ public function testMultiClear() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, dirname(__FILE__) . '/Translate/Adapter/_files/testarray', 'en_GB', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, dirname(__FILE__) . '/Translate/Adapter/_files/testarray', 'en_GB', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); $this->assertEquals('Message 1 (ja)', $lang->_('Message 1', 'ja')); - $lang->addTranslation(dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.php', 'ja', array('clear')); + $lang->addTranslation(dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.php', 'ja', ['clear']); $this->assertEquals('Message 1 (en)', $lang->_('Message 1', 'ja')); } @@ -636,7 +636,7 @@ public function testMultiClear() */ public function testEmptyTranslation() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, null, null, array('disableNotices' => true)); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, null, null, ['disableNotices' => true]); $this->assertEquals(0, count($lang->getList())); } @@ -645,7 +645,7 @@ public function testEmptyTranslation() */ public function testObjectTranslation() { - $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, dirname(__FILE__) . '/Translate/Adapter/_files/testarray', 'en_GB', array('scan' => Zend_Translate::LOCALE_DIRECTORY)); + $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, dirname(__FILE__) . '/Translate/Adapter/_files/testarray', 'en_GB', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); $this->assertEquals('Message 1 (ja)', $lang->_('Message 1', 'ja')); $this->assertEquals($lang, $lang->translate($lang)); @@ -658,20 +658,20 @@ public function testGettingPluralsUsingOwnRule() { $lang = new Zend_Translate( Zend_Translate::AN_ARRAY, - array('singular' => - array('plural_0 (en)', + ['singular' => + ['plural_0 (en)', 'plural_1 (en)', 'plural_2 (en)', - 'plural_3 (en)'), - 'plural' => ''), 'en' + 'plural_3 (en)'], + 'plural' => ''], 'en' ); - $lang->addTranslation(array('msg1' => 'Message 1 (ru)'), 'en_US'); + $lang->addTranslation(['msg1' => 'Message 1 (ru)'], 'en_US'); $lang->setLocale('en_US'); - Zend_Translate_Plural::setPlural(array($this, 'customPlural'), 'en_US'); - $this->assertEquals('plural_1 (en)', $lang->translate(array('singular', 'plural', 1))); + Zend_Translate_Plural::setPlural([$this, 'customPlural'], 'en_US'); + $this->assertEquals('plural_1 (en)', $lang->translate(['singular', 'plural', 1])); $this->assertEquals('plural_1 (en)', $lang->plural('singular', 'plural', 1)); - $this->assertEquals('plural_1 (en)', $lang->translate(array('singular', 'plural', 0))); + $this->assertEquals('plural_1 (en)', $lang->translate(['singular', 'plural', 0])); $this->assertEquals('plural_1 (en)', $lang->plural('singular', 'plural', 0)); } @@ -682,12 +682,12 @@ public function testAddingAdapterToSourceUsingOwnRule() { $translate = new Zend_Translate( Zend_Translate::AN_ARRAY, - array('singular' => - array('plural_0 (en)', + ['singular' => + ['plural_0 (en)', 'plural_1 (en)', 'plural_2 (en)', - 'plural_3 (en)'), - 'plural' => ''), 'en' + 'plural_3 (en)'], + 'plural' => ''], 'en' ); $this->assertFalse($translate->isTranslated('Message 1')); @@ -714,10 +714,10 @@ public function testIgnoreMultipleDirectories() Zend_Translate::AN_ARRAY, dirname(__FILE__) . '/Translate/Adapter/_files/testarray/', 'auto', - array( + [ 'scan' => Zend_Translate::LOCALE_FILENAME, - 'ignore' => array('.', 'ignoreme', 'LC_TEST') - ) + 'ignore' => ['.', 'ignoreme', 'LC_TEST'] + ] ); $langs = $translate->getList(); @@ -729,10 +729,10 @@ public function testIgnoreMultipleDirectories() Zend_Translate::AN_ARRAY, dirname(__FILE__) . '/Translate/Adapter/_files/testarray/', 'auto', - array( + [ 'scan' => Zend_Translate::LOCALE_FILENAME, - 'ignore' => array('.', 'regex_1' => '/de_DE/', 'regex' => '/ja/') - ) + 'ignore' => ['.', 'regex_1' => '/de_DE/', 'regex' => '/ja/'] + ] ); $langs = $translate2->getList(); @@ -747,22 +747,22 @@ public function testIgnoreMultipleDirectories() public function testReroutingForTranslations() { $translate = new Zend_Translate( - array( + [ 'adapter' => Zend_Translate::AN_ARRAY, 'content' => dirname(__FILE__) . '/Translate/Adapter/_files/testarray/', 'locale' => 'auto', 'scan' => Zend_Translate::LOCALE_FILENAME, - 'ignore' => array('.', 'ignoreme', 'LC_OTHER'), - 'route' => array('ja' => 'en_US'), - ) + 'ignore' => ['.', 'ignoreme', 'LC_OTHER'], + 'route' => ['ja' => 'en_US'], + ] ); $translate2 = new Zend_Translate( - array( + [ 'adapter' => Zend_Translate::AN_CSV, 'content' => dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.csv', 'locale' => 'en_US', - ) + ] ); $translate->addTranslation($translate2); @@ -779,22 +779,22 @@ public function testReroutingForTranslations() public function testCircleReroutingForTranslations() { $translate = new Zend_Translate( - array( + [ 'adapter' => Zend_Translate::AN_ARRAY, 'content' => dirname(__FILE__) . '/Translate/Adapter/_files/testarray/', 'locale' => 'auto', 'scan' => Zend_Translate::LOCALE_FILENAME, - 'ignore' => array('.', 'ignoreme', 'LC_TEST'), - 'route' => array('ja' => 'en_US', 'en_US' => 'ja'), - ) + 'ignore' => ['.', 'ignoreme', 'LC_TEST'], + 'route' => ['ja' => 'en_US', 'en_US' => 'ja'], + ] ); $translate2 = new Zend_Translate( - array( + [ 'adapter' => Zend_Translate::AN_CSV, 'content' => dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.csv', 'locale' => 'en_US', - ) + ] ); $translate->addTranslation($translate2); @@ -813,22 +813,22 @@ public function testCircleReroutingForTranslations() public function testDoubleReroutingForTranslations() { $translate = new Zend_Translate( - array( + [ 'adapter' => Zend_Translate::AN_ARRAY, 'content' => dirname(__FILE__) . '/Translate/Adapter/_files/testarray/', 'locale' => 'auto', 'scan' => Zend_Translate::LOCALE_FILENAME, - 'ignore' => array('.', 'ignoreme', 'LC_TEST'), - 'route' => array('ja' => 'en_US', 'en_US' => 'ja'), - ) + 'ignore' => ['.', 'ignoreme', 'LC_TEST'], + 'route' => ['ja' => 'en_US', 'en_US' => 'ja'], + ] ); $translate2 = new Zend_Translate( - array( + [ 'adapter' => Zend_Translate::AN_CSV, 'content' => dirname(__FILE__) . '/Translate/Adapter/_files/translation_en.csv', 'locale' => 'en_US', - ) + ] ); $translate->addTranslation($translate2); @@ -848,15 +848,15 @@ public function testSetCacheThroughOptions() { require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', - array('lifetime' => 120, 'automatic_serialization' => true), - array('cache_dir' => dirname(__FILE__) . '/_files/')); + ['lifetime' => 120, 'automatic_serialization' => true], + ['cache_dir' => dirname(__FILE__) . '/_files/']); - $translate = new Zend_Translate(array( + $translate = new Zend_Translate([ 'adapter' => Zend_Translate::AN_ARRAY, - 'content' => array('msg1' => 'Message 1 (en)'), + 'content' => ['msg1' => 'Message 1 (en)'], 'locale' => 'en', 'cache' => $cache, - )); + ]); $return = Zend_Translate::getCache(); $this->assertTrue($return instanceof Zend_Cache_Core); @@ -874,13 +874,13 @@ public function testSettingLogPriorityForLog() require_once 'Zend/Log.php'; $log = new Zend_Log($writer); - $lang = new Zend_Translate(array( + $lang = new Zend_Translate([ 'adapter' => Zend_Translate::AN_CSV, 'content' => dirname(__FILE__) . '/Translate/Adapter/_files', 'locale' => 'en', 'delimiter' => ',', 'logPriority' => 3, - 'log' => $log) + 'log' => $log] ); $lang->setLocale('ru'); @@ -888,7 +888,7 @@ public function testSettingLogPriorityForLog() rewind($stream); $this->assertContains('ERR (3)', stream_get_contents($stream)); - $lang->setOptions(array('logPriority' => 1)); + $lang->setOptions(['logPriority' => 1]); $lang->setLocale('sv'); rewind($stream); diff --git a/tests/Zend/Uri/HttpTest.php b/tests/Zend/Uri/HttpTest.php index b6eab0c953..367bd4808e 100644 --- a/tests/Zend/Uri/HttpTest.php +++ b/tests/Zend/Uri/HttpTest.php @@ -44,7 +44,7 @@ class Zend_Uri_HttpTest extends PHPUnit_Framework_TestCase public function setup() { - Zend_Uri::setConfig(array('allow_unwise' => false)); + Zend_Uri::setConfig(['allow_unwise' => false]); } /** @@ -61,12 +61,12 @@ public function testSimple() */ public function testSimpleFromString() { - $tests = array( + $tests = [ 'http://www.zend.com', 'https://www.zend.com', 'http://www.zend.com/path', 'http://www.zend.com/path?query=value' - ); + ]; foreach ($tests as $uri) { $obj = Zend_Uri_Http::fromString($uri); @@ -229,14 +229,14 @@ public function testUnencodedQueryParameters() */ public function testExceptionUnwiseQueryString() { - $unwise = array( + $unwise = [ 'http://example.com/?q={', 'http://example.com/?q=}', 'http://example.com/?q=|', 'http://example.com/?q=\\', 'http://example.com/?q=^', 'http://example.com/?q=`', - ); + ]; foreach ($unwise as $uri) { $this->assertFalse(Zend_Uri::check($uri), "failed for URI $uri"); @@ -250,22 +250,22 @@ public function testExceptionUnwiseQueryString() */ public function testAllowUnwiseQueryString() { - $unwise = array( + $unwise = [ 'http://example.com/?q={', 'http://example.com/?q=}', 'http://example.com/?q=|', 'http://example.com/?q=\\', 'http://example.com/?q=^', 'http://example.com/?q=`', - ); + ]; - Zend_Uri::setConfig(array('allow_unwise' => true)); + Zend_Uri::setConfig(['allow_unwise' => true]); foreach ($unwise as $uri) { $this->assertTrue(Zend_Uri::check($uri), "failed for URI $uri"); } - Zend_Uri::setConfig(array('allow_unwise' => false)); + Zend_Uri::setConfig(['allow_unwise' => false]); } /** @@ -396,11 +396,11 @@ public function testSetInvalidHost() public function testGetQueryAsArrayReturnsCorrectArray() { $uri = Zend_Uri_Http::fromString('http://example.com/foo/?test=a&var[]=1&var[]=2&some[thing]=3'); - $this->assertEquals(array( + $this->assertEquals([ 'test' => 'a', - 'var' => array(1, 2), - 'some' => array('thing' => 3) - ), $uri->getQueryAsArray()); + 'var' => [1, 2], + 'some' => ['thing' => 3] + ], $uri->getQueryAsArray()); } /** @@ -409,16 +409,16 @@ public function testGetQueryAsArrayReturnsCorrectArray() public function testAddReplaceQueryParametersModifiesQueryAndReturnsOldQuery() { $uri = Zend_Uri_Http::fromString('http://example.com/foo/?a=1&b=2&c=3'); - $this->assertEquals('a=1&b=2&c=3', $uri->addReplaceQueryParameters(array( + $this->assertEquals('a=1&b=2&c=3', $uri->addReplaceQueryParameters([ 'b' => 4, 'd' => -1 - ))); - $this->assertEquals(array( + ])); + $this->assertEquals([ 'a' => 1, 'b' => 4, 'c' => 3, 'd' => -1 - ), $uri->getQueryAsArray()); + ], $uri->getQueryAsArray()); $this->assertEquals('a=1&b=4&c=3&d=-1', $uri->getQuery()); } @@ -428,11 +428,11 @@ public function testAddReplaceQueryParametersModifiesQueryAndReturnsOldQuery() public function testRemoveQueryParametersModifiesQueryAndReturnsOldQuery() { $uri = Zend_Uri_Http::fromString('http://example.com/foo/?a=1&b=2&c=3&d=4'); - $this->assertEquals('a=1&b=2&c=3&d=4', $uri->removeQueryParameters(array('b', 'd', 'e'))); - $this->assertEquals(array( + $this->assertEquals('a=1&b=2&c=3&d=4', $uri->removeQueryParameters(['b', 'd', 'e'])); + $this->assertEquals([ 'a' => 1, 'c' => 3 - ), $uri->getQueryAsArray()); + ], $uri->getQueryAsArray()); $this->assertEquals('a=1&c=3', $uri->getQuery()); } diff --git a/tests/Zend/UriTest.php b/tests/Zend/UriTest.php index faf4a592cb..525dd1354c 100644 --- a/tests/Zend/UriTest.php +++ b/tests/Zend/UriTest.php @@ -52,7 +52,7 @@ public static function main() public function setUp() { - $this->notices = array(); + $this->notices = []; $this->errorReporting = error_reporting(); $this->displayErrors = ini_get('display_errors'); } @@ -103,7 +103,7 @@ public function testSchemeMailto() */ public function testSetConfigWithArray() { - Zend_Uri::setConfig(array('allow_unwise' => true)); + Zend_Uri::setConfig(['allow_unwise' => true]); } /** @@ -113,7 +113,7 @@ public function testSetConfigWithArray() */ public function testSetConfigWithZendConfig() { - Zend_Uri::setConfig(new Zend_Config(array('allow_unwise' => true))); + Zend_Uri::setConfig(new Zend_Config(['allow_unwise' => true])); } /** @@ -139,7 +139,7 @@ public function testToStringRaisesWarningWhenExceptionCaught() { $uri = Zend_Uri::factory('http://example.com', 'Zend_Uri_ExceptionCausing'); - set_error_handler(array($this, 'handleErrors'), E_USER_WARNING); + set_error_handler([$this, 'handleErrors'], E_USER_WARNING); $text = sprintf('%s', $uri); @@ -156,7 +156,7 @@ public function testToStringRaisesWarningWhenExceptionCaught() * * @group ZF-10405 */ - public function handleErrors($errno, $errstr, $errfile = '', $errline = 0, array $errcontext = array()) + public function handleErrors($errno, $errstr, $errfile = '', $errline = 0, array $errcontext = []) { $this->error = $errstr; } diff --git a/tests/Zend/Validate/AbstractTest.php b/tests/Zend/Validate/AbstractTest.php index 260bf11f06..fbb0ef403e 100644 --- a/tests/Zend/Validate/AbstractTest.php +++ b/tests/Zend/Validate/AbstractTest.php @@ -89,8 +89,8 @@ public function testTranslatorNullByDefault() public function testCanSetTranslator() { $this->testTranslatorNullByDefault(); - set_error_handler(array($this, 'errorHandlerIgnore')); - $translator = new Zend_Translate('array', array(), 'en'); + set_error_handler([$this, 'errorHandlerIgnore']); + $translator = new Zend_Translate('array', [], 'en'); restore_error_handler(); $this->validator->setTranslator($translator); $this->assertSame($translator->getAdapter(), $this->validator->getTranslator()); @@ -99,7 +99,7 @@ public function testCanSetTranslator() public function testCanSetTranslatorToNull() { $this->testCanSetTranslator(); - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $this->validator->setTranslator(null); restore_error_handler(); $this->assertNull($this->validator->getTranslator()); @@ -113,8 +113,8 @@ public function testGlobalDefaultTranslatorNullByDefault() public function testCanSetGlobalDefaultTranslator() { $this->testGlobalDefaultTranslatorNullByDefault(); - set_error_handler(array($this, 'errorHandlerIgnore')); - $translator = new Zend_Translate('array', array(), 'en'); + set_error_handler([$this, 'errorHandlerIgnore']); + $translator = new Zend_Translate('array', [], 'en'); restore_error_handler(); Zend_Validate_Abstract::setDefaultTranslator($translator); $this->assertSame($translator->getAdapter(), Zend_Validate_Abstract::getDefaultTranslator()); @@ -128,8 +128,8 @@ public function testGlobalDefaultTranslatorUsedWhenNoLocalTranslatorSet() public function testGlobalTranslatorFromRegistryUsedWhenNoLocalTranslatorSet() { - set_error_handler(array($this, 'errorHandlerIgnore')); - $translate = new Zend_Translate('array', array()); + set_error_handler([$this, 'errorHandlerIgnore']); + $translate = new Zend_Translate('array', []); restore_error_handler(); Zend_Registry::set('Zend_Translate', $translate); $this->assertSame($translate->getAdapter(), $this->validator->getTranslator()); @@ -138,8 +138,8 @@ public function testGlobalTranslatorFromRegistryUsedWhenNoLocalTranslatorSet() public function testLocalTranslatorPreferredOverGlobalTranslator() { $this->testCanSetGlobalDefaultTranslator(); - set_error_handler(array($this, 'errorHandlerIgnore')); - $translator = new Zend_Translate('array', array(), 'en'); + set_error_handler([$this, 'errorHandlerIgnore']); + $translator = new Zend_Translate('array', [], 'en'); restore_error_handler(); $this->validator->setTranslator($translator); $this->assertNotSame(Zend_Validate_Abstract::getDefaultTranslator(), $this->validator->getTranslator()); @@ -149,7 +149,7 @@ public function testErrorMessagesAreTranslatedWhenTranslatorPresent() { $translator = new Zend_Translate( 'array', - array('fooMessage' => 'This is the translated message for %value%'), + ['fooMessage' => 'This is the translated message for %value%'], 'en' ); $this->validator->setTranslator($translator); @@ -164,7 +164,7 @@ public function testCanTranslateMessagesInsteadOfKeys() { $translator = new Zend_Translate( 'array', - array('%value% was passed' => 'This is the translated message for %value%'), + ['%value% was passed' => 'This is the translated message for %value%'], 'en' ); $this->validator->setTranslator($translator); @@ -212,8 +212,8 @@ public function testDoesNotFailOnObjectInput() public function testTranslatorEnabledPerDefault() { - set_error_handler(array($this, 'errorHandlerIgnore')); - $translator = new Zend_Translate('array', array(), 'en'); + set_error_handler([$this, 'errorHandlerIgnore']); + $translator = new Zend_Translate('array', [], 'en'); restore_error_handler(); $this->validator->setTranslator($translator); $this->assertFalse($this->validator->translatorIsDisabled()); @@ -221,10 +221,10 @@ public function testTranslatorEnabledPerDefault() public function testCanDisableTranslator() { - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $translator = new Zend_Translate( 'array', - array('fooMessage' => 'This is the translated message for %value%'), + ['fooMessage' => 'This is the translated message for %value%'], 'en' ); restore_error_handler(); @@ -250,11 +250,11 @@ public function testGetMessageTemplates() { $messages = $this->validator->getMessageTemplates(); $this->assertEquals( - array('fooMessage' => '%value% was passed'), $messages); + ['fooMessage' => '%value% was passed'], $messages); $this->assertEquals( - array( - Zend_Validate_AbstractTest_Concrete::FOO_MESSAGE => '%value% was passed'), $messages); + [ + Zend_Validate_AbstractTest_Concrete::FOO_MESSAGE => '%value% was passed'], $messages); } public function testMaximumErrorMessageLength() @@ -266,7 +266,7 @@ public function testMaximumErrorMessageLength() $translator = new Zend_Translate( 'array', - array('fooMessage' => 'This is the translated message for %value%'), + ['fooMessage' => 'This is the translated message for %value%'], 'en' ); $this->validator->setTranslator($translator); @@ -296,9 +296,9 @@ class Zend_Validate_AbstractTest_Concrete extends Zend_Validate_Abstract { const FOO_MESSAGE = 'fooMessage'; - protected $_messageTemplates = array( + protected $_messageTemplates = [ 'fooMessage' => '%value% was passed', - ); + ]; public function isValid($value) { diff --git a/tests/Zend/Validate/AlnumTest.php b/tests/Zend/Validate/AlnumTest.php index 3a5376c730..fbd1854032 100644 --- a/tests/Zend/Validate/AlnumTest.php +++ b/tests/Zend/Validate/AlnumTest.php @@ -60,7 +60,7 @@ public function setUp() */ public function testExpectedResultsWithBasicInputValues() { - $valuesExpected = array( + $valuesExpected = [ 'abc123' => true, 'abc 123' => false, 'abcxyz' => true, @@ -70,7 +70,7 @@ public function testExpectedResultsWithBasicInputValues() ' ' => false, "\n" => false, 'foobar1' => true - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals($result, $this->_validator->isValid($input)); } @@ -83,7 +83,7 @@ public function testExpectedResultsWithBasicInputValues() */ public function testMessagesEmptyInitially() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -95,7 +95,7 @@ public function testOptionToAllowWhiteSpaceWithBasicInputValues() { $this->_validator->setAllowWhiteSpace(true); - $valuesExpected = array( + $valuesExpected = [ 'abc123' => true, 'abc 123' => true, 'abcxyz' => true, @@ -106,7 +106,7 @@ public function testOptionToAllowWhiteSpaceWithBasicInputValues() "\n" => true, " \t " => true, 'foobar1' => true - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals( $result, @@ -123,9 +123,9 @@ public function testEmptyStringValueResultsInProperValidationFailureMessages() { $this->assertFalse($this->_validator->isValid('')); $messages = $this->_validator->getMessages(); - $arrayExpected = array( + $arrayExpected = [ Zend_Validate_Alnum::STRING_EMPTY => '\'\' is an empty string' - ); + ]; $this->assertThat($messages, $this->identicalTo($arrayExpected)); } @@ -137,9 +137,9 @@ public function testEmptyStringValueResultsInProperValidationFailureErrors() { $this->assertFalse($this->_validator->isValid('')); $errors = $this->_validator->getErrors(); - $arrayExpected = array( + $arrayExpected = [ Zend_Validate_Alnum::STRING_EMPTY - ); + ]; $this->assertThat($errors, $this->identicalTo($arrayExpected)); } @@ -150,9 +150,9 @@ public function testInvalidValueResultsInProperValidationFailureMessages() { $this->assertFalse($this->_validator->isValid('#')); $messages = $this->_validator->getMessages(); - $arrayExpected = array( + $arrayExpected = [ Zend_Validate_Alnum::NOT_ALNUM => '\'#\' contains characters which are non alphabetic and no digits' - ); + ]; $this->assertThat($messages, $this->identicalTo($arrayExpected)); } @@ -164,9 +164,9 @@ public function testInvalidValueResultsInProperValidationFailureErrors() { $this->assertFalse($this->_validator->isValid('#')); $errors = $this->_validator->getErrors(); - $arrayExpected = array( + $arrayExpected = [ Zend_Validate_Alnum::NOT_ALNUM - ); + ]; $this->assertThat($errors, $this->identicalTo($arrayExpected)); } @@ -175,7 +175,7 @@ public function testInvalidValueResultsInProperValidationFailureErrors() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } /** diff --git a/tests/Zend/Validate/AlphaTest.php b/tests/Zend/Validate/AlphaTest.php index ba290a65db..8d8bb22f83 100644 --- a/tests/Zend/Validate/AlphaTest.php +++ b/tests/Zend/Validate/AlphaTest.php @@ -60,7 +60,7 @@ public function setUp() */ public function testBasic() { - $valuesExpected = array( + $valuesExpected = [ 'abc123' => false, 'abc 123' => false, 'abcxyz' => true, @@ -70,7 +70,7 @@ public function testBasic() '' => false, ' ' => false, "\n" => false - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals($result, $this->_validator->isValid($input)); } @@ -83,7 +83,7 @@ public function testBasic() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -95,7 +95,7 @@ public function testAllowWhiteSpace() { $this->_validator->setAllowWhiteSpace(true); - $valuesExpected = array( + $valuesExpected = [ 'abc123' => false, 'abc 123' => false, 'abcxyz' => true, @@ -107,7 +107,7 @@ public function testAllowWhiteSpace() "\n" => true, " \t " => true, "a\tb c" => true - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals( $result, @@ -122,6 +122,6 @@ public function testAllowWhiteSpace() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } } diff --git a/tests/Zend/Validate/BarcodeTest.php b/tests/Zend/Validate/BarcodeTest.php index 1bb9ff6c3b..7cb09091cc 100644 --- a/tests/Zend/Validate/BarcodeTest.php +++ b/tests/Zend/Validate/BarcodeTest.php @@ -73,11 +73,11 @@ public function testNonStringValidation() { $barcode = new Zend_Validate_Barcode('upca'); $this->assertFalse($barcode->isValid(106510000.4327)); - $this->assertFalse($barcode->isValid(array('065100004327'))); + $this->assertFalse($barcode->isValid(['065100004327'])); $barcode = new Zend_Validate_Barcode('ean13'); $this->assertFalse($barcode->isValid(06510000.4327)); - $this->assertFalse($barcode->isValid(array('065100004327'))); + $this->assertFalse($barcode->isValid(['065100004327'])); } public function testInvalidChecksumAdapter() @@ -154,7 +154,7 @@ public function testInvalidAdapter() public function testArrayConstructAdapter() { - $barcode = new Zend_Validate_Barcode(array('adapter' => 'Ean13', 'options' => 'unknown', 'checksum' => false)); + $barcode = new Zend_Validate_Barcode(['adapter' => 'Ean13', 'options' => 'unknown', 'checksum' => false]); $this->assertTrue($barcode->getAdapter() instanceof Zend_Validate_Barcode_Ean13); $this->assertFalse($barcode->getChecksum()); } @@ -162,7 +162,7 @@ public function testArrayConstructAdapter() public function testInvalidArrayConstructAdapter() { try { - $barcode = new Zend_Validate_Barcode(array('options' => 'unknown', 'checksum' => false)); + $barcode = new Zend_Validate_Barcode(['options' => 'unknown', 'checksum' => false]); $this->fails('Exception expected'); } catch (Exception $e) { $this->assertContains('Missing option', $e->getMessage()); @@ -171,7 +171,7 @@ public function testInvalidArrayConstructAdapter() public function testConfigConstructAdapter() { - $array = array('adapter' => 'Ean13', 'options' => 'unknown', 'checksum' => false); + $array = ['adapter' => 'Ean13', 'options' => 'unknown', 'checksum' => false]; require_once 'Zend/Config.php'; $config = new Zend_Config($array); diff --git a/tests/Zend/Validate/BetweenTest.php b/tests/Zend/Validate/BetweenTest.php index 6b88cbbf46..0a745c726e 100644 --- a/tests/Zend/Validate/BetweenTest.php +++ b/tests/Zend/Validate/BetweenTest.php @@ -51,15 +51,15 @@ public function testBasic() * - expected validation result * - array of test input values */ - $valuesExpected = array( - array(1, 100, true, true, array(1, 10, 100)), - array(1, 100, true, false, array(0, 0.99, 100.01, 101)), - array(1, 100, false, false, array(0, 1, 100, 101)), - array('a', 'z', true, true, array('a', 'b', 'y', 'z')), - array('a', 'z', false, false, array('!', 'a', 'z')) - ); + $valuesExpected = [ + [1, 100, true, true, [1, 10, 100]], + [1, 100, true, false, [0, 0.99, 100.01, 101]], + [1, 100, false, false, [0, 1, 100, 101]], + ['a', 'z', true, true, ['a', 'b', 'y', 'z']], + ['a', 'z', false, false, ['!', 'a', 'z']] + ]; foreach ($valuesExpected as $element) { - $validator = new Zend_Validate_Between(array('min' => $element[0], 'max' => $element[1], 'inclusive' => $element[2])); + $validator = new Zend_Validate_Between(['min' => $element[0], 'max' => $element[1], 'inclusive' => $element[2]]); foreach ($element[4] as $input) { $this->assertEquals($element[3], $validator->isValid($input), 'Failed values: ' . $input . ":" . implode("\n", $validator->getMessages())); @@ -74,8 +74,8 @@ public function testBasic() */ public function testGetMessages() { - $validator = new Zend_Validate_Between(array('min' => 1, 'max' => 10)); - $this->assertEquals(array(), $validator->getMessages()); + $validator = new Zend_Validate_Between(['min' => 1, 'max' => 10]); + $this->assertEquals([], $validator->getMessages()); } /** @@ -85,7 +85,7 @@ public function testGetMessages() */ public function testGetMin() { - $validator = new Zend_Validate_Between(array('min' => 1, 'max' => 10)); + $validator = new Zend_Validate_Between(['min' => 1, 'max' => 10]); $this->assertEquals(1, $validator->getMin()); } @@ -96,7 +96,7 @@ public function testGetMin() */ public function testGetMax() { - $validator = new Zend_Validate_Between(array('min' => 1, 'max' => 10)); + $validator = new Zend_Validate_Between(['min' => 1, 'max' => 10]); $this->assertEquals(10, $validator->getMax()); } @@ -107,7 +107,7 @@ public function testGetMax() */ public function testGetInclusive() { - $validator = new Zend_Validate_Between(array('min' => 1, 'max' => 10)); + $validator = new Zend_Validate_Between(['min' => 1, 'max' => 10]); $this->assertEquals(true, $validator->getInclusive()); } } diff --git a/tests/Zend/Validate/CallbackTest.php b/tests/Zend/Validate/CallbackTest.php index ed873de585..32ca5955c0 100644 --- a/tests/Zend/Validate/CallbackTest.php +++ b/tests/Zend/Validate/CallbackTest.php @@ -57,42 +57,42 @@ public static function main() */ public function testBasic() { - $valid = new Zend_Validate_Callback(array($this, 'objectCallback')); + $valid = new Zend_Validate_Callback([$this, 'objectCallback']); $this->assertTrue($valid->isValid('test')); } public function testStaticCallback() { $valid = new Zend_Validate_Callback( - array('Zend_Validate_CallbackTest', 'staticCallback') + ['Zend_Validate_CallbackTest', 'staticCallback'] ); $this->assertTrue($valid->isValid('test')); } public function testSettingDefaultOptionsAfterwards() { - $valid = new Zend_Validate_Callback(array($this, 'objectCallback')); + $valid = new Zend_Validate_Callback([$this, 'objectCallback']); $valid->setOptions('options'); - $this->assertEquals(array('options'), $valid->getOptions()); + $this->assertEquals(['options'], $valid->getOptions()); $this->assertTrue($valid->isValid('test')); } public function testSettingDefaultOptions() { - $valid = new Zend_Validate_Callback(array('callback' => array($this, 'objectCallback'), 'options' => 'options')); - $this->assertEquals(array('options'), $valid->getOptions()); + $valid = new Zend_Validate_Callback(['callback' => [$this, 'objectCallback'], 'options' => 'options']); + $this->assertEquals(['options'], $valid->getOptions()); $this->assertTrue($valid->isValid('test')); } public function testGettingCallback() { - $valid = new Zend_Validate_Callback(array($this, 'objectCallback')); - $this->assertEquals(array($this, 'objectCallback'), $valid->getCallback()); + $valid = new Zend_Validate_Callback([$this, 'objectCallback']); + $this->assertEquals([$this, 'objectCallback'], $valid->getCallback()); } public function testInvalidCallback() { - $valid = new Zend_Validate_Callback(array($this, 'objectCallback')); + $valid = new Zend_Validate_Callback([$this, 'objectCallback']); try { $valid->setCallback('invalidcallback'); $this->fail('Exception expected'); @@ -103,8 +103,8 @@ public function testInvalidCallback() public function testAddingValueOptions() { - $valid = new Zend_Validate_Callback(array('callback' => array($this, 'optionsCallback'), 'options' => 'options')); - $this->assertEquals(array('options'), $valid->getOptions()); + $valid = new Zend_Validate_Callback(['callback' => [$this, 'optionsCallback'], 'options' => 'options']); + $this->assertEquals(['options'], $valid->getOptions()); $this->assertTrue($valid->isValid('test', 'something')); } diff --git a/tests/Zend/Validate/CcnumTest.php b/tests/Zend/Validate/CcnumTest.php index 80a746cb1d..01ade3ebfb 100644 --- a/tests/Zend/Validate/CcnumTest.php +++ b/tests/Zend/Validate/CcnumTest.php @@ -50,7 +50,7 @@ class Zend_Validate_CcnumTest extends PHPUnit_Framework_TestCase */ public function setUp() { - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $this->_validator = new Zend_Validate_Ccnum(); } @@ -61,13 +61,13 @@ public function setUp() */ public function testBasic() { - $valuesExpected = array( + $valuesExpected = [ '4929000000006' => true, '5404000000000001' => true, '374200000000004' => true, '4444555566667777' => false, 'ABCDEF' => false - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals($result, $this->_validator->isValid($input)); } @@ -81,7 +81,7 @@ public function testBasic() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); restore_error_handler(); } diff --git a/tests/Zend/Validate/CreditCardTest.php b/tests/Zend/Validate/CreditCardTest.php index 4aa8aaf013..6d566b71c3 100644 --- a/tests/Zend/Validate/CreditCardTest.php +++ b/tests/Zend/Validate/CreditCardTest.php @@ -43,13 +43,13 @@ class Zend_Validate_CreditCardTest extends PHPUnit_Framework_TestCase public function testBasic() { $validator = new Zend_Validate_CreditCard(); - $valuesExpected = array( - array('4111111111111111', true), - array('5404000000000001', true), - array('374200000000004', true), - array('4444555566667777', false), - array('ABCDEF', false) - ); + $valuesExpected = [ + ['4111111111111111', true], + ['5404000000000001', true], + ['374200000000004', true], + ['4444555566667777', false], + ['ABCDEF', false] + ]; foreach ($valuesExpected as $test) { $input = $test[0]; $result = $test[1]; @@ -65,7 +65,7 @@ public function testBasic() public function testGetMessages() { $validator = new Zend_Validate_CreditCard(); - $this->assertEquals(array(), $validator->getMessages()); + $this->assertEquals([], $validator->getMessages()); } /** @@ -79,19 +79,19 @@ public function testGetSetType() $this->assertEquals(11, count($validator->getType())); $validator->setType(Zend_Validate_CreditCard::MAESTRO); - $this->assertEquals(array(Zend_Validate_CreditCard::MAESTRO), $validator->getType()); + $this->assertEquals([Zend_Validate_CreditCard::MAESTRO], $validator->getType()); $validator->setType( - array( + [ Zend_Validate_CreditCard::AMERICAN_EXPRESS, Zend_Validate_CreditCard::MAESTRO - ) + ] ); $this->assertEquals( - array( + [ Zend_Validate_CreditCard::AMERICAN_EXPRESS, Zend_Validate_CreditCard::MAESTRO - ), + ], $validator->getType() ); @@ -99,11 +99,11 @@ public function testGetSetType() Zend_Validate_CreditCard::MASTERCARD ); $this->assertEquals( - array( + [ Zend_Validate_CreditCard::AMERICAN_EXPRESS, Zend_Validate_CreditCard::MAESTRO, Zend_Validate_CreditCard::MASTERCARD - ), + ], $validator->getType() ); } @@ -116,13 +116,13 @@ public function testGetSetType() public function testProvider() { $validator = new Zend_Validate_CreditCard(Zend_Validate_CreditCard::VISA); - $valuesExpected = array( - array('4111111111111111', true), - array('5404000000000001', false), - array('374200000000004', false), - array('4444555566667777', false), - array('ABCDEF', false) - ); + $valuesExpected = [ + ['4111111111111111', true], + ['5404000000000001', false], + ['374200000000004', false], + ['4444555566667777', false], + ['ABCDEF', false] + ]; foreach ($valuesExpected as $test) { $input = $test[0]; $result = $test[1]; @@ -138,7 +138,7 @@ public function testProvider() public function testIsValidWithNonString() { $validator = new Zend_Validate_CreditCard(Zend_Validate_CreditCard::VISA); - $this->assertFalse($validator->isValid(array('something'))); + $this->assertFalse($validator->isValid(['something'])); } /** @@ -150,14 +150,14 @@ public function testServiceClass() { $validator = new Zend_Validate_CreditCard(); $this->assertEquals(null, $validator->getService()); - $validator->setService(array('Zend_Validate_CreditCardTest', 'staticCallback')); - $valuesExpected = array( + $validator->setService(['Zend_Validate_CreditCardTest', 'staticCallback']); + $valuesExpected = [ '4111111111111111' => false, '5404000000000001' => false, '374200000000004' => false, '4444555566667777' => false, 'ABCDEF' => false - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals($result, $validator->isValid($input)); } @@ -171,19 +171,19 @@ public function testServiceClass() public function testConstructionWithOptions() { $validator = new Zend_Validate_CreditCard( - array( + [ 'type' => Zend_Validate_CreditCard::VISA, - 'service' => array('Zend_Validate_CreditCardTest', 'staticCallback') - ) + 'service' => ['Zend_Validate_CreditCardTest', 'staticCallback'] + ] ); - $valuesExpected = array( + $valuesExpected = [ '4111111111111111' => false, '5404000000000001' => false, '374200000000004' => false, '4444555566667777' => false, 'ABCDEF' => false - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals($result, $validator->isValid($input)); } @@ -199,7 +199,7 @@ public function testInvalidServiceClass() $validator = new Zend_Validate_CreditCard(); $this->assertEquals(null, $validator->getService()); try { - $validator->setService(array('Zend_Validate_CreditCardTest', 'nocallback')); + $validator->setService(['Zend_Validate_CreditCardTest', 'nocallback']); $this->fail('Exception expected'); } catch(Zend_Exception $e) { $this->assertContains('Invalid callback given', $e->getMessage()); @@ -214,11 +214,11 @@ public function testInvalidServiceClass() public function testConfigObject() { require_once 'Zend/Config.php'; - $options = array('type' => 'Visa'); + $options = ['type' => 'Visa']; $config = new Zend_Config($options, false); $validator = new Zend_Validate_CreditCard($config); - $this->assertEquals(array('Visa'), $validator->getType()); + $this->assertEquals(['Visa'], $validator->getType()); } /** @@ -229,11 +229,11 @@ public function testConfigObject() public function testOptionalConstructorParameterByConfigObject() { require_once 'Zend/Config.php'; - $config = new Zend_Config(array('type' => 'Visa', 'service' => array('Zend_Validate_CreditCardTest', 'staticCallback'))); + $config = new Zend_Config(['type' => 'Visa', 'service' => ['Zend_Validate_CreditCardTest', 'staticCallback']]); $validator = new Zend_Validate_CreditCard($config); - $this->assertEquals(array('Visa'), $validator->getType()); - $this->assertEquals(array('Zend_Validate_CreditCardTest', 'staticCallback'), $validator->getService()); + $this->assertEquals(['Visa'], $validator->getType()); + $this->assertEquals(['Zend_Validate_CreditCardTest', 'staticCallback'], $validator->getService()); } /** @@ -243,16 +243,16 @@ public function testOptionalConstructorParameterByConfigObject() */ public function testOptionalConstructorParameter() { - $validator = new Zend_Validate_CreditCard('Visa', array('Zend_Validate_CreditCardTest', 'staticCallback')); - $this->assertEquals(array('Visa'), $validator->getType()); - $this->assertEquals(array('Zend_Validate_CreditCardTest', 'staticCallback'), $validator->getService()); + $validator = new Zend_Validate_CreditCard('Visa', ['Zend_Validate_CreditCardTest', 'staticCallback']); + $this->assertEquals(['Visa'], $validator->getType()); + $this->assertEquals(['Zend_Validate_CreditCardTest', 'staticCallback'], $validator->getService()); } /** * @group ZF-9477 */ public function testMultiInstitute() { - $validator = new Zend_Validate_CreditCard(array('type' => Zend_Validate_CreditCard::MASTERCARD)); + $validator = new Zend_Validate_CreditCard(['type' => Zend_Validate_CreditCard::MASTERCARD]); $this->assertFalse($validator->isValid('4111111111111111')); $message = $validator->getMessages(); $this->assertContains('not from an allowed institute', current($message)); diff --git a/tests/Zend/Validate/DateTest.php b/tests/Zend/Validate/DateTest.php index 574820248a..2b397736a4 100644 --- a/tests/Zend/Validate/DateTest.php +++ b/tests/Zend/Validate/DateTest.php @@ -66,7 +66,7 @@ public function setUp() */ public function testBasic() { - $valuesExpected = array( + $valuesExpected = [ '2007-01-01' => true, '2007-02-28' => true, '2007-02-29' => false, @@ -79,7 +79,7 @@ public function testBasic() 'Jan 1 2007' => false, 'asdasda' => false, 'sdgsdg' => false - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals($result, $this->_validator->isValid($input), "'$input' expected to be " . ($result ? '' : 'in') . 'valid'); @@ -121,7 +121,7 @@ public function testCharactersLeadingInvalid() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -139,7 +139,7 @@ public function testUseManualFormat() $this->assertFalse($this->_validator->setFormat('dd/MM/yyyy')->isValid('2008/10/22')); $this->assertTrue($this->_validator->setFormat('dd/MM/yy')->isValid('22/10/08')); $this->assertFalse($this->_validator->setFormat('dd/MM/yy')->isValid('22/10')); - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $result = $this->_validator->setFormat('s')->isValid(0); restore_error_handler(); if (!$this->_errorOccurred) { @@ -159,8 +159,8 @@ public function testUseManualFormat() public function testUseLocaleFormat() { $errorOccurredLocal = false; - set_error_handler(array($this, 'errorHandlerIgnore')); - $valuesExpected = array( + set_error_handler([$this, 'errorHandlerIgnore']); + $valuesExpected = [ '10.01.2008' => true, '32.02.2008' => false, '20 April 2008' => true, @@ -170,7 +170,7 @@ public function testUseLocaleFormat() 0 => false, 999999999999 => false, 'Jan 1 2007' => false - ); + ]; foreach ($valuesExpected as $input => $resultExpected) { $resultActual = $this->_validator->setLocale('de_AT')->isValid($input); if (!$this->_errorOccurred) { @@ -196,7 +196,7 @@ public function testUseLocaleFormat() */ public function testLocaleContructor() { - set_error_handler(array($this, 'errorHandlerIgnore')); + set_error_handler([$this, 'errorHandlerIgnore']); $valid = new Zend_Validate_Date('dd.MM.YYYY', 'de'); $this->assertTrue($valid->isValid('10.April.2008')); @@ -208,7 +208,7 @@ public function testLocaleContructor() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } /** diff --git a/tests/Zend/Validate/Db/NoRecordExistsTest.php b/tests/Zend/Validate/Db/NoRecordExistsTest.php index 43b8d337c6..74adb6c0c3 100644 --- a/tests/Zend/Validate/Db/NoRecordExistsTest.php +++ b/tests/Zend/Validate/Db/NoRecordExistsTest.php @@ -122,7 +122,7 @@ public function testBasicFindsNoRecord() public function testExcludeWithArray() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterHasResult); - $validator = new Zend_Validate_Db_NoRecordExists('users', 'field1', array('field' => 'id', 'value' => 1)); + $validator = new Zend_Validate_Db_NoRecordExists('users', 'field1', ['field' => 'id', 'value' => 1]); $this->assertFalse($validator->isValid('value3')); } @@ -135,7 +135,7 @@ public function testExcludeWithArray() public function testExcludeWithArrayNoRecord() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterNoResult); - $validator = new Zend_Validate_Db_NoRecordExists('users', 'field1', array('field' => 'id', 'value' => 1)); + $validator = new Zend_Validate_Db_NoRecordExists('users', 'field1', ['field' => 'id', 'value' => 1]); $this->assertTrue($validator->isValid('nosuchvalue')); } @@ -190,9 +190,9 @@ public function testThrowsExceptionWithNoAdapter() public function testWithSchema() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterHasResult); - $validator = new Zend_Validate_Db_NoRecordExists(array('table' => 'users', + $validator = new Zend_Validate_Db_NoRecordExists(['table' => 'users', 'schema' => 'my', - 'field' => 'field1')); + 'field' => 'field1']); $this->assertFalse($validator->isValid('value1')); } @@ -204,9 +204,9 @@ public function testWithSchema() public function testWithSchemaNoResult() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterNoResult); - $validator = new Zend_Validate_Db_NoRecordExists(array('table' => 'users', + $validator = new Zend_Validate_Db_NoRecordExists(['table' => 'users', 'schema' => 'my', - 'field' => 'field1')); + 'field' => 'field1']); $this->assertTrue($validator->isValid('value1')); } @@ -251,12 +251,12 @@ public function testAdapterProvidedNoResult() public function testCreatesQueryBasedOnNamedOrPositionalAvailablity() { Zend_Db_Table_Abstract::setDefaultAdapter(null); - $this->_adapterHasResult->setSupportsParametersValues(array('named' => false, 'positional' => true)); + $this->_adapterHasResult->setSupportsParametersValues(['named' => false, 'positional' => true]); $validator = new Zend_Validate_Db_RecordExists('users', 'field1', null, $this->_adapterHasResult); $wherePart = $validator->getSelect()->getPart('where'); $this->assertEquals($wherePart[0], '("field1" = ?)'); - $this->_adapterHasResult->setSupportsParametersValues(array('named' => true, 'positional' => true)); + $this->_adapterHasResult->setSupportsParametersValues(['named' => true, 'positional' => true]); $validator = new Zend_Validate_Db_RecordExists('users', 'field1', null, $this->_adapterHasResult); $wherePart = $validator->getSelect()->getPart('where'); $this->assertEquals($wherePart[0], '("field1" = :value)'); diff --git a/tests/Zend/Validate/Db/RecordExistsTest.php b/tests/Zend/Validate/Db/RecordExistsTest.php index 582150d7b2..54e32cb4e3 100644 --- a/tests/Zend/Validate/Db/RecordExistsTest.php +++ b/tests/Zend/Validate/Db/RecordExistsTest.php @@ -97,7 +97,7 @@ public function setUp() public function testBasicFindsRecord() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterHasResult); - $validator = new Zend_Validate_Db_RecordExists(array('table' => 'users', 'field' => 'field1')); + $validator = new Zend_Validate_Db_RecordExists(['table' => 'users', 'field' => 'field1']); $this->assertTrue($validator->isValid('value1')); } @@ -109,7 +109,7 @@ public function testBasicFindsRecord() public function testBasicFindsNoRecord() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterNoResult); - $validator = new Zend_Validate_Db_RecordExists(array('table' => 'users', 'field' => 'field1')); + $validator = new Zend_Validate_Db_RecordExists(['table' => 'users', 'field' => 'field1']); $this->assertFalse($validator->isValid('nosuchvalue')); } @@ -121,7 +121,7 @@ public function testBasicFindsNoRecord() public function testExcludeWithArray() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterHasResult); - $validator = new Zend_Validate_Db_RecordExists(array('table' => 'users', 'field' => 'field1', 'exclude' => array('field' => 'id', 'value' => 1))); + $validator = new Zend_Validate_Db_RecordExists(['table' => 'users', 'field' => 'field1', 'exclude' => ['field' => 'id', 'value' => 1]]); $this->assertTrue($validator->isValid('value3')); } @@ -134,7 +134,7 @@ public function testExcludeWithArray() public function testExcludeWithArrayNoRecord() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterNoResult); - $validator = new Zend_Validate_Db_RecordExists(array('table' => 'users', 'field' => 'field1', 'exclude' => array('field' => 'id', 'value' => 1))); + $validator = new Zend_Validate_Db_RecordExists(['table' => 'users', 'field' => 'field1', 'exclude' => ['field' => 'id', 'value' => 1]]); $this->assertFalse($validator->isValid('nosuchvalue')); } @@ -147,7 +147,7 @@ public function testExcludeWithArrayNoRecord() public function testExcludeWithString() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterHasResult); - $validator = new Zend_Validate_Db_RecordExists(array('table' => 'users', 'field' => 'field1', 'exclude' => 'id != 1')); + $validator = new Zend_Validate_Db_RecordExists(['table' => 'users', 'field' => 'field1', 'exclude' => 'id != 1']); $this->assertTrue($validator->isValid('value3')); } @@ -189,9 +189,9 @@ public function testThrowsExceptionWithNoAdapter() public function testWithSchema() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterHasResult); - $validator = new Zend_Validate_Db_RecordExists(array('table' => 'users', + $validator = new Zend_Validate_Db_RecordExists(['table' => 'users', 'schema' => 'my', - 'field' => 'field1')); + 'field' => 'field1']); $this->assertTrue($validator->isValid('value1')); } @@ -203,9 +203,9 @@ public function testWithSchema() public function testWithSchemaNoResult() { Zend_Db_Table_Abstract::setDefaultAdapter($this->_adapterNoResult); - $validator = new Zend_Validate_Db_RecordExists(array('table' => 'users', + $validator = new Zend_Validate_Db_RecordExists(['table' => 'users', 'schema' => 'my', - 'field' => 'field1')); + 'field' => 'field1']); $this->assertFalse($validator->isValid('value1')); } diff --git a/tests/Zend/Validate/Db/_files/Db/MockHasResult.php b/tests/Zend/Validate/Db/_files/Db/MockHasResult.php index af5cacda9e..97fbc2e507 100644 --- a/tests/Zend/Validate/Db/_files/Db/MockHasResult.php +++ b/tests/Zend/Validate/Db/_files/Db/MockHasResult.php @@ -36,7 +36,7 @@ */ class Db_MockHasResult extends Zend_Db_Adapter_Abstract { - protected $_supportsParametersValues = array('named' => true, 'positional' => true); + protected $_supportsParametersValues = ['named' => true, 'positional' => true]; public function setSupportsParametersValues(array $supportsParametersValues) { @@ -51,9 +51,9 @@ public function setSupportsParametersValues(array $supportsParametersValues) * @param mixed $fetchMode Override current fetch mode. * @return array */ - public function fetchRow($sql, $bind = array(), $fetchMode = null) + public function fetchRow($sql, $bind = [], $fetchMode = null) { - return array('one' => 'one'); + return ['one' => 'one']; } /** diff --git a/tests/Zend/Validate/Db/_files/Db/MockNoResult.php b/tests/Zend/Validate/Db/_files/Db/MockNoResult.php index a70b38f3ed..4f7ab575e0 100644 --- a/tests/Zend/Validate/Db/_files/Db/MockNoResult.php +++ b/tests/Zend/Validate/Db/_files/Db/MockNoResult.php @@ -45,7 +45,7 @@ class Db_MockNoResult extends Zend_Db_Adapter_Abstract * @param mixed $fetchMode Override current fetch mode. * @return null */ - public function fetchRow($sql, $bind = array(), $fetchMode = null) + public function fetchRow($sql, $bind = [], $fetchMode = null) { return null; } diff --git a/tests/Zend/Validate/DigitsTest.php b/tests/Zend/Validate/DigitsTest.php index aad6910197..d669a445c8 100644 --- a/tests/Zend/Validate/DigitsTest.php +++ b/tests/Zend/Validate/DigitsTest.php @@ -60,7 +60,7 @@ public function setUp() */ public function testExpectedResultsWithBasicInputValues() { - $valuesExpected = array( + $valuesExpected = [ 'abc123' => false, 'abc 123' => false, 'abcxyz' => false, @@ -70,7 +70,7 @@ public function testExpectedResultsWithBasicInputValues() '123' => true, '09' => true, '' => false - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals($result, $this->_validator->isValid($input)); } @@ -83,7 +83,7 @@ public function testExpectedResultsWithBasicInputValues() */ public function testMessagesEmptyInitially() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -93,9 +93,9 @@ public function testEmptyStringValueResultsInProperValidationFailureMessages() { $this->assertFalse($this->_validator->isValid('')); $messages = $this->_validator->getMessages(); - $arrayExpected = array( + $arrayExpected = [ Zend_Validate_Digits::STRING_EMPTY => '\'\' is an empty string' - ); + ]; $this->assertThat($messages, $this->identicalTo($arrayExpected)); } @@ -107,9 +107,9 @@ public function testEmptyStringValueResultsInProperValidationFailureErrors() { $this->assertFalse($this->_validator->isValid('')); $errors = $this->_validator->getErrors(); - $arrayExpected = array( + $arrayExpected = [ Zend_Validate_Digits::STRING_EMPTY - ); + ]; $this->assertThat($errors, $this->identicalTo($arrayExpected)); } @@ -120,9 +120,9 @@ public function testInvalidValueResultsInProperValidationFailureMessages() { $this->assertFalse($this->_validator->isValid('#')); $messages = $this->_validator->getMessages(); - $arrayExpected = array( + $arrayExpected = [ Zend_Validate_Digits::NOT_DIGITS => '\'#\' must contain only digits' - ); + ]; $this->assertThat($messages, $this->identicalTo($arrayExpected)); } @@ -134,9 +134,9 @@ public function testInvalidValueResultsInProperValidationFailureErrors() { $this->assertFalse($this->_validator->isValid('#')); $errors = $this->_validator->getErrors(); - $arrayExpected = array( + $arrayExpected = [ Zend_Validate_Digits::NOT_DIGITS - ); + ]; $this->assertThat($errors, $this->identicalTo($arrayExpected)); } @@ -145,6 +145,6 @@ public function testInvalidValueResultsInProperValidationFailureErrors() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } } diff --git a/tests/Zend/Validate/EmailAddressTest.php b/tests/Zend/Validate/EmailAddressTest.php index adcf01140c..ae8294bffd 100644 --- a/tests/Zend/Validate/EmailAddressTest.php +++ b/tests/Zend/Validate/EmailAddressTest.php @@ -107,10 +107,10 @@ public function testLocaldomainAllowed() public function testIPAllowed() { $validator = new Zend_Validate_EmailAddress(Zend_Validate_Hostname::ALLOW_DNS | Zend_Validate_Hostname::ALLOW_IP); - $valuesExpected = array( - array(Zend_Validate_Hostname::ALLOW_DNS, true, array('bob@212.212.20.4')), - array(Zend_Validate_Hostname::ALLOW_DNS, false, array('bob@localhost')) - ); + $valuesExpected = [ + [Zend_Validate_Hostname::ALLOW_DNS, true, ['bob@212.212.20.4']], + [Zend_Validate_Hostname::ALLOW_DNS, false, ['bob@localhost']] + ]; foreach ($valuesExpected as $element) { foreach ($element[2] as $input) { $this->assertEquals($element[1], $validator->isValid($input), implode("\n", $validator->getMessages())); @@ -189,7 +189,7 @@ public function testHostnameInvalid() */ public function testQuotedString() { - $emailAddresses = array( + $emailAddresses = [ '""@domain.com', // Optional '" "@domain.com', // x20 '"!"@domain.com', // x21 @@ -209,7 +209,7 @@ public function testQuotedString() '"bob@jones"@domain.com', '"[[ bob ]]"@domain.com', '"jones"@domain.com' - ); + ]; foreach ($emailAddresses as $input) { $this->assertTrue($this->_validator->isValid($input), "$input failed to pass validation:\n" . implode("\n", $this->_validator->getMessages())); @@ -223,7 +223,7 @@ public function testQuotedString() */ public function testInvalidQuotedString() { - $emailAddresses = array( + $emailAddresses = [ "\"\x00\"@example.com", "\"\x01\"@example.com", "\"\x1E\"@example.com", @@ -231,7 +231,7 @@ public function testInvalidQuotedString() '"""@example.com', // x22 (not escaped) '"\"@example.com', // x5C (not escaped) "\"\x7F\"@example.com", - ); + ]; foreach ($emailAddresses as $input) { $this->assertFalse($this->_validator->isValid($input), "$input failed to pass validation:\n" . implode("\n", $this->_validator->getMessages())); @@ -262,7 +262,7 @@ public function testEmailDisplay() */ public function testBasicValid() { - $emailAddresses = array( + $emailAddresses = [ 'bob@domain.com', 'bob.jones@domain.co.uk', 'bob.jones.smythe@domain.co.uk', @@ -273,7 +273,7 @@ public function testBasicValid() 'bob+jones@domain.co.uk', 'bob@some.domain.uk.com', 'bob@verylongdomainsupercalifragilisticexpialidociousspoonfulofsugar.com' - ); + ]; foreach ($emailAddresses as $input) { $this->assertTrue($this->_validator->isValid($input), "$input failed to pass validation:\n" . implode("\n", $this->_validator->getMessages())); @@ -287,7 +287,7 @@ public function testBasicValid() */ public function testBasicInvalid() { - $emailAddresses = array( + $emailAddresses = [ '', 'bob @@ -304,7 +304,7 @@ public function testBasicInvalid() 'bob@ domain.com', 'bob @ domain.com', 'Abc..123@example.com' - ); + ]; foreach ($emailAddresses as $input) { $this->assertFalse($this->_validator->isValid($input), implode("\n", $this->_validator->getMessages()) . $input); } @@ -317,7 +317,7 @@ public function testBasicInvalid() */ public function testComplexLocalValid() { - $emailAddresses = array( + $emailAddresses = [ 'Bob.Jones@domain.com', 'Bob.Jones!@domain.com', 'Bob&Jones@domain.com', @@ -325,7 +325,7 @@ public function testComplexLocalValid() '#Bob.Jones@domain.com', 'Bob.Jones?@domain.com', 'Bob~Jones@domain.com' - ); + ]; foreach ($emailAddresses as $input) { $this->assertTrue($this->_validator->isValid($input)); } @@ -354,10 +354,10 @@ public function testMXRecords() return; } - $valuesExpected = array( - array(true, array('Bob.Jones@zend.com', 'Bob.Jones@php.net')), - array(false, array('Bob.Jones@bad.example.com', 'Bob.Jones@anotherbad.example.com')) - ); + $valuesExpected = [ + [true, ['Bob.Jones@zend.com', 'Bob.Jones@php.net']], + [false, ['Bob.Jones@bad.example.com', 'Bob.Jones@anotherbad.example.com']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages())); @@ -386,9 +386,9 @@ public function testHostnameSettings() // Check no IDN matching $validator->getHostnameValidator()->setValidateIdn(false); - $valuesExpected = array( - array(false, array('name@b�rger.de', 'name@h�llo.de', 'name@h�llo.se')) - ); + $valuesExpected = [ + [false, ['name@b�rger.de', 'name@h�llo.de', 'name@h�llo.se']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages())); @@ -397,9 +397,9 @@ public function testHostnameSettings() // Check no TLD matching $validator->getHostnameValidator()->setValidateTld(false); - $valuesExpected = array( - array(true, array('name@domain.xx', 'name@domain.zz', 'name@domain.madeup')) - ); + $valuesExpected = [ + [true, ['name@domain.xx', 'name@domain.zz', 'name@domain.madeup']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages())); @@ -414,7 +414,7 @@ public function testHostnameSettings() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -425,7 +425,7 @@ public function testHostnameValidatorMessagesShouldBeTranslated() require_once 'Zend/Validate/Hostname.php'; $hostnameValidator = new Zend_Validate_Hostname(); require_once 'Zend/Translate.php'; - $translations = array( + $translations = [ 'hostnameIpAddressNotAllowed' => 'hostnameIpAddressNotAllowed translation', 'hostnameUnknownTld' => 'hostnameUnknownTld translation', 'hostnameDashCharacter' => 'hostnameDashCharacter translation', @@ -434,7 +434,7 @@ public function testHostnameValidatorMessagesShouldBeTranslated() 'hostnameInvalidHostname' => 'hostnameInvalidHostname translation', 'hostnameInvalidLocalName' => 'hostnameInvalidLocalName translation', 'hostnameLocalNameNotAllowed' => 'hostnameLocalNameNotAllowed translation', - ); + ]; $translator = new Zend_Translate('array', $translations); $this->_validator->setTranslator($translator)->setHostnameValidator($hostnameValidator); @@ -456,10 +456,10 @@ public function testHostnameValidatorMessagesShouldBeTranslated() */ public function testEmailsExceedingLength() { - $emailAddresses = array( + $emailAddresses = [ 'thislocalpathoftheemailadressislongerthantheallowedsizeof64characters@domain.com', 'bob@verylongdomainsupercalifragilisticexpialidociousspoonfulofsugarverylongdomainsupercalifragilisticexpialidociousspoonfulofsugarverylongdomainsupercalifragilisticexpialidociousspoonfulofsugarverylongdomainsupercalifragilisticexpialidociousspoonfulofsugarexpialidociousspoonfulofsugar.com', - ); + ]; foreach ($emailAddresses as $input) { $this->assertFalse($this->_validator->isValid($input)); } @@ -470,7 +470,7 @@ public function testEmailsExceedingLength() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } /** @@ -478,7 +478,7 @@ public function testNonStringValidation() */ public function testSettingHostnameMessagesThroughEmailValidator() { - $translations = array( + $translations = [ 'hostnameIpAddressNotAllowed' => 'hostnameIpAddressNotAllowed translation', 'hostnameUnknownTld' => 'hostnameUnknownTld translation', 'hostnameDashCharacter' => 'hostnameDashCharacter translation', @@ -487,7 +487,7 @@ public function testSettingHostnameMessagesThroughEmailValidator() 'hostnameInvalidHostname' => 'hostnameInvalidHostname translation', 'hostnameInvalidLocalName' => 'hostnameInvalidLocalName translation', 'hostnameLocalNameNotAllowed' => 'hostnameLocalNameNotAllowed translation', - ); + ]; $this->_validator->setMessages($translations); $this->_validator->isValid('_XX.!!3xx@0.239,512.777'); @@ -509,7 +509,7 @@ public function testSettingHostnameMessagesThroughEmailValidator() */ public function testInstanceWithOldOptions() { - $handler = set_error_handler(array($this, 'errorHandler'), E_USER_NOTICE); + $handler = set_error_handler([$this, 'errorHandler'], E_USER_NOTICE); $validator = new Zend_Validate_EmailAddress(); $options = $validator->getOptions(); @@ -533,12 +533,12 @@ public function testInstanceWithOldOptions() */ public function testSetOptions() { - $this->_validator->setOptions(array('messages' => array(Zend_Validate_EmailAddress::INVALID => 'TestMessage'))); + $this->_validator->setOptions(['messages' => [Zend_Validate_EmailAddress::INVALID => 'TestMessage']]); $messages = $this->_validator->getMessageTemplates(); $this->assertEquals('TestMessage', $messages[Zend_Validate_EmailAddress::INVALID]); $oldHostname = $this->_validator->getHostnameValidator(); - $this->_validator->setOptions(array('hostname' => new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL))); + $this->_validator->setOptions(['hostname' => new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL)]); $hostname = $this->_validator->getHostnameValidator(); $this->assertNotEquals($oldHostname, $hostname); } diff --git a/tests/Zend/Validate/File/CountTest.php b/tests/Zend/Validate/File/CountTest.php index a9a0202083..c7d5f336ed 100644 --- a/tests/Zend/Validate/File/CountTest.php +++ b/tests/Zend/Validate/File/CountTest.php @@ -58,13 +58,13 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array(5, true, true, true, true), - array(array('min' => 0, 'max' => 3), true, true, true, false), - array(array('min' => 2, 'max' => 3), false, true, true, false), - array(array('min' => 2), false, true, true, true), - array(array('max' => 5), true, true, true, true), - ); + $valuesExpected = [ + [5, true, true, true, true], + [['min' => 0, 'max' => 3], true, true, true, false], + [['min' => 2, 'max' => 3], false, true, true, false], + [['min' => 2], false, true, true, true], + [['max' => 5], true, true, true, true], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Count($element[0]); @@ -98,21 +98,21 @@ public function testBasic() */ public function testGetMin() { - $validator = new Zend_Validate_File_Count(array('min' => 1, 'max' => 5)); + $validator = new Zend_Validate_File_Count(['min' => 1, 'max' => 5]); $this->assertEquals(1, $validator->getMin()); try { - $validator = new Zend_Validate_File_Count(array('min' => 5, 'max' => 1)); + $validator = new Zend_Validate_File_Count(['min' => 5, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); } - $validator = new Zend_Validate_File_Count(array('min' => 1, 'max' => 5)); + $validator = new Zend_Validate_File_Count(['min' => 1, 'max' => 5]); $this->assertEquals(1, $validator->getMin()); try { - $validator = new Zend_Validate_File_Count(array('min' => 5, 'max' => 1)); + $validator = new Zend_Validate_File_Count(['min' => 5, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); @@ -126,7 +126,7 @@ public function testGetMin() */ public function testSetMin() { - $validator = new Zend_Validate_File_Count(array('min' => 1000, 'max' => 10000)); + $validator = new Zend_Validate_File_Count(['min' => 1000, 'max' => 10000]); $validator->setMin(100); $this->assertEquals(100, $validator->getMin()); @@ -145,11 +145,11 @@ public function testSetMin() */ public function testGetMax() { - $validator = new Zend_Validate_File_Count(array('min' => 1, 'max' => 100)); + $validator = new Zend_Validate_File_Count(['min' => 1, 'max' => 100]); $this->assertEquals(100, $validator->getMax()); try { - $validator = new Zend_Validate_File_Count(array('min' => 5, 'max' => 1)); + $validator = new Zend_Validate_File_Count(['min' => 5, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); @@ -163,7 +163,7 @@ public function testGetMax() */ public function testSetMax() { - $validator = new Zend_Validate_File_Count(array('min' => 1000, 'max' => 10000)); + $validator = new Zend_Validate_File_Count(['min' => 1000, 'max' => 10000]); $validator->setMax(1000000); $this->assertEquals(1000000, $validator->getMax()); diff --git a/tests/Zend/Validate/File/Crc32Test.php b/tests/Zend/Validate/File/Crc32Test.php index 84a99e525f..a971cfe78b 100644 --- a/tests/Zend/Validate/File/Crc32Test.php +++ b/tests/Zend/Validate/File/Crc32Test.php @@ -60,12 +60,12 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array('3f8d07e2', true), - array('9f8d07e2', false), - array(array('9f8d07e2', '3f8d07e2'), true), - array(array('9f8d07e2', '7f8d07e2'), false), - ); + $valuesExpected = [ + ['3f8d07e2', true], + ['9f8d07e2', false], + [['9f8d07e2', '3f8d07e2'], true], + [['9f8d07e2', '7f8d07e2'], false], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Crc32($element[0]); @@ -80,34 +80,34 @@ public function testBasic() $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/nofile.mo')); $this->assertTrue(array_key_exists('fileCrc32NotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Crc32('3f8d07e2'); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/nofile.mo', $files)); $this->assertTrue(array_key_exists('fileCrc32NotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Crc32('3f8d07e2'); $this->assertTrue($validator->isValid(dirname(__FILE__) . '/_files/picture.jpg', $files)); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Crc32('9f8d07e2'); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/picture.jpg', $files)); $this->assertTrue(array_key_exists('fileCrc32DoesNotMatch', $validator->getMessages())); @@ -121,10 +121,10 @@ public function testBasic() public function testgetCrc32() { $validator = new Zend_Validate_File_Crc32('12345'); - $this->assertEquals(array('12345' => 'crc32'), $validator->getCrc32()); + $this->assertEquals(['12345' => 'crc32'], $validator->getCrc32()); - $validator = new Zend_Validate_File_Crc32(array('12345', '12333', '12344')); - $this->assertEquals(array('12345' => 'crc32', '12333' => 'crc32', '12344' => 'crc32'), $validator->getCrc32()); + $validator = new Zend_Validate_File_Crc32(['12345', '12333', '12344']); + $this->assertEquals(['12345' => 'crc32', '12333' => 'crc32', '12344' => 'crc32'], $validator->getCrc32()); } /** @@ -135,10 +135,10 @@ public function testgetCrc32() public function testgetHash() { $validator = new Zend_Validate_File_Crc32('12345'); - $this->assertEquals(array('12345' => 'crc32'), $validator->getHash()); + $this->assertEquals(['12345' => 'crc32'], $validator->getHash()); - $validator = new Zend_Validate_File_Crc32(array('12345', '12333', '12344')); - $this->assertEquals(array('12345' => 'crc32', '12333' => 'crc32', '12344' => 'crc32'), $validator->getHash()); + $validator = new Zend_Validate_File_Crc32(['12345', '12333', '12344']); + $this->assertEquals(['12345' => 'crc32', '12333' => 'crc32', '12344' => 'crc32'], $validator->getHash()); } /** @@ -150,10 +150,10 @@ public function testSetCrc32() { $validator = new Zend_Validate_File_Crc32('12345'); $validator->setCrc32('12333'); - $this->assertEquals(array('12333' => 'crc32'), $validator->getCrc32()); + $this->assertEquals(['12333' => 'crc32'], $validator->getCrc32()); - $validator->setCrc32(array('12321', '12121')); - $this->assertEquals(array('12321' => 'crc32', '12121' => 'crc32'), $validator->getCrc32()); + $validator->setCrc32(['12321', '12121']); + $this->assertEquals(['12321' => 'crc32', '12121' => 'crc32'], $validator->getCrc32()); } /** @@ -165,10 +165,10 @@ public function testSetHash() { $validator = new Zend_Validate_File_Crc32('12345'); $validator->setHash('12333'); - $this->assertEquals(array('12333' => 'crc32'), $validator->getCrc32()); + $this->assertEquals(['12333' => 'crc32'], $validator->getCrc32()); - $validator->setHash(array('12321', '12121')); - $this->assertEquals(array('12321' => 'crc32', '12121' => 'crc32'), $validator->getCrc32()); + $validator->setHash(['12321', '12121']); + $this->assertEquals(['12321' => 'crc32', '12121' => 'crc32'], $validator->getCrc32()); } /** @@ -180,10 +180,10 @@ public function testAddCrc32() { $validator = new Zend_Validate_File_Crc32('12345'); $validator->addCrc32('12344'); - $this->assertEquals(array('12345' => 'crc32', '12344' => 'crc32'), $validator->getCrc32()); + $this->assertEquals(['12345' => 'crc32', '12344' => 'crc32'], $validator->getCrc32()); - $validator->addCrc32(array('12321', '12121')); - $this->assertEquals(array('12345' => 'crc32', '12344' => 'crc32', '12321' => 'crc32', '12121' => 'crc32'), $validator->getCrc32()); + $validator->addCrc32(['12321', '12121']); + $this->assertEquals(['12345' => 'crc32', '12344' => 'crc32', '12321' => 'crc32', '12121' => 'crc32'], $validator->getCrc32()); } /** @@ -195,10 +195,10 @@ public function testAddHash() { $validator = new Zend_Validate_File_Crc32('12345'); $validator->addHash('12344'); - $this->assertEquals(array('12345' => 'crc32', '12344' => 'crc32'), $validator->getCrc32()); + $this->assertEquals(['12345' => 'crc32', '12344' => 'crc32'], $validator->getCrc32()); - $validator->addHash(array('12321', '12121')); - $this->assertEquals(array('12345' => 'crc32', '12344' => 'crc32', '12321' => 'crc32', '12121' => 'crc32'), $validator->getCrc32()); + $validator->addHash(['12321', '12121']); + $this->assertEquals(['12345' => 'crc32', '12344' => 'crc32', '12321' => 'crc32', '12121' => 'crc32'], $validator->getCrc32()); } } diff --git a/tests/Zend/Validate/File/ExcludeExtensionTest.php b/tests/Zend/Validate/File/ExcludeExtensionTest.php index 33be12f2a5..b74099b249 100644 --- a/tests/Zend/Validate/File/ExcludeExtensionTest.php +++ b/tests/Zend/Validate/File/ExcludeExtensionTest.php @@ -60,14 +60,14 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array('mo', false), - array('gif', true), - array(array('mo'), false), - array(array('gif'), true), - array(array('gif', 'pdf', 'mo', 'pict'), false), - array(array('gif', 'gz', 'hint'), true), - ); + $valuesExpected = [ + ['mo', false], + ['gif', true], + [['mo'], false], + [['gif'], true], + [['gif', 'pdf', 'mo', 'pict'], false], + [['gif', 'gz', 'hint'], true], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_ExcludeExtension($element[0]); @@ -82,52 +82,52 @@ public function testBasic() $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/nofile.mo')); $this->assertTrue(array_key_exists('fileExcludeExtensionNotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_ExcludeExtension('mo'); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/nofile.mo', $files)); $this->assertTrue(array_key_exists('fileExcludeExtensionNotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_ExcludeExtension('mo'); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/testsize.mo', $files)); $this->assertTrue(array_key_exists('fileExcludeExtensionFalse', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_ExcludeExtension('gif'); $this->assertEquals(true, $validator->isValid(dirname(__FILE__) . '/_files/testsize.mo', $files)); } public function testCaseTesting() { - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); - $validator = new Zend_Validate_File_ExcludeExtension(array('MO', 'case' => true)); + ]; + $validator = new Zend_Validate_File_ExcludeExtension(['MO', 'case' => true]); $this->assertEquals(true, $validator->isValid(dirname(__FILE__) . '/_files/testsize.mo', $files)); - $validator = new Zend_Validate_File_ExcludeExtension(array('MO', 'case' => false)); + $validator = new Zend_Validate_File_ExcludeExtension(['MO', 'case' => false]); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/testsize.mo', $files)); } @@ -139,10 +139,10 @@ public function testCaseTesting() public function testGetExtension() { $validator = new Zend_Validate_File_ExcludeExtension('mo'); - $this->assertEquals(array('mo'), $validator->getExtension()); + $this->assertEquals(['mo'], $validator->getExtension()); - $validator = new Zend_Validate_File_ExcludeExtension(array('mo', 'gif', 'jpg')); - $this->assertEquals(array('mo', 'gif', 'jpg'), $validator->getExtension()); + $validator = new Zend_Validate_File_ExcludeExtension(['mo', 'gif', 'jpg']); + $this->assertEquals(['mo', 'gif', 'jpg'], $validator->getExtension()); } /** @@ -154,13 +154,13 @@ public function testSetExtension() { $validator = new Zend_Validate_File_ExcludeExtension('mo'); $validator->setExtension('gif'); - $this->assertEquals(array('gif'), $validator->getExtension()); + $this->assertEquals(['gif'], $validator->getExtension()); $validator->setExtension('jpg, mo'); - $this->assertEquals(array('jpg', 'mo'), $validator->getExtension()); + $this->assertEquals(['jpg', 'mo'], $validator->getExtension()); - $validator->setExtension(array('zip', 'ti')); - $this->assertEquals(array('zip', 'ti'), $validator->getExtension()); + $validator->setExtension(['zip', 'ti']); + $this->assertEquals(['zip', 'ti'], $validator->getExtension()); } /** @@ -172,16 +172,16 @@ public function testAddExtension() { $validator = new Zend_Validate_File_ExcludeExtension('mo'); $validator->addExtension('gif'); - $this->assertEquals(array('mo', 'gif'), $validator->getExtension()); + $this->assertEquals(['mo', 'gif'], $validator->getExtension()); $validator->addExtension('jpg, to'); - $this->assertEquals(array('mo', 'gif', 'jpg', 'to'), $validator->getExtension()); + $this->assertEquals(['mo', 'gif', 'jpg', 'to'], $validator->getExtension()); - $validator->addExtension(array('zip', 'ti')); - $this->assertEquals(array('mo', 'gif', 'jpg', 'to', 'zip', 'ti'), $validator->getExtension()); + $validator->addExtension(['zip', 'ti']); + $this->assertEquals(['mo', 'gif', 'jpg', 'to', 'zip', 'ti'], $validator->getExtension()); $validator->addExtension(''); - $this->assertEquals(array('mo', 'gif', 'jpg', 'to', 'zip', 'ti'), $validator->getExtension()); + $this->assertEquals(['mo', 'gif', 'jpg', 'to', 'zip', 'ti'], $validator->getExtension()); } } diff --git a/tests/Zend/Validate/File/ExcludeMimeTypeTest.php b/tests/Zend/Validate/File/ExcludeMimeTypeTest.php index 5911cf3619..6df7d3c108 100644 --- a/tests/Zend/Validate/File/ExcludeMimeTypeTest.php +++ b/tests/Zend/Validate/File/ExcludeMimeTypeTest.php @@ -60,25 +60,25 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array('image/gif', true), - array('image/jpeg', false), - array('image', false), - array('test/notype', true), - array('image/gif, image/jpeg', false), - array(array('image/vasa', 'image/jpeg'), false), - array(array('image/gif', 'jpeg'), false), - array(array('image/gif', 'gif'), true), - ); + $valuesExpected = [ + ['image/gif', true], + ['image/jpeg', false], + ['image', false], + ['test/notype', true], + ['image/gif, image/jpeg', false], + [['image/vasa', 'image/jpeg'], false], + [['image/gif', 'jpeg'], false], + [['image/gif', 'gif'], true], + ]; $filetest = dirname(__FILE__) . '/_files/picture.jpg'; - $files = array( + $files = [ 'name' => 'picture.jpg', 'type' => 'image/jpeg', 'size' => 200, 'tmp_name' => $filetest, 'error' => 0 - ); + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_ExcludeMimeType($element[0]); @@ -101,11 +101,11 @@ public function testGetMimeType() $validator = new Zend_Validate_File_ExcludeMimeType('image/gif'); $this->assertEquals('image/gif', $validator->getMimeType()); - $validator = new Zend_Validate_File_ExcludeMimeType(array('image/gif', 'video', 'text/test')); + $validator = new Zend_Validate_File_ExcludeMimeType(['image/gif', 'video', 'text/test']); $this->assertEquals('image/gif,video,text/test', $validator->getMimeType()); - $validator = new Zend_Validate_File_ExcludeMimeType(array('image/gif', 'video', 'text/test')); - $this->assertEquals(array('image/gif', 'video', 'text/test'), $validator->getMimeType(true)); + $validator = new Zend_Validate_File_ExcludeMimeType(['image/gif', 'video', 'text/test']); + $this->assertEquals(['image/gif', 'video', 'text/test'], $validator->getMimeType(true)); } /** @@ -118,15 +118,15 @@ public function testSetMimeType() $validator = new Zend_Validate_File_ExcludeMimeType('image/gif'); $validator->setMimeType('image/jpeg'); $this->assertEquals('image/jpeg', $validator->getMimeType()); - $this->assertEquals(array('image/jpeg'), $validator->getMimeType(true)); + $this->assertEquals(['image/jpeg'], $validator->getMimeType(true)); $validator->setMimeType('image/gif, text/test'); $this->assertEquals('image/gif,text/test', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text/test'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text/test'], $validator->getMimeType(true)); - $validator->setMimeType(array('video/mpeg', 'gif')); + $validator->setMimeType(['video/mpeg', 'gif']); $this->assertEquals('video/mpeg,gif', $validator->getMimeType()); - $this->assertEquals(array('video/mpeg', 'gif'), $validator->getMimeType(true)); + $this->assertEquals(['video/mpeg', 'gif'], $validator->getMimeType(true)); } /** @@ -139,19 +139,19 @@ public function testAddMimeType() $validator = new Zend_Validate_File_ExcludeMimeType('image/gif'); $validator->addMimeType('text'); $this->assertEquals('image/gif,text', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text'], $validator->getMimeType(true)); $validator->addMimeType('jpg, to'); $this->assertEquals('image/gif,text,jpg,to', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to'], $validator->getMimeType(true)); - $validator->addMimeType(array('zip', 'ti')); + $validator->addMimeType(['zip', 'ti']); $this->assertEquals('image/gif,text,jpg,to,zip,ti', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to', 'zip', 'ti'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to', 'zip', 'ti'], $validator->getMimeType(true)); $validator->addMimeType(''); $this->assertEquals('image/gif,text,jpg,to,zip,ti', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to', 'zip', 'ti'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to', 'zip', 'ti'], $validator->getMimeType(true)); } @@ -162,9 +162,9 @@ public function testShouldHaveProperErrorMessageOnNotReadableFile() { $validator = new Zend_Validate_File_ExcludeMimeType('image/jpeg'); - $this->assertFalse($validator->isValid('notexisting'), array('name' => 'notexisting')); + $this->assertFalse($validator->isValid('notexisting'), ['name' => 'notexisting']); $this->assertEquals( - array('fileExcludeMimeTypeNotReadable' => "File 'notexisting' is not readable or does not exist"), + ['fileExcludeMimeTypeNotReadable' => "File 'notexisting' is not readable or does not exist"], $validator->getMessages() ); } diff --git a/tests/Zend/Validate/File/ExistsTest.php b/tests/Zend/Validate/File/ExistsTest.php index 13c09f7114..6e86907f38 100644 --- a/tests/Zend/Validate/File/ExistsTest.php +++ b/tests/Zend/Validate/File/ExistsTest.php @@ -61,18 +61,18 @@ public static function main() public function testBasic() { $baseDir = dirname(__FILE__); - $valuesExpected = array( - array($baseDir, 'testsize.mo', false), - array($baseDir . '/_files', 'testsize.mo', true) - ); + $valuesExpected = [ + [$baseDir, 'testsize.mo', false], + [$baseDir . '/_files', 'testsize.mo', true] + ]; - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Exists($element[0]); @@ -88,19 +88,19 @@ public function testBasic() ); } - $valuesExpected = array( - array($baseDir, 'testsize.mo', false), - array($baseDir . '/_files', 'testsize.mo', true) - ); + $valuesExpected = [ + [$baseDir, 'testsize.mo', false], + [$baseDir . '/_files', 'testsize.mo', true] + ]; - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0, 'destination' => dirname(__FILE__) . '/_files' - ); + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Exists($element[0]); @@ -116,10 +116,10 @@ public function testBasic() ); } - $valuesExpected = array( - array($baseDir, 'testsize.mo', false, true), - array($baseDir . '/_files', 'testsize.mo', false, true) - ); + $valuesExpected = [ + [$baseDir, 'testsize.mo', false, true], + [$baseDir . '/_files', 'testsize.mo', false, true] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Exists(); @@ -146,11 +146,11 @@ public function testGetDirectory() $validator = new Zend_Validate_File_Exists('C:/temp'); $this->assertEquals('C:/temp', $validator->getDirectory()); - $validator = new Zend_Validate_File_Exists(array('temp', 'dir', 'jpg')); + $validator = new Zend_Validate_File_Exists(['temp', 'dir', 'jpg']); $this->assertEquals('temp,dir,jpg', $validator->getDirectory()); - $validator = new Zend_Validate_File_Exists(array('temp', 'dir', 'jpg')); - $this->assertEquals(array('temp', 'dir', 'jpg'), $validator->getDirectory(true)); + $validator = new Zend_Validate_File_Exists(['temp', 'dir', 'jpg']); + $this->assertEquals(['temp', 'dir', 'jpg'], $validator->getDirectory(true)); } /** @@ -163,15 +163,15 @@ public function testSetDirectory() $validator = new Zend_Validate_File_Exists('temp'); $validator->setDirectory('gif'); $this->assertEquals('gif', $validator->getDirectory()); - $this->assertEquals(array('gif'), $validator->getDirectory(true)); + $this->assertEquals(['gif'], $validator->getDirectory(true)); $validator->setDirectory('jpg, temp'); $this->assertEquals('jpg,temp', $validator->getDirectory()); - $this->assertEquals(array('jpg', 'temp'), $validator->getDirectory(true)); + $this->assertEquals(['jpg', 'temp'], $validator->getDirectory(true)); - $validator->setDirectory(array('zip', 'ti')); + $validator->setDirectory(['zip', 'ti']); $this->assertEquals('zip,ti', $validator->getDirectory()); - $this->assertEquals(array('zip', 'ti'), $validator->getDirectory(true)); + $this->assertEquals(['zip', 'ti'], $validator->getDirectory(true)); } /** @@ -184,19 +184,19 @@ public function testAddDirectory() $validator = new Zend_Validate_File_Exists('temp'); $validator->addDirectory('gif'); $this->assertEquals('temp,gif', $validator->getDirectory()); - $this->assertEquals(array('temp', 'gif'), $validator->getDirectory(true)); + $this->assertEquals(['temp', 'gif'], $validator->getDirectory(true)); $validator->addDirectory('jpg, to'); $this->assertEquals('temp,gif,jpg,to', $validator->getDirectory()); - $this->assertEquals(array('temp', 'gif', 'jpg', 'to'), $validator->getDirectory(true)); + $this->assertEquals(['temp', 'gif', 'jpg', 'to'], $validator->getDirectory(true)); - $validator->addDirectory(array('zip', 'ti')); + $validator->addDirectory(['zip', 'ti']); $this->assertEquals('temp,gif,jpg,to,zip,ti', $validator->getDirectory()); - $this->assertEquals(array('temp', 'gif', 'jpg', 'to', 'zip', 'ti'), $validator->getDirectory(true)); + $this->assertEquals(['temp', 'gif', 'jpg', 'to', 'zip', 'ti'], $validator->getDirectory(true)); $validator->addDirectory(''); $this->assertEquals('temp,gif,jpg,to,zip,ti', $validator->getDirectory()); - $this->assertEquals(array('temp', 'gif', 'jpg', 'to', 'zip', 'ti'), $validator->getDirectory(true)); + $this->assertEquals(['temp', 'gif', 'jpg', 'to', 'zip', 'ti'], $validator->getDirectory(true)); } } diff --git a/tests/Zend/Validate/File/ExtensionTest.php b/tests/Zend/Validate/File/ExtensionTest.php index a726918d47..2e51fd133f 100644 --- a/tests/Zend/Validate/File/ExtensionTest.php +++ b/tests/Zend/Validate/File/ExtensionTest.php @@ -60,14 +60,14 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array('mo', true), - array('gif', false), - array(array('mo'), true), - array(array('gif'), false), - array(array('gif', 'pdf', 'mo', 'pict'), true), - array(array('gif', 'gz', 'hint'), false), - ); + $valuesExpected = [ + ['mo', true], + ['gif', false], + [['mo'], true], + [['gif'], false], + [['gif', 'pdf', 'mo', 'pict'], true], + [['gif', 'gz', 'hint'], false], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Extension($element[0]); @@ -82,34 +82,34 @@ public function testBasic() $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/nofile.mo')); $this->assertTrue(array_key_exists('fileExtensionNotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Extension('mo'); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/nofile.mo', $files)); $this->assertTrue(array_key_exists('fileExtensionNotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Extension('mo'); $this->assertEquals(true, $validator->isValid(dirname(__FILE__) . '/_files/testsize.mo', $files)); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Extension('gif'); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/testsize.mo', $files)); $this->assertTrue(array_key_exists('fileExtensionFalse', $validator->getMessages())); @@ -125,30 +125,30 @@ public function testBasic() */ public function testNoExtension() { - $files = array( + $files = [ 'name' => 'no_extension', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/no_extension', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Extension('txt'); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/no_extension')); } public function testZF3891() { - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); - $validator = new Zend_Validate_File_Extension(array('MO', 'case' => true)); + ]; + $validator = new Zend_Validate_File_Extension(['MO', 'case' => true]); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/testsize.mo', $files)); - $validator = new Zend_Validate_File_Extension(array('MO', 'case' => false)); + $validator = new Zend_Validate_File_Extension(['MO', 'case' => false]); $this->assertEquals(true, $validator->isValid(dirname(__FILE__) . '/_files/testsize.mo', $files)); } @@ -160,10 +160,10 @@ public function testZF3891() public function testGetExtension() { $validator = new Zend_Validate_File_Extension('mo'); - $this->assertEquals(array('mo'), $validator->getExtension()); + $this->assertEquals(['mo'], $validator->getExtension()); - $validator = new Zend_Validate_File_Extension(array('mo', 'gif', 'jpg')); - $this->assertEquals(array('mo', 'gif', 'jpg'), $validator->getExtension()); + $validator = new Zend_Validate_File_Extension(['mo', 'gif', 'jpg']); + $this->assertEquals(['mo', 'gif', 'jpg'], $validator->getExtension()); } /** @@ -175,13 +175,13 @@ public function testSetExtension() { $validator = new Zend_Validate_File_Extension('mo'); $validator->setExtension('gif'); - $this->assertEquals(array('gif'), $validator->getExtension()); + $this->assertEquals(['gif'], $validator->getExtension()); $validator->setExtension('jpg, mo'); - $this->assertEquals(array('jpg', 'mo'), $validator->getExtension()); + $this->assertEquals(['jpg', 'mo'], $validator->getExtension()); - $validator->setExtension(array('zip', 'ti')); - $this->assertEquals(array('zip', 'ti'), $validator->getExtension()); + $validator->setExtension(['zip', 'ti']); + $this->assertEquals(['zip', 'ti'], $validator->getExtension()); } /** @@ -193,16 +193,16 @@ public function testAddExtension() { $validator = new Zend_Validate_File_Extension('mo'); $validator->addExtension('gif'); - $this->assertEquals(array('mo', 'gif'), $validator->getExtension()); + $this->assertEquals(['mo', 'gif'], $validator->getExtension()); $validator->addExtension('jpg, to'); - $this->assertEquals(array('mo', 'gif', 'jpg', 'to'), $validator->getExtension()); + $this->assertEquals(['mo', 'gif', 'jpg', 'to'], $validator->getExtension()); - $validator->addExtension(array('zip', 'ti')); - $this->assertEquals(array('mo', 'gif', 'jpg', 'to', 'zip', 'ti'), $validator->getExtension()); + $validator->addExtension(['zip', 'ti']); + $this->assertEquals(['mo', 'gif', 'jpg', 'to', 'zip', 'ti'], $validator->getExtension()); $validator->addExtension(''); - $this->assertEquals(array('mo', 'gif', 'jpg', 'to', 'zip', 'ti'), $validator->getExtension()); + $this->assertEquals(['mo', 'gif', 'jpg', 'to', 'zip', 'ti'], $validator->getExtension()); } } diff --git a/tests/Zend/Validate/File/FilesSizeTest.php b/tests/Zend/Validate/File/FilesSizeTest.php index d20330f10c..08883f7f21 100644 --- a/tests/Zend/Validate/File/FilesSizeTest.php +++ b/tests/Zend/Validate/File/FilesSizeTest.php @@ -63,15 +63,15 @@ public function setUp() */ public function testBasic() { - $valuesExpected = array( - array(array('min' => 0, 'max' => 2000), true, true, false), - array(array('min' => 0, 'max' => '2 MB'), true, true, true), - array(array('min' => 0, 'max' => '2MB'), true, true, true), - array(array('min' => 0, 'max' => '2 MB'), true, true, true), - array(2000, true, true, false), - array(array('min' => 0, 'max' => 500), false, false, false), - array(500, false, false, false) - ); + $valuesExpected = [ + [['min' => 0, 'max' => 2000], true, true, false], + [['min' => 0, 'max' => '2 MB'], true, true, true], + [['min' => 0, 'max' => '2MB'], true, true, true], + [['min' => 0, 'max' => '2 MB'], true, true, true], + [2000, true, true, false], + [['min' => 0, 'max' => 500], false, false, false], + [500, false, false, false] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_FilesSize($element[0]); @@ -92,15 +92,15 @@ public function testBasic() ); } - $validator = new Zend_Validate_File_FilesSize(array('min' => 0, 'max' => 200)); + $validator = new Zend_Validate_File_FilesSize(['min' => 0, 'max' => 200]); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/nofile.mo')); $this->assertTrue(array_key_exists('fileFilesSizeNotReadable', $validator->getMessages())); - $validator = new Zend_Validate_File_FilesSize(array('min' => 0, 'max' => 500000)); - $this->assertEquals(true, $validator->isValid(array( + $validator = new Zend_Validate_File_FilesSize(['min' => 0, 'max' => 500000]); + $this->assertEquals(true, $validator->isValid([ dirname(__FILE__) . '/_files/testsize.mo', dirname(__FILE__) . '/_files/testsize.mo', - dirname(__FILE__) . '/_files/testsize2.mo'))); + dirname(__FILE__) . '/_files/testsize2.mo'])); $this->assertEquals(true, $validator->isValid(dirname(__FILE__) . '/_files/testsize.mo')); } @@ -111,17 +111,17 @@ public function testBasic() */ public function testGetMin() { - $validator = new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 100)); + $validator = new Zend_Validate_File_FilesSize(['min' => 1, 'max' => 100]); $this->assertEquals('1B', $validator->getMin()); try { - $validator = new Zend_Validate_File_FilesSize(array('min' => 100, 'max' => 1)); + $validator = new Zend_Validate_File_FilesSize(['min' => 100, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); } - $validator = new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 100)); + $validator = new Zend_Validate_File_FilesSize(['min' => 1, 'max' => 100]); $this->assertEquals('1B', $validator->getMin()); } @@ -132,7 +132,7 @@ public function testGetMin() */ public function testSetMin() { - $validator = new Zend_Validate_File_FilesSize(array('min' => 1000, 'max' => 10000)); + $validator = new Zend_Validate_File_FilesSize(['min' => 1000, 'max' => 10000]); $validator->setMin(100); $this->assertEquals('100B', $validator->getMin()); @@ -151,17 +151,17 @@ public function testSetMin() */ public function testGetMax() { - $validator = new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 100)); + $validator = new Zend_Validate_File_FilesSize(['min' => 1, 'max' => 100]); $this->assertEquals('100B', $validator->getMax()); try { - $validator = new Zend_Validate_File_FilesSize(array('min' => 100, 'max' => 1)); + $validator = new Zend_Validate_File_FilesSize(['min' => 100, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); } - $validator = new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 100000)); + $validator = new Zend_Validate_File_FilesSize(['min' => 1, 'max' => 100000]); $this->assertEquals('97.66kB', $validator->getMax()); $validator = new Zend_Validate_File_FilesSize(2000); @@ -177,7 +177,7 @@ public function testGetMax() */ public function testSetMax() { - $validator = new Zend_Validate_File_FilesSize(array('min' => 1000, 'max' => 10000)); + $validator = new Zend_Validate_File_FilesSize(['min' => 1000, 'max' => 10000]); $validator->setMax(1000000); $this->assertEquals('976.56kB', $validator->getMax()); @@ -187,7 +187,7 @@ public function testSetMax() public function testConstructorShouldRaiseErrorWhenPassedMultipleOptions() { - $handler = set_error_handler(array($this, 'errorHandler'), E_USER_NOTICE); + $handler = set_error_handler([$this, 'errorHandler'], E_USER_NOTICE); $validator = new Zend_Validate_File_FilesSize(1000, 10000); restore_error_handler(); } @@ -199,19 +199,19 @@ public function testConstructorShouldRaiseErrorWhenPassedMultipleOptions() */ public function testFailureMessage() { - $validator = new Zend_Validate_File_FilesSize(array('min' => 9999, 'max' => 10000)); - $this->assertFalse($validator->isValid(array( + $validator = new Zend_Validate_File_FilesSize(['min' => 9999, 'max' => 10000]); + $this->assertFalse($validator->isValid([ dirname(__FILE__) . '/_files/testsize.mo', dirname(__FILE__) . '/_files/testsize.mo', - dirname(__FILE__) . '/_files/testsize2.mo'))); + dirname(__FILE__) . '/_files/testsize2.mo'])); $this->assertContains('9.76kB', current($validator->getMessages())); $this->assertContains('1.55kB', current($validator->getMessages())); - $validator = new Zend_Validate_File_FilesSize(array('min' => 9999, 'max' => 10000, 'bytestring' => false)); - $this->assertFalse($validator->isValid(array( + $validator = new Zend_Validate_File_FilesSize(['min' => 9999, 'max' => 10000, 'bytestring' => false]); + $this->assertFalse($validator->isValid([ dirname(__FILE__) . '/_files/testsize.mo', dirname(__FILE__) . '/_files/testsize.mo', - dirname(__FILE__) . '/_files/testsize2.mo'))); + dirname(__FILE__) . '/_files/testsize2.mo'])); $this->assertContains('9999', current($validator->getMessages())); $this->assertContains('1588', current($validator->getMessages())); } diff --git a/tests/Zend/Validate/File/HashTest.php b/tests/Zend/Validate/File/HashTest.php index 3f201c2a0a..ed5e3f63c2 100644 --- a/tests/Zend/Validate/File/HashTest.php +++ b/tests/Zend/Validate/File/HashTest.php @@ -60,12 +60,12 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array('3f8d07e2', true), - array('9f8d07e2', false), - array(array('9f8d07e2', '3f8d07e2'), true), - array(array('9f8d07e2', '7f8d07e2'), false), - ); + $valuesExpected = [ + ['3f8d07e2', true], + ['9f8d07e2', false], + [['9f8d07e2', '3f8d07e2'], true], + [['9f8d07e2', '7f8d07e2'], false], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Hash($element[0]); @@ -76,12 +76,12 @@ public function testBasic() ); } - $valuesExpected = array( - array(array('ed74c22109fe9f110579f77b053b8bc3', 'algorithm' => 'md5'), true), - array(array('4d74c22109fe9f110579f77b053b8bc3', 'algorithm' => 'md5'), false), - array(array('4d74c22109fe9f110579f77b053b8bc3', 'ed74c22109fe9f110579f77b053b8bc3', 'algorithm' => 'md5'), true), - array(array('1d74c22109fe9f110579f77b053b8bc3', '4d74c22109fe9f110579f77b053b8bc3', 'algorithm' => 'md5'), false), - ); + $valuesExpected = [ + [['ed74c22109fe9f110579f77b053b8bc3', 'algorithm' => 'md5'], true], + [['4d74c22109fe9f110579f77b053b8bc3', 'algorithm' => 'md5'], false], + [['4d74c22109fe9f110579f77b053b8bc3', 'ed74c22109fe9f110579f77b053b8bc3', 'algorithm' => 'md5'], true], + [['1d74c22109fe9f110579f77b053b8bc3', '4d74c22109fe9f110579f77b053b8bc3', 'algorithm' => 'md5'], false], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Hash($element[0]); @@ -96,34 +96,34 @@ public function testBasic() $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/nofile.mo')); $this->assertTrue(array_key_exists('fileHashNotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Hash('3f8d07e2'); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/nofile.mo', $files)); $this->assertTrue(array_key_exists('fileHashNotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Hash('3f8d07e2'); $this->assertTrue($validator->isValid(dirname(__FILE__) . '/_files/picture.jpg', $files)); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Hash('9f8d07e2'); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/picture.jpg', $files)); $this->assertTrue(array_key_exists('fileHashDoesNotMatch', $validator->getMessages())); @@ -137,10 +137,10 @@ public function testBasic() public function testgetHash() { $validator = new Zend_Validate_File_Hash('12345'); - $this->assertEquals(array('12345' => 'crc32'), $validator->getHash()); + $this->assertEquals(['12345' => 'crc32'], $validator->getHash()); - $validator = new Zend_Validate_File_Hash(array('12345', '12333', '12344')); - $this->assertEquals(array('12345' => 'crc32', '12333' => 'crc32', '12344' => 'crc32'), $validator->getHash()); + $validator = new Zend_Validate_File_Hash(['12345', '12333', '12344']); + $this->assertEquals(['12345' => 'crc32', '12333' => 'crc32', '12344' => 'crc32'], $validator->getHash()); } /** @@ -152,10 +152,10 @@ public function testSetHash() { $validator = new Zend_Validate_File_Hash('12345'); $validator->setHash('12333'); - $this->assertEquals(array('12333' => 'crc32'), $validator->getHash()); + $this->assertEquals(['12333' => 'crc32'], $validator->getHash()); - $validator->setHash(array('12321', '12121')); - $this->assertEquals(array('12321' => 'crc32', '12121' => 'crc32'), $validator->getHash()); + $validator->setHash(['12321', '12121']); + $this->assertEquals(['12321' => 'crc32', '12121' => 'crc32'], $validator->getHash()); } /** @@ -167,10 +167,10 @@ public function testAddHash() { $validator = new Zend_Validate_File_Hash('12345'); $validator->addHash('12344'); - $this->assertEquals(array('12345' => 'crc32', '12344' => 'crc32'), $validator->getHash()); + $this->assertEquals(['12345' => 'crc32', '12344' => 'crc32'], $validator->getHash()); - $validator->addHash(array('12321', '12121')); - $this->assertEquals(array('12345' => 'crc32', '12344' => 'crc32', '12321' => 'crc32', '12121' => 'crc32'), $validator->getHash()); + $validator->addHash(['12321', '12121']); + $this->assertEquals(['12345' => 'crc32', '12344' => 'crc32', '12321' => 'crc32', '12121' => 'crc32'], $validator->getHash()); } } diff --git a/tests/Zend/Validate/File/ImageSizeTest.php b/tests/Zend/Validate/File/ImageSizeTest.php index ee6465c9c4..2de6211d8d 100644 --- a/tests/Zend/Validate/File/ImageSizeTest.php +++ b/tests/Zend/Validate/File/ImageSizeTest.php @@ -58,16 +58,16 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array(array('minwidth' => 0, 'minheight' => 10, 'maxwidth' => 1000, 'maxheight' => 2000), true), - array(array('minwidth' => 0, 'minheight' => 0, 'maxwidth' => 200, 'maxheight' => 200), true), - array(array('minwidth' => 150, 'minheight' => 150, 'maxwidth' => 200, 'maxheight' => 200), false), - array(array('minwidth' => 80, 'minheight' => 0, 'maxwidth' => 80, 'maxheight' => 200), true), - array(array('minwidth' => 0, 'minheight' => 0, 'maxwidth' => 60, 'maxheight' => 200), false), - array(array('minwidth' => 90, 'minheight' => 0, 'maxwidth' => 200, 'maxheight' => 200), false), - array(array('minwidth' => 0, 'minheight' => 0, 'maxwidth' => 200, 'maxheight' => 80), false), - array(array('minwidth' => 0, 'minheight' => 110, 'maxwidth' => 200, 'maxheight' => 140), false) - ); + $valuesExpected = [ + [['minwidth' => 0, 'minheight' => 10, 'maxwidth' => 1000, 'maxheight' => 2000], true], + [['minwidth' => 0, 'minheight' => 0, 'maxwidth' => 200, 'maxheight' => 200], true], + [['minwidth' => 150, 'minheight' => 150, 'maxwidth' => 200, 'maxheight' => 200], false], + [['minwidth' => 80, 'minheight' => 0, 'maxwidth' => 80, 'maxheight' => 200], true], + [['minwidth' => 0, 'minheight' => 0, 'maxwidth' => 60, 'maxheight' => 200], false], + [['minwidth' => 90, 'minheight' => 0, 'maxwidth' => 200, 'maxheight' => 200], false], + [['minwidth' => 0, 'minheight' => 0, 'maxwidth' => 200, 'maxheight' => 80], false], + [['minwidth' => 0, 'minheight' => 110, 'maxwidth' => 200, 'maxheight' => 140], false] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_ImageSize($element[0]); @@ -78,18 +78,18 @@ public function testBasic() ); } - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 0, 'minheight' => 10, 'maxwidth' => 1000, 'maxheight' => 2000)); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 0, 'minheight' => 10, 'maxwidth' => 1000, 'maxheight' => 2000]); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/nofile.jpg')); $failures = $validator->getMessages(); $this->assertContains('is not readable', $failures['fileImageSizeNotReadable']); $file['name'] = 'TestName'; - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 0, 'minheight' => 10, 'maxwidth' => 1000, 'maxheight' => 2000)); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 0, 'minheight' => 10, 'maxwidth' => 1000, 'maxheight' => 2000]); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/nofile.jpg', $file)); $failures = $validator->getMessages(); $this->assertContains('TestName', $failures['fileImageSizeNotReadable']); - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 0, 'minheight' => 10, 'maxwidth' => 1000, 'maxheight' => 2000)); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 0, 'minheight' => 10, 'maxwidth' => 1000, 'maxheight' => 2000]); $this->assertEquals(false, $validator->isValid(dirname(__FILE__) . '/_files/badpicture.jpg')); $failures = $validator->getMessages(); $this->assertContains('could not be detected', $failures['fileImageSizeNotDetected']); @@ -102,11 +102,11 @@ public function testBasic() */ public function testGetImageMin() { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 1, 'minheight' => 10, 'maxwidth' => 100, 'maxheight' => 1000)); - $this->assertEquals(array('minwidth' => 1, 'minheight' => 10), $validator->getImageMin()); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 1, 'minheight' => 10, 'maxwidth' => 100, 'maxheight' => 1000]); + $this->assertEquals(['minwidth' => 1, 'minheight' => 10], $validator->getImageMin()); try { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 1000, 'minheight' => 100, 'maxwidth' => 10, 'maxheight' => 1)); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 1000, 'minheight' => 100, 'maxwidth' => 10, 'maxheight' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); @@ -120,15 +120,15 @@ public function testGetImageMin() */ public function testSetImageMin() { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 100, 'minheight' => 1000, 'maxwidth' => 10000, 'maxheight' => 100000)); - $validator->setImageMin(array('minwidth' => 10, 'minheight' => 10)); - $this->assertEquals(array('minwidth' => 10, 'minheight' => 10), $validator->getImageMin()); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 100, 'minheight' => 1000, 'maxwidth' => 10000, 'maxheight' => 100000]); + $validator->setImageMin(['minwidth' => 10, 'minheight' => 10]); + $this->assertEquals(['minwidth' => 10, 'minheight' => 10], $validator->getImageMin()); - $validator->setImageMin(array('minwidth' => 9, 'minheight' => 100)); - $this->assertEquals(array('minwidth' => 9, 'minheight' => 100), $validator->getImageMin()); + $validator->setImageMin(['minwidth' => 9, 'minheight' => 100]); + $this->assertEquals(['minwidth' => 9, 'minheight' => 100], $validator->getImageMin()); try { - $validator->setImageMin(array('minwidth' => 20000, 'minheight' => 20000)); + $validator->setImageMin(['minwidth' => 20000, 'minheight' => 20000]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("less than or equal", $e->getMessage()); @@ -142,11 +142,11 @@ public function testSetImageMin() */ public function testGetImageMax() { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 10, 'minheight' => 100, 'maxwidth' => 1000, 'maxheight' => 10000)); - $this->assertEquals(array('maxwidth' => 1000, 'maxheight' => 10000), $validator->getImageMax()); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 10, 'minheight' => 100, 'maxwidth' => 1000, 'maxheight' => 10000]); + $this->assertEquals(['maxwidth' => 1000, 'maxheight' => 10000], $validator->getImageMax()); try { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 10000, 'minheight' => 1000, 'maxwidth' => 100, 'maxheight' => 10)); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 10000, 'minheight' => 1000, 'maxwidth' => 100, 'maxheight' => 10]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); @@ -160,21 +160,21 @@ public function testGetImageMax() */ public function testSetImageMax() { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 10, 'minheight' => 100, 'maxwidth' => 1000, 'maxheight' => 10000)); - $validator->setImageMax(array('maxwidth' => 100, 'maxheight' => 100)); - $this->assertEquals(array('maxwidth' => 100, 'maxheight' => 100), $validator->getImageMax()); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 10, 'minheight' => 100, 'maxwidth' => 1000, 'maxheight' => 10000]); + $validator->setImageMax(['maxwidth' => 100, 'maxheight' => 100]); + $this->assertEquals(['maxwidth' => 100, 'maxheight' => 100], $validator->getImageMax()); - $validator->setImageMax(array('maxwidth' => 110, 'maxheight' => 1000)); - $this->assertEquals(array('maxwidth' => 110, 'maxheight' => 1000), $validator->getImageMax()); + $validator->setImageMax(['maxwidth' => 110, 'maxheight' => 1000]); + $this->assertEquals(['maxwidth' => 110, 'maxheight' => 1000], $validator->getImageMax()); - $validator->setImageMax(array('maxheight' => 1100)); - $this->assertEquals(array('maxwidth' => 110, 'maxheight' => 1100), $validator->getImageMax()); + $validator->setImageMax(['maxheight' => 1100]); + $this->assertEquals(['maxwidth' => 110, 'maxheight' => 1100], $validator->getImageMax()); - $validator->setImageMax(array('maxwidth' => 120)); - $this->assertEquals(array('maxwidth' => 120, 'maxheight' => 1100), $validator->getImageMax()); + $validator->setImageMax(['maxwidth' => 120]); + $this->assertEquals(['maxwidth' => 120, 'maxheight' => 1100], $validator->getImageMax()); try { - $validator->setImageMax(array('maxwidth' => 10000, 'maxheight' => 1)); + $validator->setImageMax(['maxwidth' => 10000, 'maxheight' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); @@ -188,8 +188,8 @@ public function testSetImageMax() */ public function testGetImageWidth() { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 1, 'minheight' => 10, 'maxwidth' => 100, 'maxheight' => 1000)); - $this->assertEquals(array('minwidth' => 1, 'maxwidth' => 100), $validator->getImageWidth()); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 1, 'minheight' => 10, 'maxwidth' => 100, 'maxheight' => 1000]); + $this->assertEquals(['minwidth' => 1, 'maxwidth' => 100], $validator->getImageWidth()); } /** @@ -199,12 +199,12 @@ public function testGetImageWidth() */ public function testSetImageWidth() { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 100, 'minheight' => 1000, 'maxwidth' => 10000, 'maxheight' => 100000)); - $validator->setImageWidth(array('minwidth' => 2000, 'maxwidth' => 2200)); - $this->assertEquals(array('minwidth' => 2000, 'maxwidth' => 2200), $validator->getImageWidth()); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 100, 'minheight' => 1000, 'maxwidth' => 10000, 'maxheight' => 100000]); + $validator->setImageWidth(['minwidth' => 2000, 'maxwidth' => 2200]); + $this->assertEquals(['minwidth' => 2000, 'maxwidth' => 2200], $validator->getImageWidth()); try { - $validator->setImageWidth(array('minwidth' => 20000, 'maxwidth' => 200)); + $validator->setImageWidth(['minwidth' => 20000, 'maxwidth' => 200]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("less than or equal", $e->getMessage()); @@ -218,8 +218,8 @@ public function testSetImageWidth() */ public function testGetImageHeight() { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 1, 'minheight' => 10, 'maxwidth' => 100, 'maxheight' => 1000)); - $this->assertEquals(array('minheight' => 10, 'maxheight' => 1000), $validator->getImageHeight()); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 1, 'minheight' => 10, 'maxwidth' => 100, 'maxheight' => 1000]); + $this->assertEquals(['minheight' => 10, 'maxheight' => 1000], $validator->getImageHeight()); } /** @@ -229,12 +229,12 @@ public function testGetImageHeight() */ public function testSetImageHeight() { - $validator = new Zend_Validate_File_ImageSize(array('minwidth' => 100, 'minheight' => 1000, 'maxwidth' => 10000, 'maxheight' => 100000)); - $validator->setImageHeight(array('minheight' => 2000, 'maxheight' => 2200)); - $this->assertEquals(array('minheight' => 2000, 'maxheight' => 2200), $validator->getImageHeight()); + $validator = new Zend_Validate_File_ImageSize(['minwidth' => 100, 'minheight' => 1000, 'maxwidth' => 10000, 'maxheight' => 100000]); + $validator->setImageHeight(['minheight' => 2000, 'maxheight' => 2200]); + $this->assertEquals(['minheight' => 2000, 'maxheight' => 2200], $validator->getImageHeight()); try { - $validator->setImageHeight(array('minheight' => 20000, 'maxheight' => 200)); + $validator->setImageHeight(['minheight' => 20000, 'maxheight' => 200]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("less than or equal", $e->getMessage()); diff --git a/tests/Zend/Validate/File/IsCompressedTest.php b/tests/Zend/Validate/File/IsCompressedTest.php index fc4dd7a183..8c6962a5e0 100644 --- a/tests/Zend/Validate/File/IsCompressedTest.php +++ b/tests/Zend/Validate/File/IsCompressedTest.php @@ -77,27 +77,27 @@ function_exists('mime_content_type') && ini_get('mime_magic.magicfile') && // Sometimes mime_content_type() gives application/zip and sometimes // application/x-zip ... $expectedMimeType = mime_content_type(dirname(__FILE__) . '/_files/test.zip'); - if (!in_array($expectedMimeType, array('application/zip', 'application/x-zip'))) { + if (!in_array($expectedMimeType, ['application/zip', 'application/x-zip'])) { $this->markTestSkipped('mime_content_type exhibits buggy behavior on this system!'); } - $valuesExpected = array( - array(null, true), - array('zip', true), - array('test/notype', false), - array('application/x-zip, application/zip, application/x-tar', true), - array(array('application/x-zip', 'application/zip', 'application/x-tar'), true), - array(array('zip', 'tar'), true), - array(array('tar', 'arj'), false), - ); - - $files = array( + $valuesExpected = [ + [null, true], + ['zip', true], + ['test/notype', false], + ['application/x-zip, application/zip, application/x-tar', true], + [['application/x-zip', 'application/zip', 'application/x-tar'], true], + [['zip', 'tar'], true], + [['tar', 'arj'], false], + ]; + + $files = [ 'name' => 'test.zip', 'type' => $expectedMimeType, 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/test.zip', 'error' => 0 - ); + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_IsCompressed($element[0]); @@ -120,11 +120,11 @@ public function testGetMimeType() $validator = new Zend_Validate_File_IsCompressed('image/gif'); $this->assertEquals('image/gif', $validator->getMimeType()); - $validator = new Zend_Validate_File_IsCompressed(array('image/gif', 'video', 'text/test')); + $validator = new Zend_Validate_File_IsCompressed(['image/gif', 'video', 'text/test']); $this->assertEquals('image/gif,video,text/test', $validator->getMimeType()); - $validator = new Zend_Validate_File_IsCompressed(array('image/gif', 'video', 'text/test')); - $this->assertEquals(array('image/gif', 'video', 'text/test'), $validator->getMimeType(true)); + $validator = new Zend_Validate_File_IsCompressed(['image/gif', 'video', 'text/test']); + $this->assertEquals(['image/gif', 'video', 'text/test'], $validator->getMimeType(true)); } /** @@ -137,15 +137,15 @@ public function testSetMimeType() $validator = new Zend_Validate_File_IsCompressed('image/gif'); $validator->setMimeType('image/jpeg'); $this->assertEquals('image/jpeg', $validator->getMimeType()); - $this->assertEquals(array('image/jpeg'), $validator->getMimeType(true)); + $this->assertEquals(['image/jpeg'], $validator->getMimeType(true)); $validator->setMimeType('image/gif, text/test'); $this->assertEquals('image/gif,text/test', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text/test'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text/test'], $validator->getMimeType(true)); - $validator->setMimeType(array('video/mpeg', 'gif')); + $validator->setMimeType(['video/mpeg', 'gif']); $this->assertEquals('video/mpeg,gif', $validator->getMimeType()); - $this->assertEquals(array('video/mpeg', 'gif'), $validator->getMimeType(true)); + $this->assertEquals(['video/mpeg', 'gif'], $validator->getMimeType(true)); } /** @@ -158,19 +158,19 @@ public function testAddMimeType() $validator = new Zend_Validate_File_IsCompressed('image/gif'); $validator->addMimeType('text'); $this->assertEquals('image/gif,text', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text'], $validator->getMimeType(true)); $validator->addMimeType('jpg, to'); $this->assertEquals('image/gif,text,jpg,to', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to'], $validator->getMimeType(true)); - $validator->addMimeType(array('zip', 'ti')); + $validator->addMimeType(['zip', 'ti']); $this->assertEquals('image/gif,text,jpg,to,zip,ti', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to', 'zip', 'ti'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to', 'zip', 'ti'], $validator->getMimeType(true)); $validator->addMimeType(''); $this->assertEquals('image/gif,text,jpg,to,zip,ti', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to', 'zip', 'ti'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to', 'zip', 'ti'], $validator->getMimeType(true)); } /** @@ -178,13 +178,13 @@ public function testAddMimeType() */ public function testErrorMessages() { - $files = array( + $files = [ 'name' => 'picture.jpg', 'type' => 'image/jpeg', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/picture.jpg', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_IsCompressed('test/notype'); $validator->enableHeaderCheck(); @@ -205,11 +205,11 @@ public function testOptionsAtConstructor() $magicFile = dirname(__FILE__) . '/_files/magic.mime'; } - $validator = new Zend_Validate_File_IsCompressed(array( + $validator = new Zend_Validate_File_IsCompressed([ 'image/gif', 'image/jpg', 'magicfile' => $magicFile, - 'headerCheck' => true)); + 'headerCheck' => true]); $this->assertEquals($magicFile, $validator->getMagicFile()); $this->assertTrue($validator->getHeaderCheck()); diff --git a/tests/Zend/Validate/File/IsImageTest.php b/tests/Zend/Validate/File/IsImageTest.php index b126f067cb..6c1b088463 100644 --- a/tests/Zend/Validate/File/IsImageTest.php +++ b/tests/Zend/Validate/File/IsImageTest.php @@ -60,23 +60,23 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array(null, true), - array('jpeg', true), - array('test/notype', false), - array('image/gif, image/jpeg', true), - array(array('image/vasa', 'image/jpeg'), true), - array(array('image/jpeg', 'gif'), true), - array(array('image/gif', 'gif'), false), - ); - - $files = array( + $valuesExpected = [ + [null, true], + ['jpeg', true], + ['test/notype', false], + ['image/gif, image/jpeg', true], + [['image/vasa', 'image/jpeg'], true], + [['image/jpeg', 'gif'], true], + [['image/gif', 'gif'], false], + ]; + + $files = [ 'name' => 'picture.jpg', 'type' => 'image/jpeg', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/picture.jpg', 'error' => 0 - ); + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_IsImage($element[0]); @@ -99,11 +99,11 @@ public function testGetMimeType() $validator = new Zend_Validate_File_IsImage('image/gif'); $this->assertEquals('image/gif', $validator->getMimeType()); - $validator = new Zend_Validate_File_IsImage(array('image/gif', 'video', 'text/test')); + $validator = new Zend_Validate_File_IsImage(['image/gif', 'video', 'text/test']); $this->assertEquals('image/gif,video,text/test', $validator->getMimeType()); - $validator = new Zend_Validate_File_IsImage(array('image/gif', 'video', 'text/test')); - $this->assertEquals(array('image/gif', 'video', 'text/test'), $validator->getMimeType(true)); + $validator = new Zend_Validate_File_IsImage(['image/gif', 'video', 'text/test']); + $this->assertEquals(['image/gif', 'video', 'text/test'], $validator->getMimeType(true)); } /** @@ -116,15 +116,15 @@ public function testSetMimeType() $validator = new Zend_Validate_File_IsImage('image/gif'); $validator->setMimeType('image/jpeg'); $this->assertEquals('image/jpeg', $validator->getMimeType()); - $this->assertEquals(array('image/jpeg'), $validator->getMimeType(true)); + $this->assertEquals(['image/jpeg'], $validator->getMimeType(true)); $validator->setMimeType('image/gif, text/test'); $this->assertEquals('image/gif,text/test', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text/test'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text/test'], $validator->getMimeType(true)); - $validator->setMimeType(array('video/mpeg', 'gif')); + $validator->setMimeType(['video/mpeg', 'gif']); $this->assertEquals('video/mpeg,gif', $validator->getMimeType()); - $this->assertEquals(array('video/mpeg', 'gif'), $validator->getMimeType(true)); + $this->assertEquals(['video/mpeg', 'gif'], $validator->getMimeType(true)); } /** @@ -137,19 +137,19 @@ public function testAddMimeType() $validator = new Zend_Validate_File_IsImage('image/gif'); $validator->addMimeType('text'); $this->assertEquals('image/gif,text', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text'], $validator->getMimeType(true)); $validator->addMimeType('jpg, to'); $this->assertEquals('image/gif,text,jpg,to', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to'], $validator->getMimeType(true)); - $validator->addMimeType(array('zip', 'ti')); + $validator->addMimeType(['zip', 'ti']); $this->assertEquals('image/gif,text,jpg,to,zip,ti', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to', 'zip', 'ti'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to', 'zip', 'ti'], $validator->getMimeType(true)); $validator->addMimeType(''); $this->assertEquals('image/gif,text,jpg,to,zip,ti', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to', 'zip', 'ti'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to', 'zip', 'ti'], $validator->getMimeType(true)); } /** @@ -157,13 +157,13 @@ public function testAddMimeType() */ public function testErrorMessages() { - $files = array( + $files = [ 'name' => 'picture.jpg', 'type' => 'image/jpeg', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/picture.jpg', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_IsImage('test/notype'); $validator->enableHeaderCheck(); @@ -184,11 +184,11 @@ public function testOptionsAtConstructor() $magicFile = dirname(__FILE__) . '/_files/magic.mime'; } - $validator = new Zend_Validate_File_IsImage(array( + $validator = new Zend_Validate_File_IsImage([ 'image/gif', 'image/jpg', 'magicfile' => $magicFile, - 'headerCheck' => true)); + 'headerCheck' => true]); $this->assertEquals($magicFile, $validator->getMagicFile()); $this->assertTrue($validator->getHeaderCheck()); diff --git a/tests/Zend/Validate/File/Md5Test.php b/tests/Zend/Validate/File/Md5Test.php index 55b62f6456..64e36a04cb 100644 --- a/tests/Zend/Validate/File/Md5Test.php +++ b/tests/Zend/Validate/File/Md5Test.php @@ -60,12 +60,12 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array('ed74c22109fe9f110579f77b053b8bc3', true), - array('4d74c22109fe9f110579f77b053b8bc3', false), - array(array('4d74c22109fe9f110579f77b053b8bc3', 'ed74c22109fe9f110579f77b053b8bc3'), true), - array(array('4d74c22109fe9f110579f77b053b8bc3', '7d74c22109fe9f110579f77b053b8bc3'), false), - ); + $valuesExpected = [ + ['ed74c22109fe9f110579f77b053b8bc3', true], + ['4d74c22109fe9f110579f77b053b8bc3', false], + [['4d74c22109fe9f110579f77b053b8bc3', 'ed74c22109fe9f110579f77b053b8bc3'], true], + [['4d74c22109fe9f110579f77b053b8bc3', '7d74c22109fe9f110579f77b053b8bc3'], false], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Md5($element[0]); @@ -80,34 +80,34 @@ public function testBasic() $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/nofile.mo')); $this->assertTrue(array_key_exists('fileMd5NotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Md5('ed74c22109fe9f110579f77b053b8bc3'); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/nofile.mo', $files)); $this->assertTrue(array_key_exists('fileMd5NotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Md5('ed74c22109fe9f110579f77b053b8bc3'); $this->assertTrue($validator->isValid(dirname(__FILE__) . '/_files/picture.jpg', $files)); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Md5('7d74c22109fe9f110579f77b053b8bc3'); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/picture.jpg', $files)); $this->assertTrue(array_key_exists('fileMd5DoesNotMatch', $validator->getMessages())); @@ -121,10 +121,10 @@ public function testBasic() public function testgetMd5() { $validator = new Zend_Validate_File_Md5('12345'); - $this->assertEquals(array('12345' => 'md5'), $validator->getMd5()); + $this->assertEquals(['12345' => 'md5'], $validator->getMd5()); - $validator = new Zend_Validate_File_Md5(array('12345', '12333', '12344')); - $this->assertEquals(array('12345' => 'md5', '12333' => 'md5', '12344' => 'md5'), $validator->getMd5()); + $validator = new Zend_Validate_File_Md5(['12345', '12333', '12344']); + $this->assertEquals(['12345' => 'md5', '12333' => 'md5', '12344' => 'md5'], $validator->getMd5()); } /** @@ -135,10 +135,10 @@ public function testgetMd5() public function testgetHash() { $validator = new Zend_Validate_File_Md5('12345'); - $this->assertEquals(array('12345' => 'md5'), $validator->getHash()); + $this->assertEquals(['12345' => 'md5'], $validator->getHash()); - $validator = new Zend_Validate_File_Md5(array('12345', '12333', '12344')); - $this->assertEquals(array('12345' => 'md5', '12333' => 'md5', '12344' => 'md5'), $validator->getHash()); + $validator = new Zend_Validate_File_Md5(['12345', '12333', '12344']); + $this->assertEquals(['12345' => 'md5', '12333' => 'md5', '12344' => 'md5'], $validator->getHash()); } /** @@ -150,10 +150,10 @@ public function testSetMd5() { $validator = new Zend_Validate_File_Md5('12345'); $validator->setMd5('12333'); - $this->assertEquals(array('12333' => 'md5'), $validator->getMd5()); + $this->assertEquals(['12333' => 'md5'], $validator->getMd5()); - $validator->setMd5(array('12321', '12121')); - $this->assertEquals(array('12321' => 'md5', '12121' => 'md5'), $validator->getMd5()); + $validator->setMd5(['12321', '12121']); + $this->assertEquals(['12321' => 'md5', '12121' => 'md5'], $validator->getMd5()); } /** @@ -165,10 +165,10 @@ public function testSetHash() { $validator = new Zend_Validate_File_Md5('12345'); $validator->setHash('12333'); - $this->assertEquals(array('12333' => 'md5'), $validator->getMd5()); + $this->assertEquals(['12333' => 'md5'], $validator->getMd5()); - $validator->setHash(array('12321', '12121')); - $this->assertEquals(array('12321' => 'md5', '12121' => 'md5'), $validator->getMd5()); + $validator->setHash(['12321', '12121']); + $this->assertEquals(['12321' => 'md5', '12121' => 'md5'], $validator->getMd5()); } /** @@ -180,10 +180,10 @@ public function testAddMd5() { $validator = new Zend_Validate_File_Md5('12345'); $validator->addMd5('12344'); - $this->assertEquals(array('12345' => 'md5', '12344' => 'md5'), $validator->getMd5()); + $this->assertEquals(['12345' => 'md5', '12344' => 'md5'], $validator->getMd5()); - $validator->addMd5(array('12321', '12121')); - $this->assertEquals(array('12345' => 'md5', '12344' => 'md5', '12321' => 'md5', '12121' => 'md5'), $validator->getMd5()); + $validator->addMd5(['12321', '12121']); + $this->assertEquals(['12345' => 'md5', '12344' => 'md5', '12321' => 'md5', '12121' => 'md5'], $validator->getMd5()); } /** @@ -195,10 +195,10 @@ public function testAddHash() { $validator = new Zend_Validate_File_Md5('12345'); $validator->addHash('12344'); - $this->assertEquals(array('12345' => 'md5', '12344' => 'md5'), $validator->getMd5()); + $this->assertEquals(['12345' => 'md5', '12344' => 'md5'], $validator->getMd5()); - $validator->addHash(array('12321', '12121')); - $this->assertEquals(array('12345' => 'md5', '12344' => 'md5', '12321' => 'md5', '12121' => 'md5'), $validator->getMd5()); + $validator->addHash(['12321', '12121']); + $this->assertEquals(['12345' => 'md5', '12344' => 'md5', '12321' => 'md5', '12121' => 'md5'], $validator->getMd5()); } } diff --git a/tests/Zend/Validate/File/MimeTypeTest.php b/tests/Zend/Validate/File/MimeTypeTest.php index d16db73815..1c25756fcf 100644 --- a/tests/Zend/Validate/File/MimeTypeTest.php +++ b/tests/Zend/Validate/File/MimeTypeTest.php @@ -60,27 +60,27 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array(array('image/jpg', 'image/jpeg'), true), - array('image', true), - array('test/notype', false), - array('image/gif, image/jpg, image/jpeg', true), - array(array('image/vasa', 'image/jpg', 'image/jpeg'), true), - array(array('image/jpg', 'image/jpeg', 'gif'), true), - array(array('image/gif', 'gif'), false), - array('image/jp', false), - array('image/jpg2000', false), - array('image/jpeg2000', false), - ); + $valuesExpected = [ + [['image/jpg', 'image/jpeg'], true], + ['image', true], + ['test/notype', false], + ['image/gif, image/jpg, image/jpeg', true], + [['image/vasa', 'image/jpg', 'image/jpeg'], true], + [['image/jpg', 'image/jpeg', 'gif'], true], + [['image/gif', 'gif'], false], + ['image/jp', false], + ['image/jpg2000', false], + ['image/jpeg2000', false], + ]; $filetest = dirname(__FILE__) . '/_files/picture.jpg'; - $files = array( + $files = [ 'name' => 'picture.jpg', 'type' => 'image/jpg', 'size' => 200, 'tmp_name' => $filetest, 'error' => 0 - ); + ]; foreach ($valuesExpected as $element) { $options = array_shift($element); @@ -106,11 +106,11 @@ public function testGetMimeType() $validator = new Zend_Validate_File_MimeType('image/gif'); $this->assertEquals('image/gif', $validator->getMimeType()); - $validator = new Zend_Validate_File_MimeType(array('image/gif', 'video', 'text/test')); + $validator = new Zend_Validate_File_MimeType(['image/gif', 'video', 'text/test']); $this->assertEquals('image/gif,video,text/test', $validator->getMimeType()); - $validator = new Zend_Validate_File_MimeType(array('image/gif', 'video', 'text/test')); - $this->assertEquals(array('image/gif', 'video', 'text/test'), $validator->getMimeType(true)); + $validator = new Zend_Validate_File_MimeType(['image/gif', 'video', 'text/test']); + $this->assertEquals(['image/gif', 'video', 'text/test'], $validator->getMimeType(true)); } /** @@ -123,15 +123,15 @@ public function testSetMimeType() $validator = new Zend_Validate_File_MimeType('image/gif'); $validator->setMimeType('image/jpeg'); $this->assertEquals('image/jpeg', $validator->getMimeType()); - $this->assertEquals(array('image/jpeg'), $validator->getMimeType(true)); + $this->assertEquals(['image/jpeg'], $validator->getMimeType(true)); $validator->setMimeType('image/gif, text/test'); $this->assertEquals('image/gif,text/test', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text/test'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text/test'], $validator->getMimeType(true)); - $validator->setMimeType(array('video/mpeg', 'gif')); + $validator->setMimeType(['video/mpeg', 'gif']); $this->assertEquals('video/mpeg,gif', $validator->getMimeType()); - $this->assertEquals(array('video/mpeg', 'gif'), $validator->getMimeType(true)); + $this->assertEquals(['video/mpeg', 'gif'], $validator->getMimeType(true)); } /** @@ -144,19 +144,19 @@ public function testAddMimeType() $validator = new Zend_Validate_File_MimeType('image/gif'); $validator->addMimeType('text'); $this->assertEquals('image/gif,text', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text'], $validator->getMimeType(true)); $validator->addMimeType('jpg, to'); $this->assertEquals('image/gif,text,jpg,to', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to'], $validator->getMimeType(true)); - $validator->addMimeType(array('zip', 'ti')); + $validator->addMimeType(['zip', 'ti']); $this->assertEquals('image/gif,text,jpg,to,zip,ti', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to', 'zip', 'ti'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to', 'zip', 'ti'], $validator->getMimeType(true)); $validator->addMimeType(''); $this->assertEquals('image/gif,text,jpg,to,zip,ti', $validator->getMimeType()); - $this->assertEquals(array('image/gif', 'text', 'jpg', 'to', 'zip', 'ti'), $validator->getMimeType(true)); + $this->assertEquals(['image/gif', 'text', 'jpg', 'to', 'zip', 'ti'], $validator->getMimeType(true)); } public function testSetAndGetMagicFile() @@ -178,7 +178,7 @@ public function testSetMagicFileWithinConstructor() { require_once 'Zend/Validate/Exception.php'; try { - $validator = new Zend_Validate_File_MimeType(array('image/gif', 'magicfile' => __FILE__)); + $validator = new Zend_Validate_File_MimeType(['image/gif', 'magicfile' => __FILE__]); $this->fail('Zend_Validate_File_MimeType should not accept invalid magic file.'); } catch (Zend_Validate_Exception $e) { // @ZF-9320: False Magic File is not allowed to be set @@ -187,10 +187,10 @@ public function testSetMagicFileWithinConstructor() public function testOptionsAtConstructor() { - $validator = new Zend_Validate_File_MimeType(array( + $validator = new Zend_Validate_File_MimeType([ 'image/gif', 'image/jpg', - 'headerCheck' => true)); + 'headerCheck' => true]); $this->assertTrue($validator->getHeaderCheck()); $this->assertEquals('image/gif,image/jpg', $validator->getMimeType()); @@ -201,18 +201,18 @@ public function testOptionsAtConstructor() */ public function testDualValidation() { - $valuesExpected = array( - array('image', true), - ); + $valuesExpected = [ + ['image', true], + ]; $filetest = dirname(__FILE__) . '/_files/picture.jpg'; - $files = array( + $files = [ 'name' => 'picture.jpg', 'type' => 'image/jpg', 'size' => 200, 'tmp_name' => $filetest, 'error' => 0 - ); + ]; foreach ($valuesExpected as $element) { $options = array_shift($element); @@ -262,14 +262,14 @@ public function testDisablingTryCommonMagicFilesIgnoresCommonLocations() } $filetest = dirname(__FILE__) . '/_files/picture.jpg'; - $files = array( + $files = [ 'name' => 'picture.jpg', 'size' => 200, 'tmp_name' => $filetest, 'error' => 0 - ); + ]; - $validator = new Zend_Validate_File_MimeType(array('image/jpeg', 'image/jpeg; charset=binary')); + $validator = new Zend_Validate_File_MimeType(['image/jpeg', 'image/jpeg; charset=binary']); $goodEnvironment = $validator->isValid($filetest, $files); @@ -284,7 +284,7 @@ public function testDisablingTryCommonMagicFilesIgnoresCommonLocations() // Note that if this branch of code is entered then testBasic, testDualValidation, // as well as Zend_Validate_File_IsCompressedTest::testBasic and Zend_Validate_File_IsImageTest::testBasic // will be failing as well. - $validator = new Zend_Validate_File_MimeType(array('image/jpeg', 'image/jpeg; charset=binary')); + $validator = new Zend_Validate_File_MimeType(['image/jpeg', 'image/jpeg; charset=binary']); $validator->setTryCommonMagicFilesFlag(false); $this->assertTrue($validator->isValid($filetest, $files)); } diff --git a/tests/Zend/Validate/File/NotExistsTest.php b/tests/Zend/Validate/File/NotExistsTest.php index cc459983c2..fdb0030fa6 100644 --- a/tests/Zend/Validate/File/NotExistsTest.php +++ b/tests/Zend/Validate/File/NotExistsTest.php @@ -61,18 +61,18 @@ public static function main() public function testBasic() { $baseDir = dirname(__FILE__); - $valuesExpected = array( - array($baseDir, 'testsize.mo', true), - array($baseDir . '/_files', 'testsize.mo', false) - ); + $valuesExpected = [ + [$baseDir, 'testsize.mo', true], + [$baseDir . '/_files', 'testsize.mo', false] + ]; - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_NotExists($element[0]); @@ -88,19 +88,19 @@ public function testBasic() ); } - $valuesExpected = array( - array($baseDir, 'testsize.mo', true, false), - array($baseDir . '/_files', 'testsize.mo', false, false) - ); + $valuesExpected = [ + [$baseDir, 'testsize.mo', true, false], + [$baseDir . '/_files', 'testsize.mo', false, false] + ]; - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0, 'destination' => dirname(__FILE__) . '/_files' - ); + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_NotExists($element[0]); @@ -116,10 +116,10 @@ public function testBasic() ); } - $valuesExpected = array( - array($baseDir, 'testsize.mo', false, false), - array($baseDir . '/_files', 'testsize.mo', false, false) - ); + $valuesExpected = [ + [$baseDir, 'testsize.mo', false, false], + [$baseDir . '/_files', 'testsize.mo', false, false] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_NotExists(); @@ -146,11 +146,11 @@ public function testGetDirectory() $validator = new Zend_Validate_File_NotExists('C:/temp'); $this->assertEquals('C:/temp', $validator->getDirectory()); - $validator = new Zend_Validate_File_NotExists(array('temp', 'dir', 'jpg')); + $validator = new Zend_Validate_File_NotExists(['temp', 'dir', 'jpg']); $this->assertEquals('temp,dir,jpg', $validator->getDirectory()); - $validator = new Zend_Validate_File_NotExists(array('temp', 'dir', 'jpg')); - $this->assertEquals(array('temp', 'dir', 'jpg'), $validator->getDirectory(true)); + $validator = new Zend_Validate_File_NotExists(['temp', 'dir', 'jpg']); + $this->assertEquals(['temp', 'dir', 'jpg'], $validator->getDirectory(true)); } /** @@ -163,15 +163,15 @@ public function testSetDirectory() $validator = new Zend_Validate_File_NotExists('temp'); $validator->setDirectory('gif'); $this->assertEquals('gif', $validator->getDirectory()); - $this->assertEquals(array('gif'), $validator->getDirectory(true)); + $this->assertEquals(['gif'], $validator->getDirectory(true)); $validator->setDirectory('jpg, temp'); $this->assertEquals('jpg,temp', $validator->getDirectory()); - $this->assertEquals(array('jpg', 'temp'), $validator->getDirectory(true)); + $this->assertEquals(['jpg', 'temp'], $validator->getDirectory(true)); - $validator->setDirectory(array('zip', 'ti')); + $validator->setDirectory(['zip', 'ti']); $this->assertEquals('zip,ti', $validator->getDirectory()); - $this->assertEquals(array('zip', 'ti'), $validator->getDirectory(true)); + $this->assertEquals(['zip', 'ti'], $validator->getDirectory(true)); } /** @@ -184,19 +184,19 @@ public function testAddDirectory() $validator = new Zend_Validate_File_NotExists('temp'); $validator->addDirectory('gif'); $this->assertEquals('temp,gif', $validator->getDirectory()); - $this->assertEquals(array('temp', 'gif'), $validator->getDirectory(true)); + $this->assertEquals(['temp', 'gif'], $validator->getDirectory(true)); $validator->addDirectory('jpg, to'); $this->assertEquals('temp,gif,jpg,to', $validator->getDirectory()); - $this->assertEquals(array('temp', 'gif', 'jpg', 'to'), $validator->getDirectory(true)); + $this->assertEquals(['temp', 'gif', 'jpg', 'to'], $validator->getDirectory(true)); - $validator->addDirectory(array('zip', 'ti')); + $validator->addDirectory(['zip', 'ti']); $this->assertEquals('temp,gif,jpg,to,zip,ti', $validator->getDirectory()); - $this->assertEquals(array('temp', 'gif', 'jpg', 'to', 'zip', 'ti'), $validator->getDirectory(true)); + $this->assertEquals(['temp', 'gif', 'jpg', 'to', 'zip', 'ti'], $validator->getDirectory(true)); $validator->addDirectory(''); $this->assertEquals('temp,gif,jpg,to,zip,ti', $validator->getDirectory()); - $this->assertEquals(array('temp', 'gif', 'jpg', 'to', 'zip', 'ti'), $validator->getDirectory(true)); + $this->assertEquals(['temp', 'gif', 'jpg', 'to', 'zip', 'ti'], $validator->getDirectory(true)); } } diff --git a/tests/Zend/Validate/File/Sha1Test.php b/tests/Zend/Validate/File/Sha1Test.php index b89a389cd0..ca95c06a87 100644 --- a/tests/Zend/Validate/File/Sha1Test.php +++ b/tests/Zend/Validate/File/Sha1Test.php @@ -60,12 +60,12 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array('b2a5334847b4328e7d19d9b41fd874dffa911c98', true), - array('52a5334847b4328e7d19d9b41fd874dffa911c98', false), - array(array('42a5334847b4328e7d19d9b41fd874dffa911c98', 'b2a5334847b4328e7d19d9b41fd874dffa911c98'), true), - array(array('42a5334847b4328e7d19d9b41fd874dffa911c98', '72a5334847b4328e7d19d9b41fd874dffa911c98'), false), - ); + $valuesExpected = [ + ['b2a5334847b4328e7d19d9b41fd874dffa911c98', true], + ['52a5334847b4328e7d19d9b41fd874dffa911c98', false], + [['42a5334847b4328e7d19d9b41fd874dffa911c98', 'b2a5334847b4328e7d19d9b41fd874dffa911c98'], true], + [['42a5334847b4328e7d19d9b41fd874dffa911c98', '72a5334847b4328e7d19d9b41fd874dffa911c98'], false], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_Sha1($element[0]); @@ -80,34 +80,34 @@ public function testBasic() $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/nofile.mo')); $this->assertTrue(array_key_exists('fileSha1NotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Sha1('b2a5334847b4328e7d19d9b41fd874dffa911c98'); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/nofile.mo', $files)); $this->assertTrue(array_key_exists('fileSha1NotFound', $validator->getMessages())); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Sha1('b2a5334847b4328e7d19d9b41fd874dffa911c98'); $this->assertTrue($validator->isValid(dirname(__FILE__) . '/_files/picture.jpg', $files)); - $files = array( + $files = [ 'name' => 'testsize.mo', 'type' => 'text', 'size' => 200, 'tmp_name' => dirname(__FILE__) . '/_files/testsize.mo', 'error' => 0 - ); + ]; $validator = new Zend_Validate_File_Sha1('42a5334847b4328e7d19d9b41fd874dffa911c98'); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/picture.jpg', $files)); $this->assertTrue(array_key_exists('fileSha1DoesNotMatch', $validator->getMessages())); @@ -121,10 +121,10 @@ public function testBasic() public function testgetSha1() { $validator = new Zend_Validate_File_Sha1('12345'); - $this->assertEquals(array('12345' => 'sha1'), $validator->getSha1()); + $this->assertEquals(['12345' => 'sha1'], $validator->getSha1()); - $validator = new Zend_Validate_File_Sha1(array('12345', '12333', '12344')); - $this->assertEquals(array('12345' => 'sha1', '12333' => 'sha1', '12344' => 'sha1'), $validator->getSha1()); + $validator = new Zend_Validate_File_Sha1(['12345', '12333', '12344']); + $this->assertEquals(['12345' => 'sha1', '12333' => 'sha1', '12344' => 'sha1'], $validator->getSha1()); } /** @@ -135,10 +135,10 @@ public function testgetSha1() public function testgetHash() { $validator = new Zend_Validate_File_Sha1('12345'); - $this->assertEquals(array('12345' => 'sha1'), $validator->getHash()); + $this->assertEquals(['12345' => 'sha1'], $validator->getHash()); - $validator = new Zend_Validate_File_Sha1(array('12345', '12333', '12344')); - $this->assertEquals(array('12345' => 'sha1', '12333' => 'sha1', '12344' => 'sha1'), $validator->getHash()); + $validator = new Zend_Validate_File_Sha1(['12345', '12333', '12344']); + $this->assertEquals(['12345' => 'sha1', '12333' => 'sha1', '12344' => 'sha1'], $validator->getHash()); } /** @@ -150,10 +150,10 @@ public function testSetSha1() { $validator = new Zend_Validate_File_Sha1('12345'); $validator->setSha1('12333'); - $this->assertEquals(array('12333' => 'sha1'), $validator->getSha1()); + $this->assertEquals(['12333' => 'sha1'], $validator->getSha1()); - $validator->setSha1(array('12321', '12121')); - $this->assertEquals(array('12321' => 'sha1', '12121' => 'sha1'), $validator->getSha1()); + $validator->setSha1(['12321', '12121']); + $this->assertEquals(['12321' => 'sha1', '12121' => 'sha1'], $validator->getSha1()); } /** @@ -165,10 +165,10 @@ public function testSetHash() { $validator = new Zend_Validate_File_Sha1('12345'); $validator->setHash('12333'); - $this->assertEquals(array('12333' => 'sha1'), $validator->getSha1()); + $this->assertEquals(['12333' => 'sha1'], $validator->getSha1()); - $validator->setHash(array('12321', '12121')); - $this->assertEquals(array('12321' => 'sha1', '12121' => 'sha1'), $validator->getSha1()); + $validator->setHash(['12321', '12121']); + $this->assertEquals(['12321' => 'sha1', '12121' => 'sha1'], $validator->getSha1()); } /** @@ -180,10 +180,10 @@ public function testAddSha1() { $validator = new Zend_Validate_File_Sha1('12345'); $validator->addSha1('12344'); - $this->assertEquals(array('12345' => 'sha1', '12344' => 'sha1'), $validator->getSha1()); + $this->assertEquals(['12345' => 'sha1', '12344' => 'sha1'], $validator->getSha1()); - $validator->addSha1(array('12321', '12121')); - $this->assertEquals(array('12345' => 'sha1', '12344' => 'sha1', '12321' => 'sha1', '12121' => 'sha1'), $validator->getSha1()); + $validator->addSha1(['12321', '12121']); + $this->assertEquals(['12345' => 'sha1', '12344' => 'sha1', '12321' => 'sha1', '12121' => 'sha1'], $validator->getSha1()); } /** @@ -195,10 +195,10 @@ public function testAddHash() { $validator = new Zend_Validate_File_Sha1('12345'); $validator->addHash('12344'); - $this->assertEquals(array('12345' => 'sha1', '12344' => 'sha1'), $validator->getSha1()); + $this->assertEquals(['12345' => 'sha1', '12344' => 'sha1'], $validator->getSha1()); - $validator->addHash(array('12321', '12121')); - $this->assertEquals(array('12345' => 'sha1', '12344' => 'sha1', '12321' => 'sha1', '12121' => 'sha1'), $validator->getSha1()); + $validator->addHash(['12321', '12121']); + $this->assertEquals(['12345' => 'sha1', '12344' => 'sha1', '12321' => 'sha1', '12121' => 'sha1'], $validator->getSha1()); } } diff --git a/tests/Zend/Validate/File/SizeTest.php b/tests/Zend/Validate/File/SizeTest.php index faf48574da..039627df7c 100644 --- a/tests/Zend/Validate/File/SizeTest.php +++ b/tests/Zend/Validate/File/SizeTest.php @@ -58,17 +58,17 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array(array('min' => 0, 'max' => 10000), true), - array(array('min' => 0, 'max' => '10 MB'), true), - array(array('min' => '4B', 'max' => '10 MB'), true), - array(array('min' => 0, 'max' => '10MB'), true), - array(array('min' => 0, 'max' => '10 MB'), true), - array(794, true), - array(array('min' => 794), true), - array(array('min' => 0, 'max' => 500), false), - array(500, false), - ); + $valuesExpected = [ + [['min' => 0, 'max' => 10000], true], + [['min' => 0, 'max' => '10 MB'], true], + [['min' => '4B', 'max' => '10 MB'], true], + [['min' => 0, 'max' => '10MB'], true], + [['min' => 0, 'max' => '10 MB'], true], + [794, true], + [['min' => 794], true], + [['min' => 0, 'max' => 500], false], + [500, false], + ]; foreach ($valuesExpected as $element) { $options = array_shift($element); @@ -89,17 +89,17 @@ public function testBasic() */ public function testGetMin() { - $validator = new Zend_Validate_File_Size(array('min' => 1, 'max' => 100)); + $validator = new Zend_Validate_File_Size(['min' => 1, 'max' => 100]); $this->assertEquals('1B', $validator->getMin()); try { - $validator = new Zend_Validate_File_Size(array('min' => 100, 'max' => 1)); + $validator = new Zend_Validate_File_Size(['min' => 100, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); } - $validator = new Zend_Validate_File_Size(array('min' => 1, 'max' => 100, 'bytestring' => false)); + $validator = new Zend_Validate_File_Size(['min' => 1, 'max' => 100, 'bytestring' => false]); $this->assertEquals(1, $validator->getMin()); } @@ -110,7 +110,7 @@ public function testGetMin() */ public function testSetMin() { - $validator = new Zend_Validate_File_Size(array('min' => 1000, 'max' => 10000)); + $validator = new Zend_Validate_File_Size(['min' => 1000, 'max' => 10000]); $validator->setMin(100); $this->assertEquals('100B', $validator->getMin()); @@ -121,7 +121,7 @@ public function testSetMin() $this->assertContains("less than or equal", $e->getMessage()); } - $validator = new Zend_Validate_File_Size(array('min' => 1000, 'max' => 10000, 'bytestring' => false)); + $validator = new Zend_Validate_File_Size(['min' => 1000, 'max' => 10000, 'bytestring' => false]); $validator->setMin(100); $this->assertEquals(100, $validator->getMin()); } @@ -133,17 +133,17 @@ public function testSetMin() */ public function testGetMax() { - $validator = new Zend_Validate_File_Size(array('min' => 1, 'max' => 100, 'bytestring' => false)); + $validator = new Zend_Validate_File_Size(['min' => 1, 'max' => 100, 'bytestring' => false]); $this->assertEquals(100, $validator->getMax()); try { - $validator = new Zend_Validate_File_Size(array('min' => 100, 'max' => 1)); + $validator = new Zend_Validate_File_Size(['min' => 100, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); } - $validator = new Zend_Validate_File_Size(array('min' => 1, 'max' => 100000)); + $validator = new Zend_Validate_File_Size(['min' => 1, 'max' => 100000]); $this->assertEquals('97.66kB', $validator->getMax()); $validator = new Zend_Validate_File_Size(2000); @@ -157,7 +157,7 @@ public function testGetMax() */ public function testSetMax() { - $validator = new Zend_Validate_File_Size(array('max' => 0, 'bytestring' => true)); + $validator = new Zend_Validate_File_Size(['max' => 0, 'bytestring' => true]); $this->assertEquals('0B', $validator->getMax()); $validator->setMax(1000000); @@ -201,12 +201,12 @@ public function testSetMax() */ public function testFailureMessage() { - $validator = new Zend_Validate_File_Size(array('min' => 9999, 'max' => 10000)); + $validator = new Zend_Validate_File_Size(['min' => 9999, 'max' => 10000]); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/testsize.mo')); $this->assertContains('9.76kB', current($validator->getMessages())); $this->assertContains('794B', current($validator->getMessages())); - $validator = new Zend_Validate_File_Size(array('min' => 9999, 'max' => 10000, 'bytestring' => false)); + $validator = new Zend_Validate_File_Size(['min' => 9999, 'max' => 10000, 'bytestring' => false]); $this->assertFalse($validator->isValid(dirname(__FILE__) . '/_files/testsize.mo')); $this->assertContains('9999', current($validator->getMessages())); $this->assertContains('794', current($validator->getMessages())); diff --git a/tests/Zend/Validate/File/UploadTest.php b/tests/Zend/Validate/File/UploadTest.php index bce4a628a0..823b2ec58e 100644 --- a/tests/Zend/Validate/File/UploadTest.php +++ b/tests/Zend/Validate/File/UploadTest.php @@ -58,62 +58,62 @@ public static function main() */ public function testBasic() { - $_FILES = array( - 'test' => array( + $_FILES = [ + 'test' => [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', - 'error' => 0), - 'test2' => array( + 'error' => 0], + 'test2' => [ 'name' => 'test2', 'type' => 'text2', 'size' => 202, 'tmp_name' => 'tmp_test2', - 'error' => 1), - 'test3' => array( + 'error' => 1], + 'test3' => [ 'name' => 'test3', 'type' => 'text3', 'size' => 203, 'tmp_name' => 'tmp_test3', - 'error' => 2), - 'test4' => array( + 'error' => 2], + 'test4' => [ 'name' => 'test4', 'type' => 'text4', 'size' => 204, 'tmp_name' => 'tmp_test4', - 'error' => 3), - 'test5' => array( + 'error' => 3], + 'test5' => [ 'name' => 'test5', 'type' => 'text5', 'size' => 205, 'tmp_name' => 'tmp_test5', - 'error' => 4), - 'test6' => array( + 'error' => 4], + 'test6' => [ 'name' => 'test6', 'type' => 'text6', 'size' => 206, 'tmp_name' => 'tmp_test6', - 'error' => 5), - 'test7' => array( + 'error' => 5], + 'test7' => [ 'name' => 'test7', 'type' => 'text7', 'size' => 207, 'tmp_name' => 'tmp_test7', - 'error' => 6), - 'test8' => array( + 'error' => 6], + 'test8' => [ 'name' => 'test8', 'type' => 'text8', 'size' => 208, 'tmp_name' => 'tmp_test8', - 'error' => 7), - 'test9' => array( + 'error' => 7], + 'test9' => [ 'name' => 'test9', 'type' => 'text9', 'size' => 209, 'tmp_name' => 'tmp_test9', - 'error' => 8) - ); + 'error' => 8] + ]; $validator = new Zend_Validate_File_Upload(); $this->assertFalse($validator->isValid('test')); @@ -171,35 +171,35 @@ public function testBasic() */ public function testGetFiles() { - $_FILES = array( - 'test' => array( + $_FILES = [ + 'test' => [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', - 'error' => 0), - 'test2' => array( + 'error' => 0], + 'test2' => [ 'name' => 'test3', 'type' => 'text2', 'size' => 202, 'tmp_name' => 'tmp_test2', - 'error' => 1)); + 'error' => 1]]; - $files = array( - 'test' => array( + $files = [ + 'test' => [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', - 'error' => 0)); + 'error' => 0]]; - $files1 = array( - 'test2' => array( + $files1 = [ + 'test2' => [ 'name' => 'test3', 'type' => 'text2', 'size' => 202, 'tmp_name' => 'tmp_test2', - 'error' => 1)); + 'error' => 1]]; $validator = new Zend_Validate_File_Upload(); $this->assertEquals($files, $validator->getFiles('test')); @@ -207,7 +207,7 @@ public function testGetFiles() $this->assertEquals($files1, $validator->getFiles('test3')); try { - $this->assertEquals(array(), $validator->getFiles('test5')); + $this->assertEquals([], $validator->getFiles('test5')); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("was not found", $e->getMessage()); @@ -221,31 +221,31 @@ public function testGetFiles() */ public function testSetFiles() { - $files = array( - 'test' => array( + $files = [ + 'test' => [ 'name' => 'test1', 'type' => 'text', 'size' => 200, 'tmp_name' => 'tmp_test1', - 'error' => 0), - 'test2' => array( + 'error' => 0], + 'test2' => [ 'name' => 'test2', 'type' => 'text2', 'size' => 202, 'tmp_name' => 'tmp_test2', - 'error' => 1)); + 'error' => 1]]; - $_FILES = array( - 'test' => array( + $_FILES = [ + 'test' => [ 'name' => 'test3', 'type' => 'text3', 'size' => 203, 'tmp_name' => 'tmp_test3', - 'error' => 2)); + 'error' => 2]]; $validator = new Zend_Validate_File_Upload(); - $validator->setFiles(array()); + $validator->setFiles([]); $this->assertEquals($_FILES, $validator->getFiles()); $validator->setFiles(); $this->assertEquals($_FILES, $validator->getFiles()); @@ -261,7 +261,7 @@ public function testGetFilesReturnsEmptyArrayWhenFilesSuperglobalIsNull() $_FILES = NULL; $validator = new Zend_Validate_File_Upload(); $validator->setFiles(); - $this->assertEquals(array(), $validator->getFiles()); + $this->assertEquals([], $validator->getFiles()); } /** @@ -271,7 +271,7 @@ public function testGetFilesReturnsEmptyArrayAfterSetFilesIsCalledWithNull() { $validator = new Zend_Validate_File_Upload(); $validator->setFiles(NULL); - $this->assertEquals(array(), $validator->getFiles()); + $this->assertEquals([], $validator->getFiles()); } /** @@ -279,23 +279,23 @@ public function testGetFilesReturnsEmptyArrayAfterSetFilesIsCalledWithNull() */ public function testErrorMessage() { - $_FILES = array( - 'foo' => array( + $_FILES = [ + 'foo' => [ 'name' => 'bar', 'type' => 'text', 'size' => 100, 'tmp_name' => 'tmp_bar', 'error' => 7, - ) - ); + ] + ]; $validator = new Zend_Validate_File_Upload(); $validator->isValid('foo'); $this->assertEquals( - array( + [ 'fileUploadErrorCantWrite' => "File 'bar' can't be written", - ), + ], $validator->getMessages() ); } diff --git a/tests/Zend/Validate/File/WordCountTest.php b/tests/Zend/Validate/File/WordCountTest.php index da2e05202d..b0257beee1 100644 --- a/tests/Zend/Validate/File/WordCountTest.php +++ b/tests/Zend/Validate/File/WordCountTest.php @@ -58,12 +58,12 @@ public static function main() */ public function testBasic() { - $valuesExpected = array( - array(15, true), - array(4, false), - array(array('min' => 0, 'max' => 10), true), - array(array('min' => 10, 'max' => 15), false), - ); + $valuesExpected = [ + [15, true], + [4, false], + [['min' => 0, 'max' => 10], true], + [['min' => 10, 'max' => 15], false], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_File_WordCount($element[0]); @@ -82,21 +82,21 @@ public function testBasic() */ public function testGetMin() { - $validator = new Zend_Validate_File_WordCount(array('min' => 1, 'max' => 5)); + $validator = new Zend_Validate_File_WordCount(['min' => 1, 'max' => 5]); $this->assertEquals(1, $validator->getMin()); try { - $validator = new Zend_Validate_File_WordCount(array('min' => 5, 'max' => 1)); + $validator = new Zend_Validate_File_WordCount(['min' => 5, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); } - $validator = new Zend_Validate_File_WordCount(array('min' => 1, 'max' => 5)); + $validator = new Zend_Validate_File_WordCount(['min' => 1, 'max' => 5]); $this->assertEquals(1, $validator->getMin()); try { - $validator = new Zend_Validate_File_WordCount(array('min' => 5, 'max' => 1)); + $validator = new Zend_Validate_File_WordCount(['min' => 5, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); @@ -110,7 +110,7 @@ public function testGetMin() */ public function testSetMin() { - $validator = new Zend_Validate_File_WordCount(array('min' => 1000, 'max' => 10000)); + $validator = new Zend_Validate_File_WordCount(['min' => 1000, 'max' => 10000]); $validator->setMin(100); $this->assertEquals(100, $validator->getMin()); @@ -129,11 +129,11 @@ public function testSetMin() */ public function testGetMax() { - $validator = new Zend_Validate_File_WordCount(array('min' => 1, 'max' => 100)); + $validator = new Zend_Validate_File_WordCount(['min' => 1, 'max' => 100]); $this->assertEquals(100, $validator->getMax()); try { - $validator = new Zend_Validate_File_WordCount(array('min' => 5, 'max' => 1)); + $validator = new Zend_Validate_File_WordCount(['min' => 5, 'max' => 1]); $this->fail("Missing exception"); } catch (Zend_Validate_Exception $e) { $this->assertContains("greater than or equal", $e->getMessage()); @@ -147,7 +147,7 @@ public function testGetMax() */ public function testSetMax() { - $validator = new Zend_Validate_File_WordCount(array('min' => 1000, 'max' => 10000)); + $validator = new Zend_Validate_File_WordCount(['min' => 1000, 'max' => 10000]); $validator->setMax(1000000); $this->assertEquals(1000000, $validator->getMax()); diff --git a/tests/Zend/Validate/FloatTest.php b/tests/Zend/Validate/FloatTest.php index d4da25f0f0..7866fd4e58 100644 --- a/tests/Zend/Validate/FloatTest.php +++ b/tests/Zend/Validate/FloatTest.php @@ -63,7 +63,7 @@ public function tearDown() { //restore locale if (is_string($this->_locale) && strpos($this->_locale, ';')) { - $locales = array(); + $locales = []; foreach (explode(';', $this->_locale) as $l) { $tmp = explode('=', $l); $locales[$tmp[0]] = $tmp[1]; @@ -81,13 +81,13 @@ public function tearDown() */ public function testBasic() { - $valuesExpected = array( - array(1.00, true), - array(0.01, true), - array(-0.1, true), - array(1, true), - array('not a float', false), - ); + $valuesExpected = [ + [1.00, true], + [0.01, true], + [-0.1, true], + [1, true], + ['not a float', false], + ]; foreach ($valuesExpected as $element) { $this->assertEquals($element[1], $this->_validator->isValid($element[0])); } @@ -100,7 +100,7 @@ public function testBasic() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -118,7 +118,7 @@ public function testSettingLocales() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } /** diff --git a/tests/Zend/Validate/GreaterThanTest.php b/tests/Zend/Validate/GreaterThanTest.php index 469534e619..37a8212fa3 100644 --- a/tests/Zend/Validate/GreaterThanTest.php +++ b/tests/Zend/Validate/GreaterThanTest.php @@ -49,12 +49,12 @@ public function testBasic() * - expected validation result * - array of test input values */ - $valuesExpected = array( - array(0, true, array(0.01, 1, 100)), - array(0, false, array(0, 0.00, -0.01, -1, -100)), - array('a', true, array('b', 'c', 'd')), - array('z', false, array('x', 'y', 'z')) - ); + $valuesExpected = [ + [0, true, [0.01, 1, 100]], + [0, false, [0, 0.00, -0.01, -1, -100]], + ['a', true, ['b', 'c', 'd']], + ['z', false, ['x', 'y', 'z']] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_GreaterThan($element[0]); foreach ($element[2] as $input) { @@ -71,7 +71,7 @@ public function testBasic() public function testGetMessages() { $validator = new Zend_Validate_GreaterThan(10); - $this->assertEquals(array(), $validator->getMessages()); + $this->assertEquals([], $validator->getMessages()); } /** diff --git a/tests/Zend/Validate/HexTest.php b/tests/Zend/Validate/HexTest.php index f19e692c4b..1bc0eb77c1 100644 --- a/tests/Zend/Validate/HexTest.php +++ b/tests/Zend/Validate/HexTest.php @@ -60,17 +60,17 @@ public function setUp() */ public function testBasic() { - $valuesExpected = array( - array(1, true), - array(0x1, true), - array(0x123, true), - array('1', true), - array('abc123', true), - array('ABC123', true), - array('1234567890abcdef', true), - array('g', false), - array('1.2', false) - ); + $valuesExpected = [ + [1, true], + [0x1, true], + [0x123, true], + ['1', true], + ['abc123', true], + ['ABC123', true], + ['1234567890abcdef', true], + ['g', false], + ['1.2', false] + ]; foreach ($valuesExpected as $element) { $this->assertEquals($element[1], $this->_validator->isValid($element[0]), $element[0]); } @@ -83,7 +83,7 @@ public function testBasic() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -91,6 +91,6 @@ public function testGetMessages() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } } diff --git a/tests/Zend/Validate/HostnameTest.php b/tests/Zend/Validate/HostnameTest.php index d938e26778..366e612611 100644 --- a/tests/Zend/Validate/HostnameTest.php +++ b/tests/Zend/Validate/HostnameTest.php @@ -75,15 +75,15 @@ public function tearDown() */ public function testBasic() { - $valuesExpected = array( - array(Zend_Validate_Hostname::ALLOW_IP, true, array('1.2.3.4', '10.0.0.1', '255.255.255.255')), - array(Zend_Validate_Hostname::ALLOW_IP, false, array('1.2.3.4.5', '0.0.0.256')), - array(Zend_Validate_Hostname::ALLOW_DNS, true, array('example.com', 'example.museum', 'd.hatena.ne.jp')), - array(Zend_Validate_Hostname::ALLOW_DNS, false, array('localhost', 'localhost.localdomain', '1.2.3.4', 'domain.invalid')), - array(Zend_Validate_Hostname::ALLOW_LOCAL, true, array('localhost', 'localhost.localdomain', 'example.com')), - array(Zend_Validate_Hostname::ALLOW_ALL, true, array('localhost', 'example.com', '1.2.3.4')), - array(Zend_Validate_Hostname::ALLOW_LOCAL, false, array('local host', 'example,com', 'exam_ple.com')) - ); + $valuesExpected = [ + [Zend_Validate_Hostname::ALLOW_IP, true, ['1.2.3.4', '10.0.0.1', '255.255.255.255']], + [Zend_Validate_Hostname::ALLOW_IP, false, ['1.2.3.4.5', '0.0.0.256']], + [Zend_Validate_Hostname::ALLOW_DNS, true, ['example.com', 'example.museum', 'd.hatena.ne.jp']], + [Zend_Validate_Hostname::ALLOW_DNS, false, ['localhost', 'localhost.localdomain', '1.2.3.4', 'domain.invalid']], + [Zend_Validate_Hostname::ALLOW_LOCAL, true, ['localhost', 'localhost.localdomain', 'example.com']], + [Zend_Validate_Hostname::ALLOW_ALL, true, ['localhost', 'example.com', '1.2.3.4']], + [Zend_Validate_Hostname::ALLOW_LOCAL, false, ['local host', 'example,com', 'exam_ple.com']] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_Hostname($element[0]); foreach ($element[2] as $input) { @@ -94,12 +94,12 @@ public function testBasic() public function testCombination() { - $valuesExpected = array( - array(Zend_Validate_Hostname::ALLOW_DNS | Zend_Validate_Hostname::ALLOW_LOCAL, true, array('domain.com', 'localhost', 'local.localhost')), - array(Zend_Validate_Hostname::ALLOW_DNS | Zend_Validate_Hostname::ALLOW_LOCAL, false, array('1.2.3.4', '255.255.255.255')), - array(Zend_Validate_Hostname::ALLOW_DNS | Zend_Validate_Hostname::ALLOW_IP, true, array('1.2.3.4', '255.255.255.255')), - array(Zend_Validate_Hostname::ALLOW_DNS | Zend_Validate_Hostname::ALLOW_IP, false, array('localhost', 'local.localhost')) - ); + $valuesExpected = [ + [Zend_Validate_Hostname::ALLOW_DNS | Zend_Validate_Hostname::ALLOW_LOCAL, true, ['domain.com', 'localhost', 'local.localhost']], + [Zend_Validate_Hostname::ALLOW_DNS | Zend_Validate_Hostname::ALLOW_LOCAL, false, ['1.2.3.4', '255.255.255.255']], + [Zend_Validate_Hostname::ALLOW_DNS | Zend_Validate_Hostname::ALLOW_IP, true, ['1.2.3.4', '255.255.255.255']], + [Zend_Validate_Hostname::ALLOW_DNS | Zend_Validate_Hostname::ALLOW_IP, false, ['localhost', 'local.localhost']] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_Hostname($element[0]); foreach ($element[2] as $input) { @@ -114,10 +114,10 @@ public function testCombination() */ public function testDashes() { - $valuesExpected = array( - array(Zend_Validate_Hostname::ALLOW_DNS, true, array('domain.com', 'doma-in.com')), - array(Zend_Validate_Hostname::ALLOW_DNS, false, array('-domain.com', 'domain-.com', 'do--main.com')) - ); + $valuesExpected = [ + [Zend_Validate_Hostname::ALLOW_DNS, true, ['domain.com', 'doma-in.com']], + [Zend_Validate_Hostname::ALLOW_DNS, false, ['-domain.com', 'domain-.com', 'do--main.com']] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_Hostname($element[0]); foreach ($element[2] as $input) { @@ -133,7 +133,7 @@ public function testDashes() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -145,11 +145,11 @@ public function testIDN() $validator = new Zend_Validate_Hostname(); // Check IDN matching - $valuesExpected = array( - array(true, array('bürger.de', 'hãllo.de', 'hållo.se')), - array(true, array('bÜrger.de', 'hÃllo.de', 'hÅllo.se')), - array(false, array('hãllo.se', 'bürger.lt', 'hãllo.uk')) - ); + $valuesExpected = [ + [true, ['bürger.de', 'hãllo.de', 'hållo.se']], + [true, ['bÜrger.de', 'hÃllo.de', 'hÅllo.se']], + [false, ['hãllo.se', 'bürger.lt', 'hãllo.uk']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -158,9 +158,9 @@ public function testIDN() // Check no IDN matching $validator->setValidateIdn(false); - $valuesExpected = array( - array(false, array('bürger.de', 'hãllo.de', 'hållo.se')) - ); + $valuesExpected = [ + [false, ['bürger.de', 'hãllo.de', 'hållo.se']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -170,9 +170,9 @@ public function testIDN() // Check setting no IDN matching via constructor unset($validator); $validator = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_DNS, false); - $valuesExpected = array( - array(false, array('bürger.de', 'hãllo.de', 'hållo.se')) - ); + $valuesExpected = [ + [false, ['bürger.de', 'hãllo.de', 'hållo.se']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -189,11 +189,11 @@ public function testRessourceIDN() $validator = new Zend_Validate_Hostname(); // Check IDN matching - $valuesExpected = array( - array(true, array('bürger.com', 'hãllo.com', 'hållo.com')), - array(true, array('bÜrger.com', 'hÃllo.com', 'hÅllo.com')), - array(false, array('hãllo.lt', 'bürger.lt', 'hãllo.lt')) - ); + $valuesExpected = [ + [true, ['bürger.com', 'hãllo.com', 'hållo.com']], + [true, ['bÜrger.com', 'hÃllo.com', 'hÅllo.com']], + [false, ['hãllo.lt', 'bürger.lt', 'hãllo.lt']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -202,9 +202,9 @@ public function testRessourceIDN() // Check no IDN matching $validator->setValidateIdn(false); - $valuesExpected = array( - array(false, array('bürger.com', 'hãllo.com', 'hållo.com')) - ); + $valuesExpected = [ + [false, ['bürger.com', 'hãllo.com', 'hållo.com']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -214,9 +214,9 @@ public function testRessourceIDN() // Check setting no IDN matching via constructor unset($validator); $validator = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_DNS, false); - $valuesExpected = array( - array(false, array('bürger.com', 'hãllo.com', 'hållo.com')) - ); + $valuesExpected = [ + [false, ['bürger.com', 'hãllo.com', 'hållo.com']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -233,10 +233,10 @@ public function testTLD() $validator = new Zend_Validate_Hostname(); // Check TLD matching - $valuesExpected = array( - array(true, array('domain.co.uk', 'domain.uk.com', 'domain.tl', 'domain.zw', 'domain.menu', 'domain.versicherung')), - array(false, array('domain.xx', 'domain.zz', 'domain.madeup')) - ); + $valuesExpected = [ + [true, ['domain.co.uk', 'domain.uk.com', 'domain.tl', 'domain.zw', 'domain.menu', 'domain.versicherung']], + [false, ['domain.xx', 'domain.zz', 'domain.madeup']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -245,9 +245,9 @@ public function testTLD() // Check no TLD matching $validator->setValidateTld(false); - $valuesExpected = array( - array(true, array('domain.xx', 'domain.zz', 'domain.madeup')) - ); + $valuesExpected = [ + [true, ['domain.xx', 'domain.zz', 'domain.madeup']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -257,9 +257,9 @@ public function testTLD() // Check setting no TLD matching via constructor unset($validator); $validator = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_DNS, true, false); - $valuesExpected = array( - array(true, array('domain.xx', 'domain.zz', 'domain.madeup')) - ); + $valuesExpected = [ + [true, ['domain.xx', 'domain.zz', 'domain.madeup']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -286,9 +286,9 @@ public function testGetAllow() public function testValidatorMessagesShouldBeTranslated() { require_once 'Zend/Translate.php'; - $translations = array( + $translations = [ 'hostnameInvalidLocalName' => 'this is the IP error message', - ); + ]; $translator = new Zend_Translate('array', $translations); $this->_validator->setTranslator($translator); @@ -314,10 +314,10 @@ public function testNumberNames() $validator = new Zend_Validate_Hostname(); // Check TLD matching - $valuesExpected = array( - array(true, array('www.danger1.com', 'danger.com', 'www.danger.com')), - array(false, array('www.danger1com', 'dangercom', 'www.dangercom')) - ); + $valuesExpected = [ + [true, ['www.danger1.com', 'danger.com', 'www.danger.com']], + [false, ['www.danger1com', 'dangercom', 'www.dangercom']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -333,10 +333,10 @@ public function testPunycodeDecoding() $validator = new Zend_Validate_Hostname(); // Check TLD matching - $valuesExpected = array( - array(true, array('xn--brger-kva.com', 'xn--eckwd4c7cu47r2wf.jp')), - array(false, array('xn--brger-x45d2va.com', 'xn--bürger.com', 'xn--')) - ); + $valuesExpected = [ + [true, ['xn--brger-kva.com', 'xn--eckwd4c7cu47r2wf.jp']], + [false, ['xn--brger-x45d2va.com', 'xn--bürger.com', 'xn--']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -349,7 +349,7 @@ public function testPunycodeDecoding() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } /** @@ -374,11 +374,11 @@ public function testDifferentIconvEncoding() } $validator = new Zend_Validate_Hostname(); - $valuesExpected = array( - array(true, array('bürger.com', 'hãllo.com', 'hållo.com')), - array(true, array('bÜrger.com', 'hÃllo.com', 'hÅllo.com')), - array(false, array('hãllo.lt', 'bürger.lt', 'hãllo.lt')) - ); + $valuesExpected = [ + [true, ['bürger.com', 'hãllo.com', 'hållo.com']], + [true, ['bÜrger.com', 'hÃllo.com', 'hÅllo.com']], + [false, ['hãllo.lt', 'bürger.lt', 'hãllo.lt']] + ]; foreach ($valuesExpected as $element) { foreach ($element[1] as $input) { $this->assertEquals($element[0], $validator->isValid($input), implode("\n", $validator->getMessages()) . $input); @@ -399,10 +399,10 @@ public function testInvalidDoubledIdn() */ public function testURI() { - $valuesExpected = array( - array(Zend_Validate_Hostname::ALLOW_URI, true, array('localhost', 'example.com', '~ex%20ample')), - array(Zend_Validate_Hostname::ALLOW_URI, false, array('§bad', 'don?t.know', 'thisisaverylonghostnamewhichextendstwohundredfiftysixcharactersandthereforshouldnotbeallowedbythisvalidatorbecauserfc3986limitstheallowedcharacterstoalimitoftwohunderedfiftysixcharactersinsumbutifthistestwouldfailthenitshouldreturntruewhichthrowsanexceptionbytheunittest')), - ); + $valuesExpected = [ + [Zend_Validate_Hostname::ALLOW_URI, true, ['localhost', 'example.com', '~ex%20ample']], + [Zend_Validate_Hostname::ALLOW_URI, false, ['§bad', 'don?t.know', 'thisisaverylonghostnamewhichextendstwohundredfiftysixcharactersandthereforshouldnotbeallowedbythisvalidatorbecauserfc3986limitstheallowedcharacterstoalimitoftwohunderedfiftysixcharactersinsumbutifthistestwouldfailthenitshouldreturntruewhichthrowsanexceptionbytheunittest']], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_Hostname($element[0]); foreach ($element[2] as $input) { @@ -418,13 +418,13 @@ public function testURI() */ public function testTrailingDot() { - $valuesExpected = array( - array(Zend_Validate_Hostname::ALLOW_ALL, true, array('example.', 'example.com.', '~ex%20ample.com.')), - array(Zend_Validate_Hostname::ALLOW_ALL, false, array('example..',)), - array(Zend_Validate_Hostname::ALLOW_ALL, true, array('1.2.3.4.')), - array(Zend_Validate_Hostname::ALLOW_DNS, false, array('example..', '~ex%20ample..')), - array(Zend_Validate_Hostname::ALLOW_LOCAL, true, array('example.', 'example.com.')), - ); + $valuesExpected = [ + [Zend_Validate_Hostname::ALLOW_ALL, true, ['example.', 'example.com.', '~ex%20ample.com.']], + [Zend_Validate_Hostname::ALLOW_ALL, false, ['example..',]], + [Zend_Validate_Hostname::ALLOW_ALL, true, ['1.2.3.4.']], + [Zend_Validate_Hostname::ALLOW_DNS, false, ['example..', '~ex%20ample..']], + [Zend_Validate_Hostname::ALLOW_LOCAL, true, ['example.', 'example.com.']], + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_Hostname($element[0]); diff --git a/tests/Zend/Validate/IbanTest.php b/tests/Zend/Validate/IbanTest.php index 5ea5895d30..73cd10bd4c 100644 --- a/tests/Zend/Validate/IbanTest.php +++ b/tests/Zend/Validate/IbanTest.php @@ -43,12 +43,12 @@ class Zend_Validate_IbanTest extends PHPUnit_Framework_TestCase public function testBasic() { $validator = new Zend_Validate_Iban(); - $valuesExpected = array( + $valuesExpected = [ 'AD1200012030200359100100' => true, 'AT611904300234573201' => true, 'AT61 1904 3002 3457 3201' => false, 'AD1200012030200354100100' => false, - ); + ]; foreach ($valuesExpected as $input => $result) { $this->assertEquals($result, $validator->isValid($input), "'$input' expected to be " . ($result ? '' : 'in') . 'valid'); diff --git a/tests/Zend/Validate/IdenticalTest.php b/tests/Zend/Validate/IdenticalTest.php index 4ce1c5d368..3bc60d24b3 100644 --- a/tests/Zend/Validate/IdenticalTest.php +++ b/tests/Zend/Validate/IdenticalTest.php @@ -124,25 +124,25 @@ public function testValidatingAgainstNonStrings() $this->assertTrue($this->validator->isValid(true)); $this->assertFalse($this->validator->isValid(1)); - $this->validator->setToken(array('one' => 'two', 'three')); - $this->assertTrue($this->validator->isValid(array('one' => 'two', 'three'))); - $this->assertFalse($this->validator->isValid(array())); + $this->validator->setToken(['one' => 'two', 'three']); + $this->assertTrue($this->validator->isValid(['one' => 'two', 'three'])); + $this->assertFalse($this->validator->isValid([])); } public function testValidatingTokenArray() { - $validator = new Zend_Validate_Identical(array('token' => 123)); + $validator = new Zend_Validate_Identical(['token' => 123]); $this->assertTrue($validator->isValid(123)); - $this->assertFalse($validator->isValid(array('token' => 123))); + $this->assertFalse($validator->isValid(['token' => 123])); } public function testValidatingNonStrictToken() { - $validator = new Zend_Validate_Identical(array('token' => 123, 'strict' => false)); + $validator = new Zend_Validate_Identical(['token' => 123, 'strict' => false]); $this->assertTrue($validator->isValid('123')); $validator->setStrict(true); - $this->assertFalse($validator->isValid(array('token' => '123'))); + $this->assertFalse($validator->isValid(['token' => '123'])); } } diff --git a/tests/Zend/Validate/InArrayTest.php b/tests/Zend/Validate/InArrayTest.php index e92dcebb09..1aa8e87dfb 100644 --- a/tests/Zend/Validate/InArrayTest.php +++ b/tests/Zend/Validate/InArrayTest.php @@ -43,7 +43,7 @@ class Zend_Validate_InArrayTest extends PHPUnit_Framework_TestCase */ public function testBasic() { - $validator = new Zend_Validate_InArray(array(1, 'a', 2.3)); + $validator = new Zend_Validate_InArray([1, 'a', 2.3]); $this->assertTrue($validator->isValid(1)); $this->assertTrue($validator->isValid(1.0)); $this->assertTrue($validator->isValid('1')); @@ -60,8 +60,8 @@ public function testBasic() */ public function testGetMessages() { - $validator = new Zend_Validate_InArray(array(1, 2, 3)); - $this->assertEquals(array(), $validator->getMessages()); + $validator = new Zend_Validate_InArray([1, 2, 3]); + $this->assertEquals([], $validator->getMessages()); } /** @@ -71,8 +71,8 @@ public function testGetMessages() */ public function testGetHaystack() { - $validator = new Zend_Validate_InArray(array(1, 2, 3)); - $this->assertEquals(array(1, 2, 3), $validator->getHaystack()); + $validator = new Zend_Validate_InArray([1, 2, 3]); + $this->assertEquals([1, 2, 3], $validator->getHaystack()); } /** @@ -82,16 +82,16 @@ public function testGetHaystack() */ public function testGetStrict() { - $validator = new Zend_Validate_InArray(array(1, 2, 3)); + $validator = new Zend_Validate_InArray([1, 2, 3]); $this->assertFalse($validator->getStrict()); } public function testGivingOptionsAsArrayAtInitiation() { $validator = new Zend_Validate_InArray( - array('haystack' => - array(1, 'a', 2.3) - ) + ['haystack' => + [1, 'a', 2.3] + ] ); $this->assertTrue($validator->isValid(1)); $this->assertTrue($validator->isValid(1.0)); @@ -105,13 +105,13 @@ public function testGivingOptionsAsArrayAtInitiation() public function testSettingANewHaystack() { $validator = new Zend_Validate_InArray( - array('haystack' => - array('test', 0, 'A') - ) + ['haystack' => + ['test', 0, 'A'] + ] ); $this->assertTrue($validator->isValid('A')); - $validator->setHaystack(array(1, 'a', 2.3)); + $validator->setHaystack([1, 'a', 2.3]); $this->assertTrue($validator->isValid(1)); $this->assertTrue($validator->isValid(1.0)); $this->assertTrue($validator->isValid('1')); @@ -123,7 +123,7 @@ public function testSettingANewHaystack() public function testSettingNewStrictMode() { - $validator = new Zend_Validate_InArray(array(1, 2, 3)); + $validator = new Zend_Validate_InArray([1, 2, 3]); $this->assertFalse($validator->getStrict()); $this->assertTrue($validator->isValid('1')); $this->assertTrue($validator->isValid(1)); @@ -137,17 +137,17 @@ public function testSettingNewStrictMode() public function testSettingStrictViaInitiation() { $validator = new Zend_Validate_InArray( - array( - 'haystack' => array('test', 0, 'A'), + [ + 'haystack' => ['test', 0, 'A'], 'strict' => true - ) + ] ); $this->assertTrue($validator->getStrict()); } public function testGettingRecursiveOption() { - $validator = new Zend_Validate_InArray(array(1, 2, 3)); + $validator = new Zend_Validate_InArray([1, 2, 3]); $this->assertFalse($validator->getRecursive()); $validator->setRecursive(true); @@ -157,10 +157,10 @@ public function testGettingRecursiveOption() public function testSettingRecursiveViaInitiation() { $validator = new Zend_Validate_InArray( - array( - 'haystack' => array('test', 0, 'A'), + [ + 'haystack' => ['test', 0, 'A'], 'recursive' => true - ) + ] ); $this->assertTrue($validator->getRecursive()); } @@ -168,13 +168,13 @@ public function testSettingRecursiveViaInitiation() public function testRecursiveDetection() { $validator = new Zend_Validate_InArray( - array( + [ 'haystack' => - array( - 'firstDimension' => array('test', 0, 'A'), - 'secondDimension' => array('value', 2, 'a')), + [ + 'firstDimension' => ['test', 0, 'A'], + 'secondDimension' => ['value', 2, 'a']], 'recursive' => false - ) + ] ); $this->assertFalse($validator->isValid('A')); @@ -185,10 +185,10 @@ public function testRecursiveDetection() public function testRecursiveStandalone() { $validator = new Zend_Validate_InArray( - array( - 'firstDimension' => array('test', 0, 'A'), - 'secondDimension' => array('value', 2, 'a') - ) + [ + 'firstDimension' => ['test', 0, 'A'], + 'secondDimension' => ['value', 2, 'a'] + ] ); $this->assertFalse($validator->isValid('A')); @@ -201,11 +201,11 @@ public function testRecursiveStandalone() */ public function testMultidimensionalArrayNotFound() { - $input = array( - array('x'), - array('y'), - ); - $validator = new Zend_Validate_InArray(array('a')); + $input = [ + ['x'], + ['y'], + ]; + $validator = new Zend_Validate_InArray(['a']); $this->assertFalse($validator->isValid($input)); } @@ -214,11 +214,11 @@ public function testMultidimensionalArrayNotFound() */ public function testErrorMessageWithArrayValue() { - $input = array( - array('x'), - array('y'), - ); - $validator = new Zend_Validate_InArray(array('a')); + $input = [ + ['x'], + ['y'], + ]; + $validator = new Zend_Validate_InArray(['a']); $validator->isValid($input); $messages = $validator->getMessages(); $this->assertEquals( diff --git a/tests/Zend/Validate/IntTest.php b/tests/Zend/Validate/IntTest.php index 2224ea7a90..2aebffa896 100644 --- a/tests/Zend/Validate/IntTest.php +++ b/tests/Zend/Validate/IntTest.php @@ -61,18 +61,18 @@ public function setUp() public function testBasic() { $this->_validator->setLocale('en'); - $valuesExpected = array( - array(1.00, true), - array(0.00, true), - array(0.01, false), - array(-0.1, false), - array(-1, true), - array('10', true), - array(1, true), - array('not an int', false), - array(true, false), - array(false, false), - ); + $valuesExpected = [ + [1.00, true], + [0.00, true], + [0.01, false], + [-0.1, false], + [-1, true], + ['10', true], + [1, true], + ['not an int', false], + [true, false], + [false, false], + ]; foreach ($valuesExpected as $element) { $this->assertEquals($element[1], $this->_validator->isValid($element[0]), @@ -87,7 +87,7 @@ public function testBasic() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -106,7 +106,7 @@ public function testSettingLocales() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } /** diff --git a/tests/Zend/Validate/IpTest.php b/tests/Zend/Validate/IpTest.php index 69d0c5f91e..43fdd4b361 100644 --- a/tests/Zend/Validate/IpTest.php +++ b/tests/Zend/Validate/IpTest.php @@ -79,19 +79,19 @@ public function testZeroIpForZF2420() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } public function testOnlyIpv4() { - $this->_validator->setOptions(array('allowipv6' => false)); + $this->_validator->setOptions(['allowipv6' => false]); $this->assertTrue($this->_validator->isValid('1.2.3.4')); $this->assertFalse($this->_validator->isValid('a:b:c:d:e::1.2.3.4')); } public function testOnlyIpv6() { - $this->_validator->setOptions(array('allowipv4' => false)); + $this->_validator->setOptions(['allowipv4' => false]); $this->assertFalse($this->_validator->isValid('1.2.3.4')); $this->assertTrue($this->_validator->isValid('a:b:c:d:e::1.2.3.4')); } @@ -99,7 +99,7 @@ public function testOnlyIpv6() public function testNoValidation() { try { - $this->_validator->setOptions(array('allowipv4' => false, 'allowipv6' => false)); + $this->_validator->setOptions(['allowipv4' => false, 'allowipv6' => false]); $this->fail(); } catch (Zend_Validate_Exception $e) { $this->assertContains('Nothing to validate', $e->getMessage()); @@ -122,7 +122,7 @@ public function testInvalidIpForZF3435() */ public function testIPv6addresses() { - $IPs = array( + $IPs = [ '2001:0db8:0000:0000:0000:0000:1428:57ab' => true, '2001:0DB8:0000:0000:0000:0000:1428:57AB' => true, '2001:00db8:0000:0000:0000:0000:1428:57ab' => false, @@ -199,7 +199,7 @@ public function testIPv6addresses() 'a:b:c:d:e:f::' => true, 'total gibberish' => false - ); + ]; foreach($IPs as $ip => $expectedOutcome) { if($expectedOutcome) { @@ -216,7 +216,7 @@ public function testIPv6addresses() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } /** diff --git a/tests/Zend/Validate/IsbnTest.php b/tests/Zend/Validate/IsbnTest.php index 449061215e..e0890c7bbb 100644 --- a/tests/Zend/Validate/IsbnTest.php +++ b/tests/Zend/Validate/IsbnTest.php @@ -147,20 +147,20 @@ public function testSeparator() */ public function testInitialization() { - $options = array('type' => Zend_Validate_Isbn::AUTO, - 'separator' => ' '); + $options = ['type' => Zend_Validate_Isbn::AUTO, + 'separator' => ' ']; $validator = new Zend_Validate_Isbn($options); $this->assertTrue($validator->getType() == Zend_Validate_Isbn::AUTO); $this->assertTrue($validator->getSeparator() == ' '); - $options = array('type' => Zend_Validate_Isbn::ISBN10, - 'separator' => '-'); + $options = ['type' => Zend_Validate_Isbn::ISBN10, + 'separator' => '-']; $validator = new Zend_Validate_Isbn($options); $this->assertTrue($validator->getType() == Zend_Validate_Isbn::ISBN10); $this->assertTrue($validator->getSeparator() == '-'); - $options = array('type' => Zend_Validate_Isbn::ISBN13, - 'separator' => ''); + $options = ['type' => Zend_Validate_Isbn::ISBN13, + 'separator' => '']; $validator = new Zend_Validate_Isbn($options); $this->assertTrue($validator->getType() == Zend_Validate_Isbn::ISBN13); $this->assertTrue($validator->getSeparator() == ''); diff --git a/tests/Zend/Validate/LessThanTest.php b/tests/Zend/Validate/LessThanTest.php index db80605d9c..b29f48805d 100644 --- a/tests/Zend/Validate/LessThanTest.php +++ b/tests/Zend/Validate/LessThanTest.php @@ -49,12 +49,12 @@ public function testBasic() * - expected validation result * - array of test input values */ - $valuesExpected = array( - array(100, true, array(-1, 0, 0.01, 1, 99.999)), - array(100, false, array(100, 100.0, 100.01)), - array('a', false, array('a', 'b', 'c', 'd')), - array('z', true, array('x', 'y')) - ); + $valuesExpected = [ + [100, true, [-1, 0, 0.01, 1, 99.999]], + [100, false, [100, 100.0, 100.01]], + ['a', false, ['a', 'b', 'c', 'd']], + ['z', true, ['x', 'y']] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_LessThan($element[0]); foreach ($element[2] as $input) { @@ -71,7 +71,7 @@ public function testBasic() public function testGetMessages() { $validator = new Zend_Validate_LessThan(10); - $this->assertEquals(array(), $validator->getMessages()); + $this->assertEquals([], $validator->getMessages()); } /** diff --git a/tests/Zend/Validate/MessageTest.php b/tests/Zend/Validate/MessageTest.php index 1ab20b86b7..c3802d005b 100644 --- a/tests/Zend/Validate/MessageTest.php +++ b/tests/Zend/Validate/MessageTest.php @@ -200,10 +200,10 @@ public function testSetMessageExceptionInvalidKey() public function testSetMessages() { $this->_validator->setMessages( - array( + [ Zend_Validate_StringLength::TOO_LONG => 'Your value is too long', Zend_Validate_StringLength::TOO_SHORT => 'Your value is too short' - ) + ] ); $this->assertFalse($this->_validator->isValid('abcdefghij')); @@ -296,7 +296,7 @@ public function testGetMessageVariables() $vars = $this->_validator->getMessageVariables(); $this->assertTrue(is_array($vars)); - $this->assertEquals(array('min', 'max'), $vars); + $this->assertEquals(['min', 'max'], $vars); $message = 'variables: %notvar% '; foreach ($vars as $var) { $message .= "%$var% "; diff --git a/tests/Zend/Validate/NotEmptyTest.php b/tests/Zend/Validate/NotEmptyTest.php index bd2967bfec..0492cf3a32 100644 --- a/tests/Zend/Validate/NotEmptyTest.php +++ b/tests/Zend/Validate/NotEmptyTest.php @@ -80,20 +80,20 @@ public function setUp() */ public function testBasic() { - $valuesExpected = array( - array('word', true), - array('', false), - array(' ', false), - array(' word ', true), - array('0', true), - array(1, true), - array(0, true), - array(true, true), - array(false, false), - array(null, false), - array(array(), false), - array(array(5), true), - ); + $valuesExpected = [ + ['word', true], + ['', false], + [' ', false], + [' word ', true], + ['0', true], + [1, true], + [0, true], + [true, true], + [false, false], + [null, false], + [[], false], + [[5], true], + ]; foreach ($valuesExpected as $i => $element) { $this->assertEquals($element[1], $this->_validator->isValid($element[0]), "Failed test #$i"); @@ -118,8 +118,8 @@ public function testOnlyBoolean() $this->assertTrue($this->_validator->isValid('abc')); $this->assertTrue($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertTrue($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertTrue($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertTrue($this->_validator->isValid(null)); } @@ -141,8 +141,8 @@ public function testOnlyInteger() $this->assertTrue($this->_validator->isValid('abc')); $this->assertTrue($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertTrue($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertTrue($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertTrue($this->_validator->isValid(null)); } @@ -164,8 +164,8 @@ public function testOnlyFloat() $this->assertTrue($this->_validator->isValid('abc')); $this->assertTrue($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertTrue($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertTrue($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertTrue($this->_validator->isValid(null)); } @@ -187,8 +187,8 @@ public function testOnlyString() $this->assertTrue($this->_validator->isValid('abc')); $this->assertTrue($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertTrue($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertTrue($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertTrue($this->_validator->isValid(null)); } @@ -210,8 +210,8 @@ public function testOnlyZero() $this->assertTrue($this->_validator->isValid('abc')); $this->assertFalse($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertTrue($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertTrue($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertTrue($this->_validator->isValid(null)); } @@ -233,8 +233,8 @@ public function testOnlyArray() $this->assertTrue($this->_validator->isValid('abc')); $this->assertTrue($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertFalse($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertFalse($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertTrue($this->_validator->isValid(null)); } @@ -256,8 +256,8 @@ public function testOnlyNull() $this->assertTrue($this->_validator->isValid('abc')); $this->assertTrue($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertTrue($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertTrue($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertFalse($this->_validator->isValid(null)); } @@ -279,8 +279,8 @@ public function testOnlyPHP() $this->assertTrue($this->_validator->isValid('abc')); $this->assertFalse($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertFalse($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertFalse($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertFalse($this->_validator->isValid(null)); } @@ -302,8 +302,8 @@ public function testOnlySpace() $this->assertTrue($this->_validator->isValid('abc')); $this->assertTrue($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertTrue($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertTrue($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertTrue($this->_validator->isValid(null)); } @@ -325,8 +325,8 @@ public function testOnlyAll() $this->assertTrue($this->_validator->isValid('abc')); $this->assertFalse($this->_validator->isValid('0')); $this->assertTrue($this->_validator->isValid('1')); - $this->assertFalse($this->_validator->isValid(array())); - $this->assertTrue($this->_validator->isValid(array('xxx'))); + $this->assertFalse($this->_validator->isValid([])); + $this->assertTrue($this->_validator->isValid(['xxx'])); $this->assertFalse($this->_validator->isValid(null)); } @@ -338,13 +338,13 @@ public function testOnlyAll() public function testArrayConstantNotation() { $filter = new Zend_Validate_NotEmpty( - array( - 'type' => array( + [ + 'type' => [ Zend_Validate_NotEmpty::ZERO, Zend_Validate_NotEmpty::STRING, Zend_Validate_NotEmpty::BOOLEAN - ) - ) + ] + ] ); $this->assertFalse($filter->isValid(false)); @@ -357,8 +357,8 @@ public function testArrayConstantNotation() $this->assertTrue($filter->isValid('abc')); $this->assertFalse($filter->isValid('0')); $this->assertTrue($filter->isValid('1')); - $this->assertTrue($filter->isValid(array())); - $this->assertTrue($filter->isValid(array('xxx'))); + $this->assertTrue($filter->isValid([])); + $this->assertTrue($filter->isValid(['xxx'])); $this->assertTrue($filter->isValid(null)); } @@ -370,13 +370,13 @@ public function testArrayConstantNotation() public function testArrayConfigNotation() { $filter = new Zend_Validate_NotEmpty( - array( - 'type' => array( + [ + 'type' => [ Zend_Validate_NotEmpty::ZERO, Zend_Validate_NotEmpty::STRING, - Zend_Validate_NotEmpty::BOOLEAN), + Zend_Validate_NotEmpty::BOOLEAN], 'test' => false - ) + ] ); $this->assertFalse($filter->isValid(false)); @@ -389,8 +389,8 @@ public function testArrayConfigNotation() $this->assertTrue($filter->isValid('abc')); $this->assertFalse($filter->isValid('0')); $this->assertTrue($filter->isValid('1')); - $this->assertTrue($filter->isValid(array())); - $this->assertTrue($filter->isValid(array('xxx'))); + $this->assertTrue($filter->isValid([])); + $this->assertTrue($filter->isValid(['xxx'])); $this->assertTrue($filter->isValid(null)); } @@ -415,8 +415,8 @@ public function testMultiConstantNotation() $this->assertTrue($filter->isValid('abc')); $this->assertFalse($filter->isValid('0')); $this->assertTrue($filter->isValid('1')); - $this->assertTrue($filter->isValid(array())); - $this->assertTrue($filter->isValid(array('xxx'))); + $this->assertTrue($filter->isValid([])); + $this->assertTrue($filter->isValid(['xxx'])); $this->assertTrue($filter->isValid(null)); } @@ -428,9 +428,9 @@ public function testMultiConstantNotation() public function testStringNotation() { $filter = new Zend_Validate_NotEmpty( - array( - 'type' => array('zero', 'string', 'boolean') - ) + [ + 'type' => ['zero', 'string', 'boolean'] + ] ); $this->assertFalse($filter->isValid(false)); @@ -443,8 +443,8 @@ public function testStringNotation() $this->assertTrue($filter->isValid('abc')); $this->assertFalse($filter->isValid('0')); $this->assertTrue($filter->isValid('1')); - $this->assertTrue($filter->isValid(array())); - $this->assertTrue($filter->isValid(array('xxx'))); + $this->assertTrue($filter->isValid([])); + $this->assertTrue($filter->isValid(['xxx'])); $this->assertTrue($filter->isValid(null)); } @@ -469,8 +469,8 @@ public function testSingleStringNotation() $this->assertTrue($filter->isValid('abc')); $this->assertTrue($filter->isValid('0')); $this->assertTrue($filter->isValid('1')); - $this->assertTrue($filter->isValid(array())); - $this->assertTrue($filter->isValid(array('xxx'))); + $this->assertTrue($filter->isValid([])); + $this->assertTrue($filter->isValid(['xxx'])); $this->assertTrue($filter->isValid(null)); } @@ -482,7 +482,7 @@ public function testSingleStringNotation() public function testConfigObject() { require_once 'Zend/Config.php'; - $options = array('type' => 'all'); + $options = ['type' => 'all']; $config = new Zend_Config($options); $filter = new Zend_Validate_NotEmpty( @@ -499,8 +499,8 @@ public function testConfigObject() $this->assertTrue($filter->isValid('abc')); $this->assertFalse($filter->isValid('0')); $this->assertTrue($filter->isValid('1')); - $this->assertFalse($filter->isValid(array())); - $this->assertTrue($filter->isValid(array('xxx'))); + $this->assertFalse($filter->isValid([])); + $this->assertTrue($filter->isValid(['xxx'])); $this->assertFalse($filter->isValid(null)); } @@ -544,7 +544,7 @@ public function testStringWithZeroShouldNotBeTreatedAsEmpty() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** diff --git a/tests/Zend/Validate/PostCodeTest.php b/tests/Zend/Validate/PostCodeTest.php index ae9d257abc..e49236df63 100644 --- a/tests/Zend/Validate/PostCodeTest.php +++ b/tests/Zend/Validate/PostCodeTest.php @@ -74,19 +74,19 @@ public function setUp() */ public function testBasic() { - $valuesExpected = array( - array('2292', true), - array('1000', true), - array('0000', true), - array('12345', false), - array(1234, true), - array(9821, true), - array('21A4', false), - array('ABCD', false), - array(true, false), - array('AT-2292', false), - array(1.56, false) - ); + $valuesExpected = [ + ['2292', true], + ['1000', true], + ['0000', true], + ['12345', false], + [1234, true], + [9821, true], + ['21A4', false], + ['ABCD', false], + [true, false], + ['AT-2292', false], + [1.56, false] + ]; foreach ($valuesExpected as $element) { $this->assertEquals($element[1], $this->_validator->isValid($element[0]), @@ -101,7 +101,7 @@ public function testBasic() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** diff --git a/tests/Zend/Validate/RegexTest.php b/tests/Zend/Validate/RegexTest.php index 795fd5cc4e..434bb69e18 100644 --- a/tests/Zend/Validate/RegexTest.php +++ b/tests/Zend/Validate/RegexTest.php @@ -49,10 +49,10 @@ public function testBasic() * - expected validation result * - array of test input values */ - $valuesExpected = array( - array('/[a-z]/', true, array('abc123', 'foo', 'a', 'z')), - array('/[a-z]/', false, array('123', 'A')) - ); + $valuesExpected = [ + ['/[a-z]/', true, ['abc123', 'foo', 'a', 'z']], + ['/[a-z]/', false, ['123', 'A']] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_Regex($element[0]); foreach ($element[2] as $input) { @@ -69,7 +69,7 @@ public function testBasic() public function testGetMessages() { $validator = new Zend_Validate_Regex('/./'); - $this->assertEquals(array(), $validator->getMessages()); + $this->assertEquals([], $validator->getMessages()); } /** @@ -105,6 +105,6 @@ public function testBadPattern() public function testNonStringValidation() { $validator = new Zend_Validate_Regex('/./'); - $this->assertFalse($validator->isValid(array(1 => 1))); + $this->assertFalse($validator->isValid([1 => 1])); } } diff --git a/tests/Zend/Validate/Sitemap/ChangefreqTest.php b/tests/Zend/Validate/Sitemap/ChangefreqTest.php index e1ec0bff34..60d8740079 100644 --- a/tests/Zend/Validate/Sitemap/ChangefreqTest.php +++ b/tests/Zend/Validate/Sitemap/ChangefreqTest.php @@ -63,10 +63,10 @@ protected function tearDown() */ public function testValidChangefreqs() { - $values = array( + $values = [ 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' - ); + ]; foreach ($values as $value) { $this->assertSame(true, $this->_validator->isValid($value)); @@ -79,11 +79,11 @@ public function testValidChangefreqs() */ public function testInvalidStrings() { - $values = array( + $values = [ 'alwayz', '_hourly', 'Daily', 'wEekly', 'mönthly ', ' yearly ', 'never ', 'rofl', 'yesterday', - ); + ]; foreach ($values as $value) { $this->assertSame(false, $this->_validator->isValid($value)); @@ -98,9 +98,9 @@ public function testInvalidStrings() */ public function testNotString() { - $values = array( + $values = [ 1, 1.4, null, new stdClass(), true, false - ); + ]; foreach ($values as $value) { $this->assertSame(false, $this->_validator->isValid($value)); diff --git a/tests/Zend/Validate/Sitemap/LastmodTest.php b/tests/Zend/Validate/Sitemap/LastmodTest.php index c0aef32a7e..739d592b3d 100644 --- a/tests/Zend/Validate/Sitemap/LastmodTest.php +++ b/tests/Zend/Validate/Sitemap/LastmodTest.php @@ -63,7 +63,7 @@ protected function tearDown() */ public function testValidChangefreqs() { - $values = array( + $values = [ '1994-05-11T18:00:09-08:45', '1997-05-11T18:50:09+00:00', '1998-06-11T01:00:09-02:00', @@ -76,7 +76,7 @@ public function testValidChangefreqs() '2006-03-19', '2007-08-31', '2007-08-25' - ); + ]; foreach ($values as $value) { $this->assertSame(true, $this->_validator->isValid($value)); @@ -89,13 +89,13 @@ public function testValidChangefreqs() */ public function testInvalidStrings() { - $values = array( + $values = [ '1995-05-11T18:60:09-08:45', '1996-05-11T18:50:09+25:00', '2002-13-11', '2004-00-01', '2006-01-01\n' - ); + ]; foreach ($values as $value) { $this->assertSame(false, $this->_validator->isValid($value)); @@ -110,9 +110,9 @@ public function testInvalidStrings() */ public function testNotString() { - $values = array( + $values = [ 1, 1.4, null, new stdClass(), true, false - ); + ]; foreach ($values as $value) { $this->assertSame(false, $this->_validator->isValid($value)); diff --git a/tests/Zend/Validate/Sitemap/LocTest.php b/tests/Zend/Validate/Sitemap/LocTest.php index 1fa0d582f2..6a59213e3d 100644 --- a/tests/Zend/Validate/Sitemap/LocTest.php +++ b/tests/Zend/Validate/Sitemap/LocTest.php @@ -63,7 +63,7 @@ protected function tearDown() */ public function testValidLocs() { - $values = array( + $values = [ 'http://www.example.com', 'http://www.example.com/', 'http://www.exmaple.lan/', @@ -71,7 +71,7 @@ public function testValidLocs() 'http://www.exmaple.com:8080/foo/bar/', 'https://user:pass@www.exmaple.com:8080/', 'https://www.exmaple.com/?foo="bar'&bar=<bat>' - ); + ]; foreach ($values as $value) { $this->assertSame(true, $this->_validator->isValid($value)); @@ -84,13 +84,13 @@ public function testValidLocs() */ public function testInvalidLocs() { - $values = array( + $values = [ 'www.example.com', '/news/', '#', 'http:/example.com/', 'https://www.exmaple.com/?foo="bar\'&bar=' - ); + ]; foreach ($values as $value) { $this->assertSame(false, $this->_validator->isValid($value)); @@ -105,9 +105,9 @@ public function testInvalidLocs() */ public function testNotStrings() { - $values = array( + $values = [ 1, 1.4, null, new stdClass(), true, false - ); + ]; foreach ($values as $value) { $this->assertSame(false, $this->_validator->isValid($value)); diff --git a/tests/Zend/Validate/Sitemap/PriorityTest.php b/tests/Zend/Validate/Sitemap/PriorityTest.php index 01a832c330..a1896bcd04 100644 --- a/tests/Zend/Validate/Sitemap/PriorityTest.php +++ b/tests/Zend/Validate/Sitemap/PriorityTest.php @@ -63,11 +63,11 @@ protected function tearDown() */ public function testValidPriorities() { - $values = array( + $values = [ '0.0', '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0', '0.99', 0.1, 0.6667, 0.0001, 0.4, 0, 1, .35 - ); + ]; foreach ($values as $value) { $this->assertSame(true, $this->_validator->isValid($value)); @@ -80,9 +80,9 @@ public function testValidPriorities() */ public function testInvalidPriorities() { - $values = array( + $values = [ -1, -0.1, 1.1, 100, 10, 2, '3', '-4', - ); + ]; foreach ($values as $value) { $this->assertSame(false, $this->_validator->isValid($value)); @@ -97,9 +97,9 @@ public function testInvalidPriorities() */ public function testNotNumbers() { - $values = array( + $values = [ null, new stdClass(), true, false, 'abcd', - ); + ]; foreach ($values as $value) { $this->assertSame(false, $this->_validator->isValid($value)); diff --git a/tests/Zend/Validate/StringLengthTest.php b/tests/Zend/Validate/StringLengthTest.php index 9e0bfe25d8..8b9abc6f2f 100644 --- a/tests/Zend/Validate/StringLengthTest.php +++ b/tests/Zend/Validate/StringLengthTest.php @@ -71,17 +71,17 @@ public function testBasic() * - expected validation result * - array of test input values */ - $valuesExpected = array( - array(0, null, true, array('', 'a', 'ab')), - array(-1, null, true, array('')), - array(2, 2, true, array('ab', ' ')), - array(2, 2, false, array('a', 'abc')), - array(1, null, false, array('')), - array(2, 3, true, array('ab', 'abc')), - array(2, 3, false, array('a', 'abcd')), - array(3, 3, true, array('äöü')), - array(6, 6, true, array('Müller')) - ); + $valuesExpected = [ + [0, null, true, ['', 'a', 'ab']], + [-1, null, true, ['']], + [2, 2, true, ['ab', ' ']], + [2, 2, false, ['a', 'abc']], + [1, null, false, ['']], + [2, 3, true, ['ab', 'abc']], + [2, 3, false, ['a', 'abcd']], + [3, 3, true, ['äöü']], + [6, 6, true, ['Müller']] + ]; foreach ($valuesExpected as $element) { $validator = new Zend_Validate_StringLength($element[0], $element[1]); foreach ($element[3] as $input) { @@ -97,7 +97,7 @@ public function testBasic() */ public function testGetMessages() { - $this->assertEquals(array(), $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getMessages()); } /** @@ -192,6 +192,6 @@ public function testWrongEncoding() */ public function testNonStringValidation() { - $this->assertFalse($this->_validator->isValid(array(1 => 1))); + $this->assertFalse($this->_validator->isValid([1 => 1])); } } diff --git a/tests/Zend/Validate/_files/MyBarcode2.php b/tests/Zend/Validate/_files/MyBarcode2.php index 100da2ade3..aac7ee1791 100644 --- a/tests/Zend/Validate/_files/MyBarcode2.php +++ b/tests/Zend/Validate/_files/MyBarcode2.php @@ -1,7 +1,7 @@ assertEquals(array(), $this->_validator->getMessages()); - $this->assertEquals(array(), $this->_validator->getErrors()); + $this->assertEquals([], $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getErrors()); $this->assertTrue($this->_validator->isValid('something')); - $this->assertEquals(array(), $this->_validator->getErrors()); + $this->assertEquals([], $this->_validator->getErrors()); } /** @@ -94,8 +94,8 @@ public function testTrue() { $this->_validator->addValidator(new Zend_ValidateTest_True()); $this->assertTrue($this->_validator->isValid(null)); - $this->assertEquals(array(), $this->_validator->getMessages()); - $this->assertEquals(array(), $this->_validator->getErrors()); + $this->assertEquals([], $this->_validator->getMessages()); + $this->assertEquals([], $this->_validator->getErrors()); } /** @@ -107,7 +107,7 @@ public function testFalse() { $this->_validator->addValidator(new Zend_ValidateTest_False()); $this->assertFalse($this->_validator->isValid(null)); - $this->assertEquals(array('error' => 'validation failed'), $this->_validator->getMessages()); + $this->assertEquals(['error' => 'validation failed'], $this->_validator->getMessages()); } /** @@ -120,7 +120,7 @@ public function testBreakChainOnFailure() $this->_validator->addValidator(new Zend_ValidateTest_False(), true) ->addValidator(new Zend_ValidateTest_False()); $this->assertFalse($this->_validator->isValid(null)); - $this->assertEquals(array('error' => 'validation failed'), $this->_validator->getMessages()); + $this->assertEquals(['error' => 'validation failed'], $this->_validator->getMessages()); } /** @@ -140,8 +140,8 @@ public function testStaticFactory() */ public function testStaticFactoryWithConstructorArguments() { - $this->assertTrue(Zend_Validate::is('12', 'Between', array('min' => 1, 'max' => 12))); - $this->assertFalse(Zend_Validate::is('24', 'Between', array('min' => 1, 'max' => 12))); + $this->assertTrue(Zend_Validate::is('12', 'Between', ['min' => 1, 'max' => 12])); + $this->assertFalse(Zend_Validate::is('24', 'Between', ['min' => 1, 'max' => 12])); } /** @@ -166,35 +166,35 @@ public function testStaticFactoryClassNotFound() */ public function testNamespaces() { - $this->assertEquals(array(), Zend_Validate::getDefaultNamespaces()); + $this->assertEquals([], Zend_Validate::getDefaultNamespaces()); $this->assertFalse(Zend_Validate::hasDefaultNamespaces()); Zend_Validate::setDefaultNamespaces('TestDir'); - $this->assertEquals(array('TestDir'), Zend_Validate::getDefaultNamespaces()); + $this->assertEquals(['TestDir'], Zend_Validate::getDefaultNamespaces()); Zend_Validate::setDefaultNamespaces('OtherTestDir'); - $this->assertEquals(array('OtherTestDir'), Zend_Validate::getDefaultNamespaces()); + $this->assertEquals(['OtherTestDir'], Zend_Validate::getDefaultNamespaces()); $this->assertTrue(Zend_Validate::hasDefaultNamespaces()); - Zend_Validate::setDefaultNamespaces(array()); + Zend_Validate::setDefaultNamespaces([]); - $this->assertEquals(array(), Zend_Validate::getDefaultNamespaces()); + $this->assertEquals([], Zend_Validate::getDefaultNamespaces()); $this->assertFalse(Zend_Validate::hasDefaultNamespaces()); - Zend_Validate::addDefaultNamespaces(array('One', 'Two')); - $this->assertEquals(array('One', 'Two'), Zend_Validate::getDefaultNamespaces()); + Zend_Validate::addDefaultNamespaces(['One', 'Two']); + $this->assertEquals(['One', 'Two'], Zend_Validate::getDefaultNamespaces()); Zend_Validate::addDefaultNamespaces('Three'); - $this->assertEquals(array('One', 'Two', 'Three'), Zend_Validate::getDefaultNamespaces()); + $this->assertEquals(['One', 'Two', 'Three'], Zend_Validate::getDefaultNamespaces()); - Zend_Validate::setDefaultNamespaces(array()); + Zend_Validate::setDefaultNamespaces([]); } public function testIsValidWithParameters() { - $this->assertTrue(Zend_Validate::is(5, 'Between', array(1, 10))); - $this->assertTrue(Zend_Validate::is(5, 'Between', array('min' => 1, 'max' => 10))); + $this->assertTrue(Zend_Validate::is(5, 'Between', [1, 10])); + $this->assertTrue(Zend_Validate::is(5, 'Between', ['min' => 1, 'max' => 10])); } public function testSetGetMessageLengthLimitation() @@ -210,8 +210,8 @@ public function testSetGetMessageLengthLimitation() public function testSetGetDefaultTranslator() { - set_error_handler(array($this, 'errorHandlerIgnore')); - $translator = new Zend_Translate('array', array(), 'en'); + set_error_handler([$this, 'errorHandlerIgnore']); + $translator = new Zend_Translate('array', [], 'en'); restore_error_handler(); Zend_Validate_Abstract::setDefaultTranslator($translator); $this->assertSame($translator->getAdapter(), Zend_Validate_Abstract::getDefaultTranslator()); @@ -268,7 +268,7 @@ class Zend_ValidateTest_False extends Zend_Validate_Abstract { public function isValid($value) { - $this->_messages = array('error' => 'validation failed'); + $this->_messages = ['error' => 'validation failed']; return false; } } diff --git a/tests/Zend/VersionTest.php b/tests/Zend/VersionTest.php index a623cc4695..8180798c94 100644 --- a/tests/Zend/VersionTest.php +++ b/tests/Zend/VersionTest.php @@ -56,7 +56,7 @@ public function testVersionCompare() for ($i=0; $i <= 1; $i++) { for ($j=0; $j <= 12; $j++) { for ($k=0; $k < 20; $k++) { - foreach (array('dev', 'pr', 'PR', 'alpha', 'a1', 'a2', 'beta', 'b1', 'b2', 'RC', 'RC1', 'RC2', 'RC3', '', 'pl1', 'PL1') as $rel) { + foreach (['dev', 'pr', 'PR', 'alpha', 'a1', 'a2', 'beta', 'b1', 'b2', 'RC', 'RC1', 'RC2', 'RC3', '', 'pl1', 'PL1'] as $rel) { $ver = "$i.$j.$k$rel"; $normalizedVersion = strtolower(Zend_Version::VERSION); if (strtolower($ver) === $normalizedVersion diff --git a/tests/Zend/View/Helper/ActionTest.php b/tests/Zend/View/Helper/ActionTest.php index cc12aef4ca..4efa189956 100644 --- a/tests/Zend/View/Helper/ActionTest.php +++ b/tests/Zend/View/Helper/ActionTest.php @@ -73,10 +73,10 @@ public static function main() public function setUp() { $this->_origServer = $_SERVER; - $_SERVER = array( + $_SERVER = [ 'SCRIPT_FILENAME' => __FILE__, 'PHP_SELF' => __FILE__, - ); + ]; $front = Zend_Controller_Front::getInstance(); $front->resetInstance(); @@ -189,7 +189,7 @@ public function testActionReturnsContentFromSpecifiedModule() */ public function testActionReturnsContentReflectingPassedParams() { - $value = $this->helper->action('baz', 'action-foo', null, array('bat' => 'This is my message')); + $value = $this->helper->action('baz', 'action-foo', null, ['bat' => 'This is my message']); $this->assertNotContains('BOGUS', $value, var_export($this->helper->request->getUserParams(), 1)); $this->assertContains('This is my message', $value); } diff --git a/tests/Zend/View/Helper/AttributeJsEscapingTest.php b/tests/Zend/View/Helper/AttributeJsEscapingTest.php index cfcbead218..8cbe70295b 100644 --- a/tests/Zend/View/Helper/AttributeJsEscapingTest.php +++ b/tests/Zend/View/Helper/AttributeJsEscapingTest.php @@ -87,11 +87,11 @@ public function tearDown() */ public function testRendersSubmitInput() { - $html = $this->helper->formSubmit(array( + $html = $this->helper->formSubmit([ 'name' => 'foo', 'value' => 'Submit!', - 'attribs' => array('onsubmit' => array('foo', '\'bar\'', 10)) - )); + 'attribs' => ['onsubmit' => ['foo', '\'bar\'', 10]] + ]); $this->assertEquals('', $html); } } diff --git a/tests/Zend/View/Helper/BaseUrlTest.php b/tests/Zend/View/Helper/BaseUrlTest.php index 9586dd7dd5..437297c170 100644 --- a/tests/Zend/View/Helper/BaseUrlTest.php +++ b/tests/Zend/View/Helper/BaseUrlTest.php @@ -95,7 +95,7 @@ protected function tearDown() */ public function testBaseUrlIsSameAsFrontController() { - $baseUrls = array('', '/subdir', '/subdir/', '/sub/sub/dir'); + $baseUrls = ['', '/subdir', '/subdir/', '/sub/sub/dir']; foreach ($baseUrls as $baseUrl) { Zend_Controller_Front::getInstance()->setBaseUrl($baseUrl); $helper = new Zend_View_Helper_BaseUrl(); @@ -110,11 +110,11 @@ public function testBaseUrlIsSameAsFrontController() */ public function testBaseUrlIsCorrectingFilePath() { - $baseUrls = array( + $baseUrls = [ '' => '/file.js', '/subdir' => '/subdir/file.js', '/sub/sub/dir' => '/sub/sub/dir/file.js', - ); + ]; foreach ($baseUrls as $baseUrl => $val) { Zend_Controller_Front::getInstance()->setBaseUrl($baseUrl); @@ -130,11 +130,11 @@ public function testBaseUrlIsCorrectingFilePath() */ public function testBaseUrlIsAppendedWithFile() { - $baseUrls = array( + $baseUrls = [ '' => '/file.js', '/subdir' => '/subdir/file.js', '/sub/sub/dir' => '/sub/sub/dir/file.js', - ); + ]; foreach ($baseUrls as $baseUrl => $val) { Zend_Controller_Front::getInstance()->setBaseUrl($baseUrl); @@ -150,11 +150,11 @@ public function testBaseUrlIsAppendedWithFile() */ public function testBaseUrlIsAppendedWithPath() { - $baseUrls = array( + $baseUrls = [ '' => '/path/bar', '/subdir' => '/subdir/path/bar', '/sub/sub/dir' => '/sub/sub/dir/path/bar', - ); + ]; foreach ($baseUrls as $baseUrl => $val) { Zend_Controller_Front::getInstance()->setBaseUrl($baseUrl); @@ -170,10 +170,10 @@ public function testBaseUrlIsAppendedWithPath() */ public function testBaseUrlIsAppendedWithRootPath() { - $baseUrls = array( + $baseUrls = [ '' => '/', '/foo' => '/foo/' - ); + ]; foreach ($baseUrls as $baseUrl => $val) { Zend_Controller_Front::getInstance()->setBaseUrl($baseUrl); diff --git a/tests/Zend/View/Helper/CurrencyTest.php b/tests/Zend/View/Helper/CurrencyTest.php index 8535721775..de55534eff 100644 --- a/tests/Zend/View/Helper/CurrencyTest.php +++ b/tests/Zend/View/Helper/CurrencyTest.php @@ -84,8 +84,8 @@ public function setUp() $this->clearRegistry(); require_once 'Zend/Cache.php'; $this->_cache = Zend_Cache::factory('Core', 'File', - array('lifetime' => 120, 'automatic_serialization' => true), - array('cache_dir' => dirname(__FILE__) . '/../../_files/')); + ['lifetime' => 120, 'automatic_serialization' => true], + ['cache_dir' => dirname(__FILE__) . '/../../_files/']); Zend_Currency::setCache($this->_cache); $this->helper = new Zend_View_Helper_Currency('de_AT'); diff --git a/tests/Zend/View/Helper/CycleTest.php b/tests/Zend/View/Helper/CycleTest.php index 030642abf3..ce6bfb275a 100644 --- a/tests/Zend/View/Helper/CycleTest.php +++ b/tests/Zend/View/Helper/CycleTest.php @@ -87,25 +87,25 @@ public function testCycleMethodReturnsObjectInstance() public function testAssignAndGetValues() { - $this->helper->assign(array('a', 1, 'asd')); - $this->assertEquals(array('a', 1, 'asd'), $this->helper->getAll()); + $this->helper->assign(['a', 1, 'asd']); + $this->assertEquals(['a', 1, 'asd'], $this->helper->getAll()); } public function testCycleMethod() { - $this->helper->cycle(array('a', 1, 'asd')); - $this->assertEquals(array('a', 1, 'asd'), $this->helper->getAll()); + $this->helper->cycle(['a', 1, 'asd']); + $this->assertEquals(['a', 1, 'asd'], $this->helper->getAll()); } public function testToString() { - $this->helper->cycle(array('a', 1, 'asd')); + $this->helper->cycle(['a', 1, 'asd']); $this->assertEquals('a', (string) $this->helper->toString()); } public function testNextValue() { - $this->helper->assign(array('a', 1, 3)); + $this->helper->assign(['a', 1, 3]); $this->assertEquals('a', (string) $this->helper->next()); $this->assertEquals(1, (string) $this->helper->next()); $this->assertEquals(3, (string) $this->helper->next()); @@ -115,7 +115,7 @@ public function testNextValue() public function testPrevValue() { - $this->helper->assign(array(4, 1, 3)); + $this->helper->assign([4, 1, 3]); $this->assertEquals(3, (string) $this->helper->prev()); $this->assertEquals(1, (string) $this->helper->prev()); $this->assertEquals(4, (string) $this->helper->prev()); @@ -125,7 +125,7 @@ public function testPrevValue() public function testRewind() { - $this->helper->assign(array(5, 8, 3)); + $this->helper->assign([5, 8, 3]); $this->assertEquals(5, (string) $this->helper->next()); $this->assertEquals(8, (string) $this->helper->next()); $this->helper->rewind(); @@ -135,7 +135,7 @@ public function testRewind() public function testMixedMethods() { - $this->helper->assign(array(5, 8, 3)); + $this->helper->assign([5, 8, 3]); $this->assertEquals(5, (string) $this->helper->next()); $this->assertEquals(5, (string) $this->helper->current()); $this->assertEquals(8, (string) $this->helper->next()); @@ -144,17 +144,17 @@ public function testMixedMethods() public function testTwoCycles() { - $this->helper->assign(array(5, 8, 3)); + $this->helper->assign([5, 8, 3]); $this->assertEquals(5, (string) $this->helper->next()); - $this->assertEquals(2, (string) $this->helper->cycle(array(2,38,1),'cycle2')->next()); + $this->assertEquals(2, (string) $this->helper->cycle([2,38,1],'cycle2')->next()); $this->assertEquals(8, (string) $this->helper->cycle()->next()); $this->assertEquals(38, (string) $this->helper->setName('cycle2')->next()); } public function testTwoCyclesInLoop() { - $expected = array(5,4,2,3); - $expected2 = array(7,34,8,6); + $expected = [5,4,2,3]; + $expected2 = [7,34,8,6]; for($i=0;$i<4;$i++) { $this->assertEquals($expected[$i], (string) $this->helper->cycle($expected)->next()); $this->assertEquals($expected2[$i], (string) $this->helper->cycle($expected2,'cycle2')->next()); diff --git a/tests/Zend/View/Helper/DeclareVarsTest.php b/tests/Zend/View/Helper/DeclareVarsTest.php index f5b4237724..e5f6d07e99 100644 --- a/tests/Zend/View/Helper/DeclareVarsTest.php +++ b/tests/Zend/View/Helper/DeclareVarsTest.php @@ -71,10 +71,10 @@ protected function _declareVars() $this->view->declareVars( 'varName1', 'varName2', - array( + [ 'varName3' => 'defaultValue', - 'varName4' => array() - ) + 'varName4' => [] + ] ); } @@ -88,7 +88,7 @@ public function testDeclareUndeclaredVars() $this->assertTrue(isset($this->view->varName4)); $this->assertEquals('defaultValue', $this->view->varName3); - $this->assertEquals(array(), $this->view->varName4); + $this->assertEquals([], $this->view->varName4); } public function testDeclareDeclaredVars() diff --git a/tests/Zend/View/Helper/DoctypeTest.php b/tests/Zend/View/Helper/DoctypeTest.php index ea52eb10c5..b122ff17a0 100644 --- a/tests/Zend/View/Helper/DoctypeTest.php +++ b/tests/Zend/View/Helper/DoctypeTest.php @@ -117,14 +117,14 @@ public function testPassingDoctypeSetsDoctype() public function testIsXhtmlReturnsTrueForXhtmlDoctypes() { - $types = array( + $types = [ 'XHTML1_STRICT', 'XHTML1_TRANSITIONAL', 'XHTML1_FRAMESET', 'XHTML1_RDFA', 'XHTML1_RDFA11', 'XHTML5', - ); + ]; foreach ($types as $type) { $doctype = $this->helper->doctype($type); @@ -139,7 +139,7 @@ public function testIsXhtmlReturnsTrueForXhtmlDoctypes() public function testIsXhtmlReturnsFalseForNonXhtmlDoctypes() { - foreach (array('HTML4_STRICT', 'HTML4_LOOSE', 'HTML4_FRAMESET') as $type) { + foreach (['HTML4_STRICT', 'HTML4_LOOSE', 'HTML4_FRAMESET'] as $type) { $doctype = $this->helper->doctype($type); $this->assertEquals($type, $doctype->getDoctype()); $this->assertFalse($doctype->isXhtml()); @@ -151,13 +151,13 @@ public function testIsXhtmlReturnsFalseForNonXhtmlDoctypes() } public function testIsHtml5() { - foreach (array('HTML5', 'XHTML5') as $type) { + foreach (['HTML5', 'XHTML5'] as $type) { $doctype = $this->helper->doctype($type); $this->assertEquals($type, $doctype->getDoctype()); $this->assertTrue($doctype->isHtml5()); } - foreach (array('HTML4_STRICT', 'HTML4_LOOSE', 'HTML4_FRAMESET', 'XHTML1_STRICT', 'XHTML1_TRANSITIONAL', 'XHTML1_FRAMESET') as $type) { + foreach (['HTML4_STRICT', 'HTML4_LOOSE', 'HTML4_FRAMESET', 'XHTML1_STRICT', 'XHTML1_TRANSITIONAL', 'XHTML1_FRAMESET'] as $type) { $doctype = $this->helper->doctype($type); $this->assertEquals($type, $doctype->getDoctype()); $this->assertFalse($doctype->isHtml5()); @@ -170,7 +170,7 @@ public function testIsRdfa() $this->assertTrue($this->helper->doctype('XHTML1_RDFA11')->isRdfa()); // built-in doctypes - foreach (array('HTML4_STRICT', 'HTML4_LOOSE', 'HTML4_FRAMESET', 'XHTML1_STRICT', 'XHTML1_TRANSITIONAL', 'XHTML1_FRAMESET') as $type) { + foreach (['HTML4_STRICT', 'HTML4_LOOSE', 'HTML4_FRAMESET', 'XHTML1_STRICT', 'XHTML1_TRANSITIONAL', 'XHTML1_FRAMESET'] as $type) { $doctype = $this->helper->doctype($type); $this->assertFalse($doctype->isRdfa()); } diff --git a/tests/Zend/View/Helper/FieldsetTest.php b/tests/Zend/View/Helper/FieldsetTest.php index 6be3475e37..af9fd3fc09 100644 --- a/tests/Zend/View/Helper/FieldsetTest.php +++ b/tests/Zend/View/Helper/FieldsetTest.php @@ -88,7 +88,7 @@ public function testFieldsetHelperCreatesFieldsetWithProvidedContent() public function testProvidingLegendOptionToFieldsetCreatesLegendTag() { - $html = $this->helper->fieldset('foo', 'foobar', array('legend' => 'Great Scott!')); + $html = $this->helper->fieldset('foo', 'foobar', ['legend' => 'Great Scott!']); $this->assertRegexp('#Great Scott!#', $html); } @@ -97,8 +97,8 @@ public function testProvidingLegendOptionToFieldsetCreatesLegendTag() */ public function testEmptyLegendShouldNotRenderLegendTag() { - foreach (array(null, '', ' ', false) as $legend) { - $html = $this->helper->fieldset('foo', 'foobar', array('legend' => $legend)); + foreach ([null, '', ' ', false] as $legend) { + $html = $this->helper->fieldset('foo', 'foobar', ['legend' => $legend]); $this->assertNotContains('', $html, 'Failed with value ' . var_export($legend, 1) . ': ' . $html); } } @@ -108,7 +108,7 @@ public function testEmptyLegendShouldNotRenderLegendTag() */ public function testHelperShouldAllowDisablingEscapingOfLegend() { - $html = $this->helper->fieldset('foo', 'foobar', array('legend' => 'Great Scott!', 'escape' => false)); + $html = $this->helper->fieldset('foo', 'foobar', ['legend' => 'Great Scott!', 'escape' => false]); $this->assertRegexp('#Great Scott!#', $html, $html); } } diff --git a/tests/Zend/View/Helper/FormButtonTest.php b/tests/Zend/View/Helper/FormButtonTest.php index 54be7659ef..7e6c0e4a0d 100644 --- a/tests/Zend/View/Helper/FormButtonTest.php +++ b/tests/Zend/View/Helper/FormButtonTest.php @@ -88,7 +88,7 @@ public function testFormButtonRendersButtonXhtml() public function testCanPassContentViaContentAttribKey() { - $button = $this->helper->formButton('foo', 'bar', array('content' => 'Display this')); + $button = $this->helper->formButton('foo', 'bar', ['content' => 'Display this']); $this->assertContains('>Display this<', $button); $this->assertContains('assertContains('', $button); @@ -96,13 +96,13 @@ public function testCanPassContentViaContentAttribKey() public function testCanDisableContentEscaping() { - $button = $this->helper->formButton('foo', 'bar', array('content' => 'Display this', 'escape' => false)); + $button = $this->helper->formButton('foo', 'bar', ['content' => 'Display this', 'escape' => false]); $this->assertContains('>Display this<', $button); - $button = $this->helper->formButton(array('name' => 'foo', 'value' => 'bar', 'attribs' => array('content' => 'Display this', 'escape' => false))); + $button = $this->helper->formButton(['name' => 'foo', 'value' => 'bar', 'attribs' => ['content' => 'Display this', 'escape' => false]]); $this->assertContains('>Display this<', $button); - $button = $this->helper->formButton(array('name' => 'foo', 'value' => 'bar', 'escape' => false, 'attribs' => array('content' => 'Display this'))); + $button = $this->helper->formButton(['name' => 'foo', 'value' => 'bar', 'escape' => false, 'attribs' => ['content' => 'Display this']]); $this->assertContains('>Display this<', $button); $this->assertContains('assertContains('', $button); @@ -110,25 +110,25 @@ public function testCanDisableContentEscaping() public function testValueUsedForContentWhenNoContentProvided() { - $button = $this->helper->formButton(array('name' => 'foo', 'value' => 'bar')); + $button = $this->helper->formButton(['name' => 'foo', 'value' => 'bar']); $this->assertRegexp('#]*?value="bar"[^>]*>bar#', $button); } public function testButtonTypeIsButtonByDefault() { - $button = $this->helper->formButton(array('name' => 'foo', 'value' => 'bar')); + $button = $this->helper->formButton(['name' => 'foo', 'value' => 'bar']); $this->assertContains('type="button"', $button); } public function testButtonTypeMayOnlyBeValidXhtmlButtonType() { - $button = $this->helper->formButton(array('name' => 'foo', 'value' => 'bar', 'attribs' => array('type' => 'submit'))); + $button = $this->helper->formButton(['name' => 'foo', 'value' => 'bar', 'attribs' => ['type' => 'submit']]); $this->assertContains('type="submit"', $button); - $button = $this->helper->formButton(array('name' => 'foo', 'value' => 'bar', 'attribs' => array('type' => 'reset'))); + $button = $this->helper->formButton(['name' => 'foo', 'value' => 'bar', 'attribs' => ['type' => 'reset']]); $this->assertContains('type="reset"', $button); - $button = $this->helper->formButton(array('name' => 'foo', 'value' => 'bar', 'attribs' => array('type' => 'button'))); + $button = $this->helper->formButton(['name' => 'foo', 'value' => 'bar', 'attribs' => ['type' => 'button']]); $this->assertContains('type="button"', $button); - $button = $this->helper->formButton(array('name' => 'foo', 'value' => 'bar', 'attribs' => array('type' => 'bogus'))); + $button = $this->helper->formButton(['name' => 'foo', 'value' => 'bar', 'attribs' => ['type' => 'bogus']]); $this->assertContains('type="button"', $button); } } diff --git a/tests/Zend/View/Helper/FormCheckboxTest.php b/tests/Zend/View/Helper/FormCheckboxTest.php index b762870abb..31e1870ba9 100644 --- a/tests/Zend/View/Helper/FormCheckboxTest.php +++ b/tests/Zend/View/Helper/FormCheckboxTest.php @@ -76,7 +76,7 @@ public function testIdSetFromName() public function testSetIdFromAttribs() { - $element = $this->helper->formCheckbox('foo', null, array('id' => 'bar')); + $element = $this->helper->formCheckbox('foo', null, ['id' => 'bar']); $this->assertContains('name="foo"', $element); $this->assertContains('id="bar"', $element); } @@ -86,11 +86,11 @@ public function testSetIdFromAttribs() */ public function testCanDisableCheckbox() { - $html = $this->helper->formCheckbox(array( + $html = $this->helper->formCheckbox([ 'name' => 'foo', 'value' => 'bar', - 'attribs'=> array('disable' => true) - )); + 'attribs'=> ['disable' => true] + ]); $this->assertRegexp('/]*?(disabled="disabled")/', $html); } @@ -99,21 +99,21 @@ public function testCanDisableCheckbox() */ public function testCheckboxNotDisabled() { - $html = $this->helper->formCheckbox(array( + $html = $this->helper->formCheckbox([ 'name' => 'foo', 'value' => 'bar', - 'attribs'=> array('disable' => false) - )); + 'attribs'=> ['disable' => false] + ]); $this->assertNotContains('disabled="disabled"', $html); } public function testCanSelectCheckbox() { - $html = $this->helper->formCheckbox(array( + $html = $this->helper->formCheckbox([ 'name' => 'foo', 'value' => 'bar', - 'attribs'=> array('checked' => true) - )); + 'attribs'=> ['checked' => true] + ]); $this->assertRegexp('/]*?(checked="checked")/', $html); $count = substr_count($html, 'checked'); $this->assertEquals(2, $count); @@ -124,22 +124,22 @@ public function testCanSelectCheckbox() */ public function testNameBracketsStrippedWhenCreatingId() { - $html = $this->helper->formCheckbox(array( + $html = $this->helper->formCheckbox([ 'name' => 'foo[]', 'value' => 'bar' - )); + ]); $this->assertRegexp('/]*?(id="foo")/', $html); - $html = $this->helper->formCheckbox(array( + $html = $this->helper->formCheckbox([ 'name' => 'foo[bar]', 'value' => 'bar' - )); + ]); $this->assertRegexp('/]*?(id="foo-bar")/', $html); - $html = $this->helper->formCheckbox(array( + $html = $this->helper->formCheckbox([ 'name' => 'foo[bar][baz]', 'value' => 'bar' - )); + ]); $this->assertRegexp('/]*?(id="foo-bar-baz")/', $html); } @@ -148,10 +148,10 @@ public function testNameBracketsStrippedWhenCreatingId() */ public function testDoesNotRenderHiddenElementsForCheckboxArray() { - $html = $this->helper->formCheckbox(array( + $html = $this->helper->formCheckbox([ 'name' => 'foo[]', 'value' => 'bar' - )); + ]); $this->assertNotRegexp('/]*?(type="hidden")/', $html); } @@ -163,40 +163,40 @@ public function testShouldRenderHiddenElementShowingUncheckedOptionForNonArrayNa $html1 = $this->helper->formCheckbox( 'foo', 'bar', - array('checked' => true), - array( + ['checked' => true], + [ 'checked' => 'bar', 'unChecked' => 'baz' - ) + ] ); $html2 = $this->helper->formCheckbox( 'foo', 'bar', - array('checked' => true), - array( + ['checked' => true], + [ 'bar', 'baz' - ) + ] ); $html3 = $this->helper->formCheckbox( 'foo', 'bar', - array('checked' => false), - array( + ['checked' => false], + [ 'checked' => 'bar', 'unChecked' => 'baz' - ) + ] ); $html4 = $this->helper->formCheckbox( 'foo', 'bar', - array('checked' => false), - array( + ['checked' => false], + [ 'bar', 'baz' - ) + ] ); - foreach (array('html1', 'html2', 'html3', 'html4') as $html) { + foreach (['html1', 'html2', 'html3', 'html4'] as $html) { if (!preg_match_all('/(]+>)/', $$html, $matches)) { $this->fail('Unexpected output generated by helper'); } @@ -217,7 +217,7 @@ public function testShouldRenderHiddenElementShowingUncheckedOptionForNonArrayNa */ public function testCheckedAttributeNotRenderedIfItEvaluatesToFalse() { - $test = $this->helper->formCheckbox('foo', 'value', array('checked' => false)); + $test = $this->helper->formCheckbox('foo', 'value', ['checked' => false]); $this->assertNotContains('checked', $test); } @@ -232,11 +232,11 @@ public function testCanSpecifyValue() */ public function testShouldCheckValueIfValueMatchesCheckedOption() { - $test = $this->helper->formCheckbox('foo', 'bar', array(), array('bar', 'baz')); + $test = $this->helper->formCheckbox('foo', 'bar', [], ['bar', 'baz']); $this->assertContains('value="bar"', $test); $this->assertContains('checked', $test); - $test = $this->helper->formCheckbox('foo', 'bar', array(), array('checked' => 'bar', 'unChecked' => 'baz')); + $test = $this->helper->formCheckbox('foo', 'bar', [], ['checked' => 'bar', 'unChecked' => 'baz']); $this->assertContains('value="bar"', $test); $this->assertContains('checked', $test); } @@ -246,7 +246,7 @@ public function testShouldCheckValueIfValueMatchesCheckedOption() */ public function testShouldOnlySetValueIfValueMatchesCheckedOption() { - $test = $this->helper->formCheckbox('foo', 'baz', array(), array('bar', 'baz')); + $test = $this->helper->formCheckbox('foo', 'baz', [], ['bar', 'baz']); $this->assertContains('value="bar"', $test); } @@ -255,7 +255,7 @@ public function testShouldOnlySetValueIfValueMatchesCheckedOption() */ public function testShouldNotCheckValueIfValueDoesNotMatchCheckedOption() { - $test = $this->helper->formCheckbox('foo', 'baz', array(), array('bar', 'baz')); + $test = $this->helper->formCheckbox('foo', 'baz', [], ['bar', 'baz']); $this->assertContains('value="bar"', $test); $this->assertNotContains('checked', $test); } @@ -278,28 +278,28 @@ public function testCanRendersAsXHtml() */ public function testShouldNotShowHiddenFieldIfDisableIsTrue() { - $test = $this->helper->formCheckbox('foo', 'bar', array('disable' => true)); + $test = $this->helper->formCheckbox('foo', 'bar', ['disable' => true]); $this->assertNotContains('type="hidden"', $test); } public function testIntValueIsChecked() { - $test = $this->helper->formCheckbox('foo', '1', array(), array('checked'=>1, 'unchecked'=>0)); + $test = $this->helper->formCheckbox('foo', '1', [], ['checked'=>1, 'unchecked'=>0]); $this->assertContains('checked="checked"', $test); - $test = $this->helper->formCheckbox('foo', '1', array(), array(1,0)); + $test = $this->helper->formCheckbox('foo', '1', [], [1,0]); $this->assertContains('checked="checked"', $test); - $test = $this->helper->formCheckbox('foo', 1, array(), array('checked'=>1, 'unchecked'=>0)); + $test = $this->helper->formCheckbox('foo', 1, [], ['checked'=>1, 'unchecked'=>0]); $this->assertContains('checked="checked"', $test); - $test = $this->helper->formCheckbox('foo', 1, array(), array(1,0)); + $test = $this->helper->formCheckbox('foo', 1, [], [1,0]); $this->assertContains('checked="checked"', $test); - $test = $this->helper->formCheckbox('foo', 0, array(), array('checked'=>1, 'unchecked'=>0)); + $test = $this->helper->formCheckbox('foo', 0, [], ['checked'=>1, 'unchecked'=>0]); $this->assertNotContains('checked="checked"', $test); - $test = $this->helper->formCheckbox('foo', 0, array(), array(1,0)); + $test = $this->helper->formCheckbox('foo', 0, [], [1,0]); $this->assertNotContains('checked="checked"', $test); } @@ -311,9 +311,9 @@ public function testRenderingWithoutHiddenElement() $html = $this->helper->formCheckbox( 'foo', 'bar', - array( + [ 'disableHidden' => true, - ) + ] ); $this->assertSame( '', @@ -332,9 +332,9 @@ public function testRenderingWithoutHiddenElement() $html = $this->helper->formCheckbox( 'foo', 'bar', - array( + [ 'disableHidden' => false, - ) + ] ); $this->assertSame( diff --git a/tests/Zend/View/Helper/FormErrorsTest.php b/tests/Zend/View/Helper/FormErrorsTest.php index 1ec64f26fb..94a0c8b912 100644 --- a/tests/Zend/View/Helper/FormErrorsTest.php +++ b/tests/Zend/View/Helper/FormErrorsTest.php @@ -116,7 +116,7 @@ public function testCanSetElementStartString() public function testFormErrorsRendersUnorderedListByDefault() { - $errors = array('foo', 'bar', 'baz'); + $errors = ['foo', 'bar', 'baz']; $html = $this->helper->formErrors($errors); $this->assertContains('helper->setElementStart('
          ') ->setElementSeparator('
          ') ->setElementEnd('
          '); - $errors = array('foo', 'bar', 'baz'); + $errors = ['foo', 'bar', 'baz']; $html = $this->helper->formErrors($errors); $this->assertContains('
          ', $html); foreach ($errors as $error) { @@ -141,9 +141,9 @@ public function testFormErrorsRendersWithSpecifiedStrings() public function testFormErrorsPreventsXssAttacks() { - $errors = array( + $errors = [ 'bad' => '\">', - ); + ]; $html = $this->helper->formErrors($errors); $this->assertNotContains($errors['bad'], $html); $this->assertContains('&', $html); @@ -151,11 +151,11 @@ public function testFormErrorsPreventsXssAttacks() public function testCanDisableEscapingErrorMessages() { - $errors = array( + $errors = [ 'foo' => 'Field is required', 'bar' => 'Please click here for more information' - ); - $html = $this->helper->formErrors($errors, array('escape' => false)); + ]; + $html = $this->helper->formErrors($errors, ['escape' => false]); $this->assertContains($errors['foo'], $html); $this->assertContains($errors['bar'], $html); } @@ -166,8 +166,8 @@ public function testCanDisableEscapingErrorMessages() */ public function testCanSetClassAttribute() { - $options = array('class' => 'custom-class'); - $actualHtml = $this->helper->formErrors(array(), $options); + $options = ['class' => 'custom-class']; + $actualHtml = $this->helper->formErrors([], $options); $this->assertEquals( '
          ', $actualHtml @@ -180,12 +180,12 @@ public function testCanSetClassAttribute() public function testCanSetElementStringsPerOptions() { $actual = $this->helper->formErrors( - array('foo', 'bar', 'baz'), - array( + ['foo', 'bar', 'baz'], + [ 'elementStart' => '

          ', 'elementEnd' => '

          ', 'elementSeparator' => '
          ', - ) + ] ); $this->assertEquals('

          foo
          bar
          baz

          ', $actual); diff --git a/tests/Zend/View/Helper/FormFileTest.php b/tests/Zend/View/Helper/FormFileTest.php index d937656f30..875347bbe3 100644 --- a/tests/Zend/View/Helper/FormFileTest.php +++ b/tests/Zend/View/Helper/FormFileTest.php @@ -88,10 +88,10 @@ protected function setUp() */ public function testCanDisableElement() { - $html = $this->helper->formFile(array( + $html = $this->helper->formFile([ 'name' => 'foo', - 'attribs' => array('disable' => true) - )); + 'attribs' => ['disable' => true] + ]); $this->assertRegexp('/]*?(disabled="disabled")/', $html); } @@ -101,10 +101,10 @@ public function testCanDisableElement() */ public function testDisablingElementDoesNotRenderHiddenElements() { - $html = $this->helper->formFile(array( + $html = $this->helper->formFile([ 'name' => 'foo', - 'attribs' => array('disable' => true) - )); + 'attribs' => ['disable' => true] + ]); $this->assertNotRegexp('/]*?(type="hidden")/', $html); } @@ -112,18 +112,18 @@ public function testDisablingElementDoesNotRenderHiddenElements() public function testRendersAsHtmlByDefault() { - $test = $this->helper->formFile(array( + $test = $this->helper->formFile([ 'name' => 'foo', - )); + ]); $this->assertNotContains(' />', $test); } public function testCanRendersAsXHtml() { $this->view->doctype('XHTML1_STRICT'); - $test = $this->helper->formFile(array( + $test = $this->helper->formFile([ 'name' => 'foo', - )); + ]); $this->assertContains(' />', $test); } @@ -134,10 +134,10 @@ public function testRendersCustomAttributes() { $test = $this->helper->formFile( 'foo', - array( + [ 'data-image-old' => 100, 'data-image-new' => 200, - ) + ] ); $this->assertEquals( '', diff --git a/tests/Zend/View/Helper/FormImageTest.php b/tests/Zend/View/Helper/FormImageTest.php index ea9c503b6e..320819fd04 100644 --- a/tests/Zend/View/Helper/FormImageTest.php +++ b/tests/Zend/View/Helper/FormImageTest.php @@ -88,7 +88,7 @@ public function testFormImageRendersFormImageXhtml() public function testDisablingFormImageRendersImageInputWithDisableAttribute() { - $button = $this->helper->formImage('foo', 'bar', array('disable' => true)); + $button = $this->helper->formImage('foo', 'bar', ['disable' => true]); $this->assertRegexp('/]*?disabled="disabled"/', $button); $this->assertRegexp('/]*?src="bar"/', $button); $this->assertRegexp('/]*?name="foo"/', $button); @@ -100,9 +100,9 @@ public function testDisablingFormImageRendersImageInputWithDisableAttribute() */ public function testRendersAsHtmlByDefault() { - $test = $this->helper->formImage(array( + $test = $this->helper->formImage([ 'name' => 'foo', - )); + ]); $this->assertNotContains(' />', $test); } @@ -112,9 +112,9 @@ public function testRendersAsHtmlByDefault() public function testCanRendersAsXHtml() { $this->view->doctype('XHTML1_STRICT'); - $test = $this->helper->formImage(array( + $test = $this->helper->formImage([ 'name' => 'foo', - )); + ]); $this->assertContains(' />', $test); } } diff --git a/tests/Zend/View/Helper/FormLabelTest.php b/tests/Zend/View/Helper/FormLabelTest.php index cba07313be..e5057a5618 100644 --- a/tests/Zend/View/Helper/FormLabelTest.php +++ b/tests/Zend/View/Helper/FormLabelTest.php @@ -100,13 +100,13 @@ public function testViewIsSetAndSameAsCallingViewObject() public function testAttribsAreSet() { - $label = $this->helper->formLabel('foo', 'bar', array('class' => 'baz')); + $label = $this->helper->formLabel('foo', 'bar', ['class' => 'baz']); $this->assertEquals('', $label); } public function testNameAndIdForZF2154() { - $label = $this->helper->formLabel('name', 'value', array('id' => 'id')); + $label = $this->helper->formLabel('name', 'value', ['id' => 'id']); $this->assertEquals('', $label); } @@ -115,11 +115,11 @@ public function testNameAndIdForZF2154() */ public function testCanDisableEscapingLabelValue() { - $label = $this->helper->formLabel('foo', 'Label This!', array('escape' => false)); + $label = $this->helper->formLabel('foo', 'Label This!', ['escape' => false]); $this->assertContains('Label This!', $label); - $label = $this->helper->formLabel(array('name' => 'foo', 'value' => 'Label This!', 'escape' => false)); + $label = $this->helper->formLabel(['name' => 'foo', 'value' => 'Label This!', 'escape' => false]); $this->assertContains('Label This!', $label); - $label = $this->helper->formLabel(array('name' => 'foo', 'value' => 'Label This!', 'attribs' => array('escape' => false))); + $label = $this->helper->formLabel(['name' => 'foo', 'value' => 'Label This!', 'attribs' => ['escape' => false]]); $this->assertContains('Label This!', $label); } @@ -128,7 +128,7 @@ public function testCanDisableEscapingLabelValue() */ public function testHelperShouldAllowSuppressionOfForAttribute() { - $label = $this->helper->formLabel('foo', 'bar', array('disableFor' => true)); + $label = $this->helper->formLabel('foo', 'bar', ['disableFor' => true]); $this->assertNotContains('for="foo"', $label); } @@ -137,7 +137,7 @@ public function testHelperShouldAllowSuppressionOfForAttribute() */ public function testShouldNotRenderDisableForAttributeIfForIsSuppressed() { - $label = $this->helper->formLabel('foo', 'bar', array('disableFor' => true)); + $label = $this->helper->formLabel('foo', 'bar', ['disableFor' => true]); $this->assertNotContains('disableFor=', $label, 'Output contains disableFor attribute!'); } } diff --git a/tests/Zend/View/Helper/FormMultiCheckboxTest.php b/tests/Zend/View/Helper/FormMultiCheckboxTest.php index 68631a6480..656599a366 100644 --- a/tests/Zend/View/Helper/FormMultiCheckboxTest.php +++ b/tests/Zend/View/Helper/FormMultiCheckboxTest.php @@ -84,16 +84,16 @@ public function tearDown() public function testMultiCheckboxHelperRendersLabelledCheckboxesForEachOption() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formMultiCheckbox(array( + ]; + $html = $this->helper->formMultiCheckbox([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - )); + ]); foreach ($options as $key => $value) { $pattern = '#((]*>.*?)(]*?("' . $key . '").*?>)(.*?))#'; if (!preg_match($pattern, $html, $matches)) { @@ -108,16 +108,16 @@ public function testMultiCheckboxHelperRendersLabelledCheckboxesForEachOption() public function testRendersAsHtmlByDefault() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formMultiCheckbox(array( + ]; + $html = $this->helper->formMultiCheckbox([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - )); + ]); foreach ($options as $key => $value) { $pattern = '#(]*?("' . $key . '").*?>)#'; if (!preg_match($pattern, $html, $matches)) { @@ -130,16 +130,16 @@ public function testRendersAsHtmlByDefault() public function testCanRendersAsXHtml() { $this->view->doctype('XHTML1_STRICT'); - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formMultiCheckbox(array( + ]; + $html = $this->helper->formMultiCheckbox([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - )); + ]); foreach ($options as $key => $value) { $pattern = '#(]*?("' . $key . '").*?>)#'; if (!preg_match($pattern, $html, $matches)) { diff --git a/tests/Zend/View/Helper/FormPasswordTest.php b/tests/Zend/View/Helper/FormPasswordTest.php index 1197087d4f..3b237e86d4 100644 --- a/tests/Zend/View/Helper/FormPasswordTest.php +++ b/tests/Zend/View/Helper/FormPasswordTest.php @@ -78,11 +78,11 @@ protected function setUp() */ public function testCanDisableElement() { - $html = $this->helper->formPassword(array( + $html = $this->helper->formPassword([ 'name' => 'foo', 'value' => 'bar', - 'attribs' => array('disable' => true) - )); + 'attribs' => ['disable' => true] + ]); $this->assertRegexp('/]*?(disabled="disabled")/', $html); } @@ -92,11 +92,11 @@ public function testCanDisableElement() */ public function testDisablingElementDoesNotRenderHiddenElements() { - $html = $this->helper->formPassword(array( + $html = $this->helper->formPassword([ 'name' => 'foo', 'value' => 'bar', - 'attribs' => array('disable' => true) - )); + 'attribs' => ['disable' => true] + ]); $this->assertNotRegexp('/]*?(type="hidden")/', $html); } @@ -125,7 +125,7 @@ public function testShouldNotRenderValueByDefault() */ public function testShouldRenderValueWhenRenderPasswordFlagPresentAndTrue() { - $test = $this->helper->formPassword('foo', 'bar', array('renderPassword' => true)); + $test = $this->helper->formPassword('foo', 'bar', ['renderPassword' => true]); $this->assertContains('value="bar"', $test); } @@ -134,9 +134,9 @@ public function testShouldRenderValueWhenRenderPasswordFlagPresentAndTrue() */ public function testRenderPasswordAttribShouldNeverBeRendered() { - $test = $this->helper->formPassword('foo', 'bar', array('renderPassword' => true)); + $test = $this->helper->formPassword('foo', 'bar', ['renderPassword' => true]); $this->assertNotContains('renderPassword', $test); - $test = $this->helper->formPassword('foo', 'bar', array('renderPassword' => false)); + $test = $this->helper->formPassword('foo', 'bar', ['renderPassword' => false]); $this->assertNotContains('renderPassword', $test); } } diff --git a/tests/Zend/View/Helper/FormRadioTest.php b/tests/Zend/View/Helper/FormRadioTest.php index 9ce69f7ee7..f44e65be73 100644 --- a/tests/Zend/View/Helper/FormRadioTest.php +++ b/tests/Zend/View/Helper/FormRadioTest.php @@ -66,16 +66,16 @@ public function setUp() public function testRendersRadioLabelsWhenRenderingMultipleOptions() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - )); + ]); foreach ($options as $key => $value) { $this->assertRegexp('#.*?' . $value . '.*?#', $html, $html); $this->assertRegexp('#.*?#', $html, $html); @@ -84,27 +84,27 @@ public function testRendersRadioLabelsWhenRenderingMultipleOptions() public function testCanSpecifyRadioLabelPlacement() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - 'attribs' => array('labelPlacement' => 'append') - )); + 'attribs' => ['labelPlacement' => 'append'] + ]); foreach ($options as $key => $value) { $this->assertRegexp('#.*?#', $html, $html); } - $html = $this->helper->formRadio(array( + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - 'attribs' => array('labelPlacement' => 'prepend') - )); + 'attribs' => ['labelPlacement' => 'prepend'] + ]); foreach ($options as $key => $value) { $this->assertRegexp('#' . $value . '#', $html, $html); } @@ -115,33 +115,33 @@ public function testCanSpecifyRadioLabelPlacement() */ public function testSpecifyingLabelPlacementShouldNotOverwriteValue() { - $options = array( + $options = [ 'bar' => 'Bar', - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - 'attribs' => array( + 'attribs' => [ 'labelPlacement' => 'append', - ) - )); + ] + ]); $this->assertRegexp('#]*(checked="checked")#', $html, $html); } public function testCanSpecifyRadioLabelAttribs() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - 'attribs' => array('labelClass' => 'testclass', 'label_id' => 'testid') - )); + 'attribs' => ['labelClass' => 'testclass', 'label_id' => 'testid'] + ]); foreach ($options as $key => $value) { $this->assertRegexp('#]*?class="testclass"[^>]*>.*?' . $value . '#', $html, $html); @@ -151,17 +151,17 @@ public function testCanSpecifyRadioLabelAttribs() public function testCanSpecifyRadioSeparator() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, 'listsep' => '--FunkySep--', - )); + ]); $this->assertContains('--FunkySep--', $html); $count = substr_count($html, '--FunkySep--'); @@ -173,17 +173,17 @@ public function testCanSpecifyRadioSeparator() */ public function testCanDisableAllRadios() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - 'attribs' => array('disable' => true) - )); + 'attribs' => ['disable' => true] + ]); $this->assertRegexp('/]*?(disabled="disabled")/', $html, $html); $count = substr_count($html, 'disabled="disabled"'); @@ -195,17 +195,17 @@ public function testCanDisableAllRadios() */ public function testCanDisableIndividualRadios() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - 'attribs' => array('disable' => array('bar')) - )); + 'attribs' => ['disable' => ['bar']] + ]); $this->assertRegexp('/]*?(value="bar")[^>]*(disabled="disabled")/', $html, $html); $count = substr_count($html, 'disabled="disabled"'); @@ -217,19 +217,19 @@ public function testCanDisableIndividualRadios() */ public function testCanDisableMultipleRadios() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - 'attribs' => array('disable' => array('foo', 'baz')) - )); + 'attribs' => ['disable' => ['foo', 'baz']] + ]); - foreach (array('foo', 'baz') as $test) { + foreach (['foo', 'baz'] as $test) { $this->assertRegexp('/]*?(value="' . $test . '")[^>]*?(disabled="disabled")/', $html, $html); } $this->assertNotRegexp('/]*?(value="bar")[^>]*?(disabled="disabled")/', $html, $html); @@ -239,13 +239,13 @@ public function testCanDisableMultipleRadios() public function testLabelsAreEscapedByDefault() { - $options = array( + $options = [ 'bar' => 'Bar', - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'options' => $options, - )); + ]); $this->assertNotContains($options['bar'], $html); $this->assertContains('<b>Bar</b>', $html); @@ -253,14 +253,14 @@ public function testLabelsAreEscapedByDefault() public function testXhtmlLabelsAreAllowed() { - $options = array( + $options = [ 'bar' => 'Bar', - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'options' => $options, - 'attribs' => array('escape' => false) - )); + 'attribs' => ['escape' => false] + ]); $this->assertContains($options['bar'], $html); } @@ -270,31 +270,31 @@ public function testXhtmlLabelsAreAllowed() */ public function testDoesNotRenderHiddenElements() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'options' => $options, - )); + ]); $this->assertNotRegexp('/]*?(type="hidden")/', $html); } public function testSpecifyingAValueThatMatchesAnOptionChecksIt() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - )); + ]); if (!preg_match('/(]*?(value="bar")[^>]*>)/', $html, $matches)) { $this->fail('Radio for a given option was not found?'); @@ -304,18 +304,18 @@ public function testSpecifyingAValueThatMatchesAnOptionChecksIt() public function testOptionsWithMatchesInAnArrayOfValuesAreChecked() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', - 'value' => array('foo', 'baz'), + 'value' => ['foo', 'baz'], 'options' => $options, - )); + ]); - foreach (array('foo', 'baz') as $value) { + foreach (['foo', 'baz'] as $value) { if (!preg_match('/(]*?(value="' . $value . '")[^>]*>)/', $html, $matches)) { $this->fail('Radio for a given option was not found?'); } @@ -325,16 +325,16 @@ public function testOptionsWithMatchesInAnArrayOfValuesAreChecked() public function testEachRadioShouldHaveIdCreatedByAppendingFilteredValue() { - $options = array( + $options = [ 'foo bar' => 'Foo', 'bar baz' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo[]', 'value' => 'bar', 'options' => $options, - )); + ]); require_once 'Zend/Filter/Alnum.php'; $filter = new Zend_Filter_Alnum(); @@ -346,17 +346,17 @@ public function testEachRadioShouldHaveIdCreatedByAppendingFilteredValue() public function testEachRadioShouldUseAttributeIdWhenSpecified() { - $options = array( + $options = [ 'foo bar' => 'Foo', 'bar baz' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo[bar]', 'value' => 'bar', - 'attribs' => array('id' => 'foo-bar'), + 'attribs' => ['id' => 'foo-bar'], 'options' => $options, - )); + ]); require_once 'Zend/Filter/Alnum.php'; $filter = new Zend_Filter_Alnum(); @@ -371,16 +371,16 @@ public function testEachRadioShouldUseAttributeIdWhenSpecified() */ public function testRadioLabelDoesNotContainHardCodedStyle() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - )); + ]); $this->assertNotContains('style="white-space: nowrap;"', $html); } @@ -390,13 +390,13 @@ public function testRadioLabelDoesNotContainHardCodedStyle() public function testRadioLabelContainsNotForAttributeTag() { $actual = $this->helper->formRadio( - array( + [ 'name' => 'foo', - 'options' => array( + 'options' => [ 'bar' => 'Bar', 'baz' => 'Baz' - ), - ) + ], + ] ); $expected = '
          ' @@ -412,11 +412,11 @@ public function testRadioLabelContainsNotForAttributeTag() public function testDashesShouldNotBeFilteredFromId() { $name = "Foo"; - $options = array( + $options = [ -1 => 'Test -1', 0 => 'Test 0', 1 => 'Test 1' - ); + ]; $formRadio = new Zend_View_Helper_FormRadio(); $formRadio->setView(new Zend_View()); @@ -435,15 +435,15 @@ public function testDashesShouldNotBeFilteredFromId() */ public function testRendersAsHtmlByDefault() { - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'options' => $options, - )); + ]); $this->assertContains('value="foo">', $html); $this->assertContains('value="bar">', $html); @@ -456,15 +456,15 @@ public function testRendersAsHtmlByDefault() public function testCanRendersAsXHtml() { $this->view->doctype('XHTML1_STRICT'); - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'options' => $options, - )); + ]); $this->assertContains('value="foo" />', $html); $this->assertContains('value="bar" />', $html); $this->assertContains('value="baz" />', $html); @@ -476,16 +476,16 @@ public function testCanRendersAsXHtml() public function testSeparatorCanRendersAsXhtmlByDefault() { $this->view->doctype('XHTML1_STRICT'); - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - )); + ]); $this->assertContains('
          ', $html); $count = substr_count($html, '
          '); @@ -498,16 +498,16 @@ public function testSeparatorCanRendersAsXhtmlByDefault() public function testeparatorCanRendersAsHtml() { $this->view->doctype('HTML4_STRICT'); - $options = array( + $options = [ 'foo' => 'Foo', 'bar' => 'Bar', 'baz' => 'Baz' - ); - $html = $this->helper->formRadio(array( + ]; + $html = $this->helper->formRadio([ 'name' => 'foo', 'value' => 'bar', 'options' => $options, - )); + ]); $this->assertContains('
          ', $html); $count = substr_count($html, '
          '); diff --git a/tests/Zend/View/Helper/FormResetTest.php b/tests/Zend/View/Helper/FormResetTest.php index ad2208612a..84d6f36a1b 100644 --- a/tests/Zend/View/Helper/FormResetTest.php +++ b/tests/Zend/View/Helper/FormResetTest.php @@ -83,10 +83,10 @@ public function tearDown() public function testShouldRenderResetInput() { - $html = $this->helper->formReset(array( + $html = $this->helper->formReset([ 'name' => 'foo', 'value' => 'Reset', - )); + ]); $this->assertRegexp('/]*?(type="reset")/', $html); } @@ -95,11 +95,11 @@ public function testShouldRenderResetInput() */ public function testShouldAllowDisabling() { - $html = $this->helper->formReset(array( + $html = $this->helper->formReset([ 'name' => 'foo', 'value' => 'Reset', - 'attribs' => array('disable' => true) - )); + 'attribs' => ['disable' => true] + ]); $this->assertRegexp('/]*?(disabled="disabled")/', $html); } diff --git a/tests/Zend/View/Helper/FormSelectTest.php b/tests/Zend/View/Helper/FormSelectTest.php index 7b32134321..7b9047506f 100644 --- a/tests/Zend/View/Helper/FormSelectTest.php +++ b/tests/Zend/View/Helper/FormSelectTest.php @@ -85,10 +85,10 @@ public function testRenderingWithOptions() 'foo', null, null, - array( + [ 'bar' => 'Bar', 'baz' => 'Baz', - ) + ] ); $expected = '', $html); $this->assertRegExp('#]+value="foo".*?>Foobar#', $html); @@ -122,20 +122,20 @@ public function testFormSelectWithOptionsCreatesPopulatedSelect() public function testFormSelectWithOptionsAndValueSelectsAppropriateValue() { - $html = $this->helper->formSelect('foo', 'baz', null, array('foo' => 'Foobar', 'baz' => 'Bazbat')); + $html = $this->helper->formSelect('foo', 'baz', null, ['foo' => 'Foobar', 'baz' => 'Bazbat']); $this->assertRegExp('#]+value="baz"[^>]*selected.*?>Bazbat#', $html); } public function testFormSelectWithMultipleAttributeCreatesMultiSelect() { - $html = $this->helper->formSelect('foo', null, array('multiple' => true), array('foo' => 'Foobar', 'baz' => 'Bazbat')); + $html = $this->helper->formSelect('foo', null, ['multiple' => true], ['foo' => 'Foobar', 'baz' => 'Bazbat']); $this->assertRegExp('#]+name="foo\[\]"#', $html); $this->assertRegExp('#]+multiple="multiple"#', $html); } public function testFormSelectWithMultipleAttributeAndValuesCreatesMultiSelectWithSelectedValues() { - $html = $this->helper->formSelect('foo', array('foo', 'baz'), array('multiple' => true), array('foo' => 'Foobar', 'baz' => 'Bazbat')); + $html = $this->helper->formSelect('foo', ['foo', 'baz'], ['multiple' => true], ['foo' => 'Foobar', 'baz' => 'Bazbat']); $this->assertRegExp('#]+value="foo"[^>]*selected.*?>Foobar#', $html); $this->assertRegExp('#]+value="baz"[^>]*selected.*?>Bazbat#', $html); } @@ -146,7 +146,7 @@ public function testFormSelectWithMultipleAttributeAndValuesCreatesMultiSelectWi */ public function testFormSelectWithZeroValueSelectsValue() { - $html = $this->helper->formSelect('foo', 0, null, array('foo' => 'Foobar', 0 => 'Bazbat')); + $html = $this->helper->formSelect('foo', 0, null, ['foo' => 'Foobar', 0 => 'Bazbat']); $this->assertRegExp('#]+value="0"[^>]*selected.*?>Bazbat#', $html); } @@ -155,16 +155,16 @@ public function testFormSelectWithZeroValueSelectsValue() */ public function testCanDisableEntireSelect() { - $html = $this->helper->formSelect(array( + $html = $this->helper->formSelect([ 'name' => 'baz', - 'options' => array( + 'options' => [ 'foo' => 'Foo', 'bar' => 'Bar' - ), - 'attribs' => array( + ], + 'attribs' => [ 'disable' => true - ), - )); + ], + ]); $this->assertRegexp('/]*?disabled/', $html, $html); $this->assertNotRegexp('/]*?disabled="disabled"/', $html, $html); } @@ -174,29 +174,29 @@ public function testCanDisableEntireSelect() */ public function testCanDisableIndividualSelectOptionsOnly() { - $html = $this->helper->formSelect(array( + $html = $this->helper->formSelect([ 'name' => 'baz', - 'options' => array( + 'options' => [ 'foo' => 'Foo', 'bar' => 'Bar' - ), - 'attribs' => array( - 'disable' => array('bar') - ), - )); + ], + 'attribs' => [ + 'disable' => ['bar'] + ], + ]); $this->assertNotRegexp('/]*?disabled/', $html, $html); $this->assertRegexp('/