Issue #2400407 by hussainweb: Update Zend Framework library to latest version.

8.0.x
webchick 2015-09-04 12:41:47 -07:00
parent a012eff424
commit fbb6e926d7
232 changed files with 1826 additions and 737 deletions

View File

@ -25,7 +25,7 @@
"symfony-cmf/routing": "1.3.*",
"easyrdf/easyrdf": "0.9.*",
"phpunit/phpunit": "4.8.*",
"zendframework/zend-feed": "2.4.*",
"zendframework/zend-feed": "~2.4",
"mikey179/vfsStream": "~1.2",
"stack/builder": "1.0.*",
"egulias/email-validator": "1.2.*",
@ -34,7 +34,7 @@
"fabpot/goutte": "~3.1",
"masterminds/html5": "~2.1",
"symfony/psr-http-message-bridge": "v0.2",
"zendframework/zend-diactoros": "1.1.0"
"zendframework/zend-diactoros": "~1.1"
},
"replace": {
"drupal/action": "self.version",

102
core/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "98540c017d14f1cad9f0b1bc722600ad",
"hash": "32a7f1295f8f5ccdf8b5759f9eb6e626",
"packages": [
{
"name": "behat/mink",
@ -3163,16 +3163,16 @@
},
{
"name": "zendframework/zend-diactoros",
"version": "1.1.0",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-diactoros.git",
"reference": "df65f70fc36f24d51a90ad706a09cd9b74fc4dd8"
"reference": "e2f5c12916c74da384058d0dfbc7fbc0b03d1181"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/df65f70fc36f24d51a90ad706a09cd9b74fc4dd8",
"reference": "df65f70fc36f24d51a90ad706a09cd9b74fc4dd8",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/e2f5c12916c74da384058d0dfbc7fbc0b03d1181",
"reference": "e2f5c12916c74da384058d0dfbc7fbc0b03d1181",
"shasum": ""
},
"require": {
@ -3209,73 +3209,79 @@
"psr",
"psr-7"
],
"time": "2015-06-24 20:42:54"
"time": "2015-08-10 20:04:20"
},
{
"name": "zendframework/zend-escaper",
"version": "2.4.0",
"version": "2.5.1",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-escaper.git",
"reference": "65b3328627362b0be1d5e9067bc846511d1fbc96"
"reference": "a4b227d8a477f4e7e9073f8e0a7ae7dbd3104a73"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/15e5769e4fcdb4bf07ebd76500810e7070e23a97",
"reference": "65b3328627362b0be1d5e9067bc846511d1fbc96",
"url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/a4b227d8a477f4e7e9073f8e0a7ae7dbd3104a73",
"reference": "a4b227d8a477f4e7e9073f8e0a7ae7dbd3104a73",
"shasum": ""
},
"require": {
"php": ">=5.3.23"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Escaper\\": ""
"Zend\\Escaper\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zf2",
"homepage": "https://github.com/zendframework/zend-escaper",
"keywords": [
"escaper",
"zf2"
],
"time": "2015-04-01 18:02:07"
"time": "2015-06-03 14:05:37"
},
{
"name": "zendframework/zend-feed",
"version": "2.4.0",
"version": "2.5.2",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-feed.git",
"reference": "aca2b42ecf06d94c621e3c3be8e95d61d3a79bf5"
"reference": "0661345b82b51428619e05d3aadd3de65b57fa54"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-feed/zipball/0f59e560364f1f1fcb09a96874328ae3ff690db2",
"reference": "aca2b42ecf06d94c621e3c3be8e95d61d3a79bf5",
"url": "https://api.github.com/repos/zendframework/zend-feed/zipball/0661345b82b51428619e05d3aadd3de65b57fa54",
"reference": "0661345b82b51428619e05d3aadd3de65b57fa54",
"shasum": ""
},
"require": {
"php": ">=5.3.23",
"zendframework/zend-escaper": "self.version",
"zendframework/zend-stdlib": "self.version"
"php": ">=5.5",
"zendframework/zend-escaper": "~2.5",
"zendframework/zend-stdlib": "~2.5"
},
"require-dev": {
"zendframework/zend-cache": "self.version",
"zendframework/zend-db": "self.version",
"zendframework/zend-http": "self.version",
"zendframework/zend-servicemanager": "self.version",
"zendframework/zend-validator": "self.version"
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"zendframework/zend-cache": "~2.5",
"zendframework/zend-db": "~2.5",
"zendframework/zend-http": "~2.5",
"zendframework/zend-servicemanager": "~2.5",
"zendframework/zend-validator": "~2.5"
},
"suggest": {
"zendframework/zend-cache": "Zend\\Cache component",
@ -3287,13 +3293,13 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Feed\\": ""
"Zend\\Feed\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -3301,35 +3307,39 @@
"BSD-3-Clause"
],
"description": "provides functionality for consuming RSS and Atom feeds",
"homepage": "https://github.com/zendframework/zf2",
"homepage": "https://github.com/zendframework/zend-feed",
"keywords": [
"feed",
"zf2"
],
"time": "2015-04-01 18:09:25"
"time": "2015-08-04 21:39:18"
},
{
"name": "zendframework/zend-stdlib",
"version": "2.4.0",
"version": "2.6.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-stdlib.git",
"reference": "eab586f4c18af3fa63c977611939f1f4a3cf1030"
"reference": "a35758803fc9051ec1aff43989e679b6b451b1b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cf05c5ba75606e47ffee91cedc72778da46f74c3",
"reference": "eab586f4c18af3fa63c977611939f1f4a3cf1030",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/a35758803fc9051ec1aff43989e679b6b451b1b4",
"reference": "a35758803fc9051ec1aff43989e679b6b451b1b4",
"shasum": ""
},
"require": {
"php": ">=5.3.23"
"php": ">=5.5"
},
"require-dev": {
"zendframework/zend-eventmanager": "self.version",
"zendframework/zend-filter": "self.version",
"zendframework/zend-serializer": "self.version",
"zendframework/zend-servicemanager": "self.version"
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"zendframework/zend-config": "~2.5",
"zendframework/zend-eventmanager": "~2.5",
"zendframework/zend-filter": "~2.5",
"zendframework/zend-inputfilter": "~2.5",
"zendframework/zend-serializer": "~2.5",
"zendframework/zend-servicemanager": "~2.5"
},
"suggest": {
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
@ -3340,25 +3350,25 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
"dev-master": "2.6-dev",
"dev-develop": "2.7-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Stdlib\\": ""
"Zend\\Stdlib\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zf2",
"homepage": "https://github.com/zendframework/zend-stdlib",
"keywords": [
"stdlib",
"zf2"
],
"time": "2015-04-01 18:09:29"
"time": "2015-07-21 17:08:05"
}
],
"packages-dev": [],

View File

@ -6,9 +6,9 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Zend\\Stdlib\\' => array($vendorDir . '/zendframework/zend-stdlib'),
'Zend\\Feed\\' => array($vendorDir . '/zendframework/zend-feed'),
'Zend\\Escaper\\' => array($vendorDir . '/zendframework/zend-escaper'),
'Zend\\Stdlib\\' => array($vendorDir . '/zendframework/zend-stdlib/src'),
'Zend\\Feed\\' => array($vendorDir . '/zendframework/zend-feed/src'),
'Zend\\Escaper\\' => array($vendorDir . '/zendframework/zend-escaper/src'),
'Zend\\Diactoros\\' => array($vendorDir . '/zendframework/zend-diactoros/src'),
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'),

View File

@ -430,161 +430,6 @@
"xml"
]
},
{
"name": "zendframework/zend-stdlib",
"version": "2.4.0",
"version_normalized": "2.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-stdlib.git",
"reference": "eab586f4c18af3fa63c977611939f1f4a3cf1030"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cf05c5ba75606e47ffee91cedc72778da46f74c3",
"reference": "eab586f4c18af3fa63c977611939f1f4a3cf1030",
"shasum": ""
},
"require": {
"php": ">=5.3.23"
},
"require-dev": {
"zendframework/zend-eventmanager": "self.version",
"zendframework/zend-filter": "self.version",
"zendframework/zend-serializer": "self.version",
"zendframework/zend-servicemanager": "self.version"
},
"suggest": {
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
"zendframework/zend-filter": "To support naming strategy hydrator usage",
"zendframework/zend-serializer": "Zend\\Serializer component",
"zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
},
"time": "2015-04-01 18:09:29",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Zend\\Stdlib\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zf2",
"keywords": [
"stdlib",
"zf2"
]
},
{
"name": "zendframework/zend-escaper",
"version": "2.4.0",
"version_normalized": "2.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-escaper.git",
"reference": "65b3328627362b0be1d5e9067bc846511d1fbc96"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/15e5769e4fcdb4bf07ebd76500810e7070e23a97",
"reference": "65b3328627362b0be1d5e9067bc846511d1fbc96",
"shasum": ""
},
"require": {
"php": ">=5.3.23"
},
"time": "2015-04-01 18:02:07",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Zend\\Escaper\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zf2",
"keywords": [
"escaper",
"zf2"
]
},
{
"name": "zendframework/zend-feed",
"version": "2.4.0",
"version_normalized": "2.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-feed.git",
"reference": "aca2b42ecf06d94c621e3c3be8e95d61d3a79bf5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-feed/zipball/0f59e560364f1f1fcb09a96874328ae3ff690db2",
"reference": "aca2b42ecf06d94c621e3c3be8e95d61d3a79bf5",
"shasum": ""
},
"require": {
"php": ">=5.3.23",
"zendframework/zend-escaper": "self.version",
"zendframework/zend-stdlib": "self.version"
},
"require-dev": {
"zendframework/zend-cache": "self.version",
"zendframework/zend-db": "self.version",
"zendframework/zend-http": "self.version",
"zendframework/zend-servicemanager": "self.version",
"zendframework/zend-validator": "self.version"
},
"suggest": {
"zendframework/zend-cache": "Zend\\Cache component",
"zendframework/zend-db": "Zend\\Db component",
"zendframework/zend-http": "Zend\\Http for PubSubHubbub, and optionally for use with Zend\\Feed\\Reader",
"zendframework/zend-servicemanager": "Zend\\ServiceManager component, for default/recommended ExtensionManager implementations",
"zendframework/zend-validator": "Zend\\Validator component"
},
"time": "2015-04-01 18:09:25",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Zend\\Feed\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "provides functionality for consuming RSS and Atom feeds",
"homepage": "https://github.com/zendframework/zf2",
"keywords": [
"feed",
"zf2"
]
},
{
"name": "sebastian/version",
"version": "1.0.5",
@ -1346,58 +1191,6 @@
"psr-7"
]
},
{
"name": "zendframework/zend-diactoros",
"version": "1.1.0",
"version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-diactoros.git",
"reference": "df65f70fc36f24d51a90ad706a09cd9b74fc4dd8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/df65f70fc36f24d51a90ad706a09cd9b74fc4dd8",
"reference": "df65f70fc36f24d51a90ad706a09cd9b74fc4dd8",
"shasum": ""
},
"require": {
"php": ">=5.4",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "~1.0.0"
},
"require-dev": {
"phpunit/phpunit": "~4.6",
"squizlabs/php_codesniffer": "^2.3.1"
},
"time": "2015-06-24 20:42:54",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev",
"dev-develop": "1.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Zend\\Diactoros\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"description": "PSR HTTP Message implementations",
"homepage": "https://github.com/zendframework/zend-diactoros",
"keywords": [
"http",
"psr",
"psr-7"
]
},
{
"name": "guzzlehttp/guzzle",
"version": "dev-master",
@ -3472,5 +3265,222 @@
"rdfa",
"sparql"
]
},
{
"name": "zendframework/zend-stdlib",
"version": "2.6.0",
"version_normalized": "2.6.0.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-stdlib.git",
"reference": "a35758803fc9051ec1aff43989e679b6b451b1b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/a35758803fc9051ec1aff43989e679b6b451b1b4",
"reference": "a35758803fc9051ec1aff43989e679b6b451b1b4",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"zendframework/zend-config": "~2.5",
"zendframework/zend-eventmanager": "~2.5",
"zendframework/zend-filter": "~2.5",
"zendframework/zend-inputfilter": "~2.5",
"zendframework/zend-serializer": "~2.5",
"zendframework/zend-servicemanager": "~2.5"
},
"suggest": {
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
"zendframework/zend-filter": "To support naming strategy hydrator usage",
"zendframework/zend-serializer": "Zend\\Serializer component",
"zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
},
"time": "2015-07-21 17:08:05",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6-dev",
"dev-develop": "2.7-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Zend\\Stdlib\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zend-stdlib",
"keywords": [
"stdlib",
"zf2"
]
},
{
"name": "zendframework/zend-escaper",
"version": "2.5.1",
"version_normalized": "2.5.1.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-escaper.git",
"reference": "a4b227d8a477f4e7e9073f8e0a7ae7dbd3104a73"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/a4b227d8a477f4e7e9073f8e0a7ae7dbd3104a73",
"reference": "a4b227d8a477f4e7e9073f8e0a7ae7dbd3104a73",
"shasum": ""
},
"require": {
"php": ">=5.3.23"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0"
},
"time": "2015-06-03 14:05:37",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Zend\\Escaper\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zend-escaper",
"keywords": [
"escaper",
"zf2"
]
},
{
"name": "zendframework/zend-feed",
"version": "2.5.2",
"version_normalized": "2.5.2.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-feed.git",
"reference": "0661345b82b51428619e05d3aadd3de65b57fa54"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-feed/zipball/0661345b82b51428619e05d3aadd3de65b57fa54",
"reference": "0661345b82b51428619e05d3aadd3de65b57fa54",
"shasum": ""
},
"require": {
"php": ">=5.5",
"zendframework/zend-escaper": "~2.5",
"zendframework/zend-stdlib": "~2.5"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"zendframework/zend-cache": "~2.5",
"zendframework/zend-db": "~2.5",
"zendframework/zend-http": "~2.5",
"zendframework/zend-servicemanager": "~2.5",
"zendframework/zend-validator": "~2.5"
},
"suggest": {
"zendframework/zend-cache": "Zend\\Cache component",
"zendframework/zend-db": "Zend\\Db component",
"zendframework/zend-http": "Zend\\Http for PubSubHubbub, and optionally for use with Zend\\Feed\\Reader",
"zendframework/zend-servicemanager": "Zend\\ServiceManager component, for default/recommended ExtensionManager implementations",
"zendframework/zend-validator": "Zend\\Validator component"
},
"time": "2015-08-04 21:39:18",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Zend\\Feed\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "provides functionality for consuming RSS and Atom feeds",
"homepage": "https://github.com/zendframework/zend-feed",
"keywords": [
"feed",
"zf2"
]
},
{
"name": "zendframework/zend-diactoros",
"version": "1.1.3",
"version_normalized": "1.1.3.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-diactoros.git",
"reference": "e2f5c12916c74da384058d0dfbc7fbc0b03d1181"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/e2f5c12916c74da384058d0dfbc7fbc0b03d1181",
"reference": "e2f5c12916c74da384058d0dfbc7fbc0b03d1181",
"shasum": ""
},
"require": {
"php": ">=5.4",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "~1.0.0"
},
"require-dev": {
"phpunit/phpunit": "~4.6",
"squizlabs/php_codesniffer": "^2.3.1"
},
"time": "2015-08-10 20:04:20",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev",
"dev-develop": "1.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Zend\\Diactoros\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"description": "PSR HTTP Message implementations",
"homepage": "https://github.com/zendframework/zend-diactoros",
"keywords": [
"http",
"psr",
"psr-7"
]
}
]

View File

@ -2,6 +2,77 @@
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 1.1.3 - 2015-08-10
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#71](https://github.com/zendframework/zend-diactoros/pull/71) fixes the
docblock of the `JsonResponse` constructor to typehint the `$data` argument
as `mixed`.
- [#73](https://github.com/zendframework/zend-diactoros/pull/73) changes the
behavior in `Request` such that if it marshals a stream during instantiation,
the stream is marked as writeable (specifically, mode `wb+`).
- [#85](https://github.com/zendframework/zend-diactoros/pull/85) updates the
behavior of `Zend\Diactoros\Uri`'s various `with*()` methods that are
documented as accepting strings to raise exceptions on non-string input.
Previously, several simply passed non-string input on verbatim, others
normalized the input, and a few correctly raised the exceptions. Behavior is
now consistent across each.
- [#87](https://github.com/zendframework/zend-diactoros/pull/87) fixes
`UploadedFile` to ensure that `moveTo()` works correctly in non-SAPI
environments when the file provided to the constructor is a path.
## 1.1.2 - 2015-07-12
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#67](https://github.com/zendframework/zend-diactoros/pull/67) ensures that
the `Stream` class only accepts `stream` resources, not any resource.
## 1.1.1 - 2015-06-25
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#64](https://github.com/zendframework/zend-diactoros/pull/64) fixes the
behavior of `JsonResponse` with regards to serialization of `null` and scalar
values; the new behavior is to serialize them verbatim, without any casting.
## 1.1.0 - 2015-06-24
### Added

View File

@ -34,7 +34,7 @@ $ php -S 0.0.0.0:8080 -t doc/html/ # then browse to http://localhost:8080/
[Master image]: https://secure.travis-ci.org/zendframework/zend-diactoros.svg?branch=master
[Master coverage image]: https://img.shields.io/coveralls/zendframework/zend-diactoros/master.svg
[Master coverage]: https://coveralls.io/r/zendframework/zend-diactoros?branch=master
[Develop]: https://github.com/zendframeowork/zend-diactoros/tree/develop
[Develop]: https://github.com/zendframework/zend-diactoros/tree/develop
[Develop image]: https://secure.travis-ci.org/zendframework/zend-diactoros.svg?branch=develop
[Develop coverage image]: https://coveralls.io/repos/zendframework/zend-diactoros/badge.svg?branch=develop
[Develop coverage]: https://coveralls.io/r/zendframework/zend-diactoros?branch=develop

View File

@ -82,7 +82,7 @@ trait RequestTrait
$this->method = $method ?: '';
$this->uri = $uri ?: new Uri();
$this->stream = ($body instanceof StreamInterface) ? $body : new Stream($body, 'r');
$this->stream = ($body instanceof StreamInterface) ? $body : new Stream($body, 'wb+');
list($this->headerNames, $headers) = $this->filterHeaders($headers);
$this->assertHeaders($headers);

View File

@ -9,27 +9,23 @@
namespace Zend\Diactoros\Response;
use ArrayObject;
use InvalidArgumentException;
use Zend\Diactoros\Response;
use Zend\Diactoros\Stream;
/**
* HTML response.
* JSON response.
*
* Allows creating a response by passing an HTML string to the constructor;
* by default, sets a status code of 200 and sets the Content-Type header to
* text/html.
* Allows creating a response by passing data to the constructor; by default,
* serializes the data to JSON, sets a status code of 200 and sets the
* Content-Type header to application/json.
*/
class JsonResponse extends Response
{
use InjectContentTypeTrait;
/**
* Create a JSON response with the given array of data.
*
* If the data provided is null, an empty ArrayObject is used; if the data
* is scalar, it is cast to an array prior to serialization.
* Create a JSON response with the given data.
*
* Default JSON encoding is performed with the following options, which
* produces RFC4627-compliant JSON, capable of embedding into HTML.
@ -39,7 +35,7 @@ class JsonResponse extends Response
* - JSON_HEX_AMP
* - JSON_HEX_QUOT
*
* @param string $data Data to convert to JSON.
* @param mixed $data Data to convert to JSON.
* @param int $status Integer status code for the response; 200 by default.
* @param array $headers Array of headers to use at initialization.
* @param int $encodingOptions JSON encoding options to use.
@ -69,15 +65,6 @@ class JsonResponse extends Response
throw new InvalidArgumentException('Cannot JSON encode resources');
}
if ($data === null) {
// Use an ArrayObject to force an empty JSON object.
$data = new ArrayObject();
}
if (is_scalar($data)) {
$data = (array) $data;
}
// Clear json_last_error()
json_encode(null);

View File

@ -35,23 +35,7 @@ class Stream implements StreamInterface
*/
public function __construct($stream, $mode = 'r')
{
$this->stream = $stream;
if (is_resource($stream)) {
$this->resource = $stream;
} elseif (is_string($stream)) {
set_error_handler(function ($errno, $errstr) {
throw new InvalidArgumentException(
'Invalid file provided for stream; must be a valid path with valid permissions'
);
}, E_WARNING);
$this->resource = fopen($stream, $mode);
restore_error_handler();
} else {
throw new InvalidArgumentException(
'Invalid stream provided; must be a string stream identifier or resource'
);
}
$this->setStream($stream, $mode);
}
/**
@ -105,26 +89,7 @@ class Stream implements StreamInterface
*/
public function attach($resource, $mode = 'r')
{
$error = null;
if (! is_resource($resource) && is_string($resource)) {
set_error_handler(function ($e) use (&$error) {
$error = $e;
}, E_WARNING);
$resource = fopen($resource, $mode);
restore_error_handler();
}
if ($error) {
throw new InvalidArgumentException('Invalid stream reference provided');
}
if (! is_resource($resource)) {
throw new InvalidArgumentException(
'Invalid stream provided; must be a string stream identifier or resource'
);
}
$this->resource = $resource;
$this->setStream($resource, $mode);
}
/**
@ -323,4 +288,41 @@ class Stream implements StreamInterface
return $metadata[$key];
}
/**
* Set the internal stream resource.
*
* @param string|resource $stream String stream target or stream resource.
* @param string $mode Resource mode for stream target.
* @throws InvalidArgumentException for invalid streams or resources.
*/
private function setStream($stream, $mode = 'r')
{
$error = null;
$resource = $stream;
if (is_string($stream)) {
set_error_handler(function ($e) use (&$error) {
$error = $e;
}, E_WARNING);
$resource = fopen($stream, $mode);
restore_error_handler();
}
if ($error) {
throw new InvalidArgumentException('Invalid stream reference provided');
}
if (! is_resource($resource) || 'stream' !== get_resource_type($resource)) {
throw new InvalidArgumentException(
'Invalid stream provided; must be a string stream identifier or stream resource'
);
}
if ($stream !== $resource) {
$this->stream = $stream;
}
$this->resource = $resource;
}
}

View File

@ -223,9 +223,10 @@ class UploadedFile implements UploadedFileInterface
throw new RuntimeException('Unable to write to designated path');
}
$this->stream->rewind();
while (! $this->stream->eof()) {
fwrite($handle, $this->stream->read(4096));
$stream = $this->getStream();
$stream->rewind();
while (! $stream->eof()) {
fwrite($handle, $stream->read(4096));
}
fclose($handle);

View File

@ -220,6 +220,14 @@ class Uri implements UriInterface
*/
public function withScheme($scheme)
{
if (! is_string($scheme)) {
throw new InvalidArgumentException(sprintf(
'%s expects a string argument; received %s',
__METHOD__,
(is_object($scheme) ? get_class($scheme) : gettype($scheme))
));
}
$scheme = $this->filterScheme($scheme);
if ($scheme === $this->scheme) {
@ -238,6 +246,21 @@ class Uri implements UriInterface
*/
public function withUserInfo($user, $password = null)
{
if (! is_string($user)) {
throw new InvalidArgumentException(sprintf(
'%s expects a string user argument; received %s',
__METHOD__,
(is_object($user) ? get_class($user) : gettype($user))
));
}
if (null !== $password && ! is_string($password)) {
throw new InvalidArgumentException(sprintf(
'%s expects a string password argument; received %s',
__METHOD__,
(is_object($password) ? get_class($password) : gettype($password))
));
}
$info = $user;
if ($password) {
$info .= ':' . $password;
@ -259,6 +282,14 @@ class Uri implements UriInterface
*/
public function withHost($host)
{
if (! is_string($host)) {
throw new InvalidArgumentException(sprintf(
'%s expects a string argument; received %s',
__METHOD__,
(is_object($host) ? get_class($host) : gettype($host))
));
}
if ($host === $this->host) {
// Do nothing if no change was made.
return clone $this;
@ -373,6 +404,14 @@ class Uri implements UriInterface
*/
public function withFragment($fragment)
{
if (! is_string($fragment)) {
throw new InvalidArgumentException(sprintf(
'%s expects a string argument; received %s',
__METHOD__,
(is_object($fragment) ? get_class($fragment) : gettype($fragment))
));
}
$fragment = $this->filterFragment($fragment);
if ($fragment === $this->fragment) {
@ -585,10 +624,6 @@ class Uri implements UriInterface
*/
private function filterFragment($fragment)
{
if (null === $fragment) {
$fragment = '';
}
if (! empty($fragment) && strpos($fragment, '#') === 0) {
$fragment = substr($fragment, 1);
}

View File

@ -1,3 +1,229 @@
# CONTRIBUTING
Please don't open pull requests against this repository, please use https://github.com/zendframework/zf2.
## RESOURCES
If you wish to contribute to Zend Framework, please be sure to
read/subscribe to the following resources:
- [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards)
- [Contributor's Guide](http://framework.zend.com/participate/contributor-guide)
- ZF Contributor's mailing list:
Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html
Subscribe: zf-contributors-subscribe@lists.zend.com
- ZF Contributor's IRC channel:
#zftalk.dev on Freenode.net
If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-escaper/issues/new).
## Reporting Potential Security Issues
If you have encountered a potential security vulnerability, please **DO NOT** report it on the public
issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead.
We will work with you to verify the vulnerability and patch it as soon as possible.
When reporting issues, please provide the following information:
- Component(s) affected
- A description indicating how to reproduce the issue
- A summary of the security vulnerability and impact
We request that you contact us via the email address above and give the project
contributors a chance to resolve the vulnerability and issue a new release prior
to any public exposure; this helps protect users and provides them with a chance
to upgrade and/or update in order to protect their applications.
For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc).
## RUNNING TESTS
> ### Note: testing versions prior to 2.4
>
> This component originates with Zend Framework 2. During the lifetime of ZF2,
> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no
> changes were necessary. However, due to the migration, tests may not run on
> versions < 2.4. As such, you may need to change the PHPUnit dependency if
> attempting a fix on such a version.
To run tests:
- Clone the repository:
```console
$ git clone git@github.com:zendframework/zend-escaper.git
$ cd
```
- Install dependencies via composer:
```console
$ curl -sS https://getcomposer.org/installer | php --
$ ./composer.phar install
```
If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/
- Run the tests via `phpunit` and the provided PHPUnit config, like in this example:
```console
$ ./vendor/bin/phpunit
```
You can turn on conditional tests with the phpunit.xml file.
To do so:
- Copy `phpunit.xml.dist` file to `phpunit.xml`
- Edit `phpunit.xml` to enable any specific functionality you
want to test, as well as to provide test values to utilize.
## Running Coding Standards Checks
This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding
standards checks, and provides configuration for our selected checks.
`php-cs-fixer` is installed by default via Composer.
To run checks only:
```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs
```
To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run`
flag:
```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs
```
If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure
they pass, and make sure you add and commit the changes after verification.
## Recommended Workflow for Contributions
Your first step is to establish a public repository from which we can
pull your work into the master repository. We recommend using
[GitHub](https://github.com), as that is where the component is already hosted.
1. Setup a [GitHub account](http://github.com/), if you haven't yet
2. Fork the repository (http://github.com/zendframework/zend-escaper)
3. Clone the canonical repository locally and enter it.
```console
$ git clone git://github.com:zendframework/zend-escaper.git
$ cd zend-escaper
```
4. Add a remote to your fork; substitute your GitHub username in the command
below.
```console
$ git remote add {username} git@github.com:{username}/zend-escaper.git
$ git fetch {username}
```
### Keeping Up-to-Date
Periodically, you should update your fork or personal repository to
match the canonical ZF repository. Assuming you have setup your local repository
per the instructions above, you can do the following:
```console
$ git checkout master
$ git fetch origin
$ git rebase origin/master
# OPTIONALLY, to keep your remote up-to-date -
$ git push {username} master:master
```
If you're tracking other branches -- for example, the "develop" branch, where
new feature development occurs -- you'll want to do the same operations for that
branch; simply substitute "develop" for "master".
### Working on a patch
We recommend you do each new feature or bugfix in a new branch. This simplifies
the task of code review as well as the task of merging your changes into the
canonical repository.
A typical workflow will then consist of the following:
1. Create a new local branch based off either your master or develop branch.
2. Switch to your new local branch. (This step can be combined with the
previous step with the use of `git checkout -b`.)
3. Do some work, commit, repeat as necessary.
4. Push the local branch to your remote repository.
5. Send a pull request.
The mechanics of this process are actually quite trivial. Below, we will
create a branch for fixing an issue in the tracker.
```console
$ git checkout -b hotfix/9295
Switched to a new branch 'hotfix/9295'
```
... do some work ...
```console
$ git commit
```
... write your log message ...
```console
$ git push {username} hotfix/9295:hotfix/9295
Counting objects: 38, done.
Delta compression using up to 2 threads.
Compression objects: 100% (18/18), done.
Writing objects: 100% (20/20), 8.19KiB, done.
Total 20 (delta 12), reused 0 (delta 0)
To ssh://git@github.com/{username}/zend-escaper.git
b5583aa..4f51698 HEAD -> master
```
To send a pull request, you have two options.
If using GitHub, you can do the pull request from there. Navigate to
your repository, select the branch you just created, and then select the
"Pull Request" button in the upper right. Select the user/organization
"zendframework" as the recipient.
If using your own repository - or even if using GitHub - you can use `git
format-patch` to create a patchset for us to apply; in fact, this is
**recommended** for security-related patches. If you use `format-patch`, please
send the patches as attachments to:
- zf-devteam@zend.com for patches without security implications
- zf-security@zend.com for security patches
#### What branch to issue the pull request against?
Which branch should you issue a pull request against?
- For fixes against the stable release, issue the pull request against the
"master" branch.
- For new features, or fixes that introduce new elements to the public API (such
as new public methods or properties), issue the pull request against the
"develop" branch.
### Branch Cleanup
As you might imagine, if you are a frequent contributor, you'll start to
get a ton of branches both locally and on your remote.
Once you know that your changes have been accepted to the master
repository, we suggest doing some cleanup of these branches.
- Local branch cleanup
```console
$ git branch -d <branchname>
```
- Remote branch removal
```console
$ git push {username} :<branchname>
```

View File

@ -0,0 +1,28 @@
Copyright (c) 2005-2015, Zend Technologies USA, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Zend Technologies USA, Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,15 +1,14 @@
Escaper Component from ZF2
==========================
# zend-escaper
This is the Escaper component for ZF2.
[![Build Status](https://secure.travis-ci.org/zendframework/zend-escaper.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-escaper)
[![Coverage Status](https://coveralls.io/repos/zendframework/zend-escaper/badge.svg?branch=master)](https://coveralls.io/r/zendframework/zend-escaper?branch=master)
- File issues at https://github.com/zendframework/zf2/issues
- Create pull requests against https://github.com/zendframework/zf2
- Documentation is at http://framework.zend.com/docs
The OWASP Top 10 web security risks study lists Cross-Site Scripting (XSS) in
second place. PHPs sole functionality against XSS is limited to two functions
of which one is commonly misapplied. Thus, the `Zend\Escaper` component was written.
It offers developers a way to escape output and defend from XSS and related
vulnerabilities by introducing contextual escaping based on peer-reviewed rules.
LICENSE
-------
The files in this archive are released under the [Zend Framework
license](http://framework.zend.com/license), which is a 3-clause BSD license.
- File issues at https://github.com/zendframework/zend-escaper/issues
- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-escaper

View File

@ -6,19 +6,30 @@
"zf2",
"escaper"
],
"homepage": "https://github.com/zendframework/zf2",
"homepage": "https://github.com/zendframework/zend-escaper",
"autoload": {
"psr-4": {
"Zend\\Escaper\\": ""
"Zend\\Escaper\\": "src/"
}
},
"require": {
"php": ">=5.3.23"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"autoload-dev": {
"psr-4": {
"ZendTest\\Escaper\\": "test/"
}
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/PHPUnit": "~4.0"
}
}

View File

@ -0,0 +1,25 @@
# Changelog
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 2.5.2 - TBD
### Added
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- [#5](https://github.com/zendframework/zend-feed/pull/5) fixes the enclosure
length check to allow zero and integer strings.
- [#2](https://github.com/zendframework/zend-feed/pull/2) ensures that the
routine for "absolutising" a link in `Reader\FeedSet` always generates a URI
with a scheme.

View File

@ -1,3 +1,229 @@
# CONTRIBUTING
Please don't open pull requests against this repository, please use https://github.com/zendframework/zf2.
## RESOURCES
If you wish to contribute to Zend Framework, please be sure to
read/subscribe to the following resources:
- [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards)
- [Contributor's Guide](http://framework.zend.com/participate/contributor-guide)
- ZF Contributor's mailing list:
Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html
Subscribe: zf-contributors-subscribe@lists.zend.com
- ZF Contributor's IRC channel:
#zftalk.dev on Freenode.net
If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-feed/issues/new).
## Reporting Potential Security Issues
If you have encountered a potential security vulnerability, please **DO NOT** report it on the public
issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead.
We will work with you to verify the vulnerability and patch it as soon as possible.
When reporting issues, please provide the following information:
- Component(s) affected
- A description indicating how to reproduce the issue
- A summary of the security vulnerability and impact
We request that you contact us via the email address above and give the project
contributors a chance to resolve the vulnerability and issue a new release prior
to any public exposure; this helps protect users and provides them with a chance
to upgrade and/or update in order to protect their applications.
For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc).
## RUNNING TESTS
> ### Note: testing versions prior to 2.4
>
> This component originates with Zend Framework 2. During the lifetime of ZF2,
> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no
> changes were necessary. However, due to the migration, tests may not run on
> versions < 2.4. As such, you may need to change the PHPUnit dependency if
> attempting a fix on such a version.
To run tests:
- Clone the repository:
```console
$ git clone git@github.com:zendframework/zend-feed.git
$ cd
```
- Install dependencies via composer:
```console
$ curl -sS https://getcomposer.org/installer | php --
$ ./composer.phar install
```
If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/
- Run the tests via `phpunit` and the provided PHPUnit config, like in this example:
```console
$ ./vendor/bin/phpunit
```
You can turn on conditional tests with the phpunit.xml file.
To do so:
- Copy `phpunit.xml.dist` file to `phpunit.xml`
- Edit `phpunit.xml` to enable any specific functionality you
want to test, as well as to provide test values to utilize.
## Running Coding Standards Checks
This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding
standards checks, and provides configuration for our selected checks.
`php-cs-fixer` is installed by default via Composer.
To run checks only:
```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs
```
To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run`
flag:
```console
$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs
```
If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure
they pass, and make sure you add and commit the changes after verification.
## Recommended Workflow for Contributions
Your first step is to establish a public repository from which we can
pull your work into the master repository. We recommend using
[GitHub](https://github.com), as that is where the component is already hosted.
1. Setup a [GitHub account](http://github.com/), if you haven't yet
2. Fork the repository (http://github.com/zendframework/zend-feed)
3. Clone the canonical repository locally and enter it.
```console
$ git clone git://github.com:zendframework/zend-feed.git
$ cd zend-feed
```
4. Add a remote to your fork; substitute your GitHub username in the command
below.
```console
$ git remote add {username} git@github.com:{username}/zend-feed.git
$ git fetch {username}
```
### Keeping Up-to-Date
Periodically, you should update your fork or personal repository to
match the canonical ZF repository. Assuming you have setup your local repository
per the instructions above, you can do the following:
```console
$ git checkout master
$ git fetch origin
$ git rebase origin/master
# OPTIONALLY, to keep your remote up-to-date -
$ git push {username} master:master
```
If you're tracking other branches -- for example, the "develop" branch, where
new feature development occurs -- you'll want to do the same operations for that
branch; simply substitute "develop" for "master".
### Working on a patch
We recommend you do each new feature or bugfix in a new branch. This simplifies
the task of code review as well as the task of merging your changes into the
canonical repository.
A typical workflow will then consist of the following:
1. Create a new local branch based off either your master or develop branch.
2. Switch to your new local branch. (This step can be combined with the
previous step with the use of `git checkout -b`.)
3. Do some work, commit, repeat as necessary.
4. Push the local branch to your remote repository.
5. Send a pull request.
The mechanics of this process are actually quite trivial. Below, we will
create a branch for fixing an issue in the tracker.
```console
$ git checkout -b hotfix/9295
Switched to a new branch 'hotfix/9295'
```
... do some work ...
```console
$ git commit
```
... write your log message ...
```console
$ git push {username} hotfix/9295:hotfix/9295
Counting objects: 38, done.
Delta compression using up to 2 threads.
Compression objects: 100% (18/18), done.
Writing objects: 100% (20/20), 8.19KiB, done.
Total 20 (delta 12), reused 0 (delta 0)
To ssh://git@github.com/{username}/zend-feed.git
b5583aa..4f51698 HEAD -> master
```
To send a pull request, you have two options.
If using GitHub, you can do the pull request from there. Navigate to
your repository, select the branch you just created, and then select the
"Pull Request" button in the upper right. Select the user/organization
"zendframework" as the recipient.
If using your own repository - or even if using GitHub - you can use `git
format-patch` to create a patchset for us to apply; in fact, this is
**recommended** for security-related patches. If you use `format-patch`, please
send the patches as attachments to:
- zf-devteam@zend.com for patches without security implications
- zf-security@zend.com for security patches
#### What branch to issue the pull request against?
Which branch should you issue a pull request against?
- For fixes against the stable release, issue the pull request against the
"master" branch.
- For new features, or fixes that introduce new elements to the public API (such
as new public methods or properties), issue the pull request against the
"develop" branch.
### Branch Cleanup
As you might imagine, if you are a frequent contributor, you'll start to
get a ton of branches both locally and on your remote.
Once you know that your changes have been accepted to the master
repository, we suggest doing some cleanup of these branches.
- Local branch cleanup
```console
$ git branch -d <branchname>
```
- Remote branch removal
```console
$ git push {username} :<branchname>
```

View File

@ -0,0 +1,28 @@
Copyright (c) 2005-2015, Zend Technologies USA, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Zend Technologies USA, Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,15 +1,13 @@
Feed Component from ZF2
=======================
# zend-feed
This is the Feed component for ZF2.
[![Build Status](https://secure.travis-ci.org/zendframework/zend-feed.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-feed)
[![Coverage Status](https://coveralls.io/repos/zendframework/zend-feed/badge.svg?branch=master)](https://coveralls.io/r/zendframework/zend-feed?branch=master)
- File issues at https://github.com/zendframework/zf2/issues
- Create pull requests against https://github.com/zendframework/zf2
- Documentation is at http://framework.zend.com/docs
`Zend\Feed` provides functionality for consuming RSS and Atom feeds. It provides
a natural syntax for accessing elements of feeds, feed attributes, and entry
attributes. `Zend\Feed` also has extensive support for modifying feed and entry
structure with the same natural syntax, and turning the result back into XML.
LICENSE
-------
The files in this archive are released under the [Zend Framework
license](http://framework.zend.com/license), which is a 3-clause BSD license.
- File issues at https://github.com/zendframework/zend-feed/issues
- Documentation is at http://framework.zend.com/manual/current/en/index.html#zend-feed

View File

@ -6,23 +6,25 @@
"zf2",
"feed"
],
"homepage": "https://github.com/zendframework/zf2",
"homepage": "https://github.com/zendframework/zend-feed",
"autoload": {
"psr-4": {
"Zend\\Feed\\": ""
"Zend\\Feed\\": "src/"
}
},
"require": {
"php": ">=5.3.23",
"zendframework/zend-escaper": "self.version",
"zendframework/zend-stdlib": "self.version"
"php": ">=5.5",
"zendframework/zend-escaper": "~2.5",
"zendframework/zend-stdlib": "~2.5"
},
"require-dev": {
"zendframework/zend-db": "self.version",
"zendframework/zend-cache": "self.version",
"zendframework/zend-http": "self.version",
"zendframework/zend-servicemanager": "self.version",
"zendframework/zend-validator": "self.version"
"zendframework/zend-db": "~2.5",
"zendframework/zend-cache": "~2.5",
"zendframework/zend-http": "~2.5",
"zendframework/zend-servicemanager": "~2.5",
"zendframework/zend-validator": "~2.5",
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/PHPUnit": "~4.0"
},
"suggest": {
"zendframework/zend-cache": "Zend\\Cache component",
@ -31,10 +33,17 @@
"zendframework/zend-servicemanager": "Zend\\ServiceManager component, for default/recommended ExtensionManager implementations",
"zendframework/zend-validator": "Zend\\Validator component"
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "2.3-dev",
"dev-develop": "2.4-dev"
"dev-master": "2.5-dev",
"dev-develop": "2.6-dev"
}
},
"autoload-dev": {
"psr-4": {
"ZendTest\\Feed\\": "test/"
}
}
}

View File

@ -23,7 +23,7 @@ class HttpResponse
*
* @var array
*/
protected $headers = array();
protected $headers = [];
/**
* HTTP response code to use in headers
@ -94,11 +94,11 @@ class HttpResponse
}
}
}
$this->headers[] = array(
$this->headers[] = [
'name' => $name,
'value' => $value,
'replace' => $replace,
);
];
return $this;
}
@ -203,7 +203,7 @@ class HttpResponse
*/
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;

View File

@ -36,7 +36,7 @@ class Subscription extends AbstractModel implements SubscriptionPersistenceInter
'ID must be set before attempting a save'
);
}
$result = $this->db->select(array('id' => $data['id']));
$result = $this->db->select(['id' => $data['id']]);
if ($result && (0 < count($result))) {
$data['created_time'] = $result->current()->created_time;
$now = $this->getNow();
@ -48,7 +48,7 @@ class Subscription extends AbstractModel implements SubscriptionPersistenceInter
}
$this->db->update(
$data,
array('id' => $data['id'])
['id' => $data['id']]
);
return false;
}
@ -70,7 +70,7 @@ class Subscription extends AbstractModel implements SubscriptionPersistenceInter
throw new PubSubHubbub\Exception\InvalidArgumentException('Invalid parameter "key"'
.' of "' . $key . '" must be a non-empty string');
}
$result = $this->db->select(array('id' => $key));
$result = $this->db->select(['id' => $key]);
if (count($result)) {
return $result->current()->getArrayCopy();
}
@ -90,7 +90,7 @@ class Subscription extends AbstractModel implements SubscriptionPersistenceInter
throw new PubSubHubbub\Exception\InvalidArgumentException('Invalid parameter "key"'
.' of "' . $key . '" must be a non-empty string');
}
$result = $this->db->select(array('id' => $key));
$result = $this->db->select(['id' => $key]);
if (count($result)) {
return true;
}
@ -105,10 +105,10 @@ class Subscription extends AbstractModel implements SubscriptionPersistenceInter
*/
public function deleteSubscription($key)
{
$result = $this->db->select(array('id' => $key));
$result = $this->db->select(['id' => $key]);
if (count($result)) {
$this->db->delete(
array('id' => $key)
['id' => $key]
);
return true;
}

View File

@ -22,7 +22,7 @@ class Publisher
*
* @var array
*/
protected $hubUrls = array();
protected $hubUrls = [];
/**
* An array of topic (Atom or RSS feed) URLs which have been updated and
@ -30,7 +30,7 @@ class Publisher
*
* @var array
*/
protected $updatedTopicUrls = array();
protected $updatedTopicUrls = [];
/**
* An array of any errors including keys for 'response', 'hubUrl'.
@ -38,7 +38,7 @@ class Publisher
*
* @var array
*/
protected $errors = array();
protected $errors = [];
/**
* An array of topic (Atom or RSS feed) URLs which have been updated and
@ -46,7 +46,7 @@ class Publisher
*
* @var array
*/
protected $parameters = array();
protected $parameters = [];
/**
* Constructor; accepts an array or Zend\Config\Config instance to preset
@ -254,15 +254,15 @@ class Publisher
throw new Exception\RuntimeException('No Hub Server URLs'
. ' have been set so no notifications can be sent');
}
$this->errors = array();
$this->errors = [];
foreach ($hubs as $url) {
$client->setUri($url);
$response = $client->getResponse();
if ($response->getStatusCode() !== 204) {
$this->errors[] = array(
$this->errors[] = [
'response' => $response,
'hubUrl' => $url
);
];
}
}
}
@ -373,10 +373,10 @@ class Publisher
{
$client = PubSubHubbub::getHttpClient();
$client->setMethod(HttpRequest::METHOD_POST);
$client->setOptions(array(
$client->setOptions([
'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . Version::VERSION,
));
$params = array();
]);
$params = [];
$params[] = 'hub.mode=publish';
$topics = $this->getUpdatedTopicUrls();
if (empty($topics)) {

View File

@ -23,7 +23,7 @@ class Subscriber
*
* @var array
*/
protected $hubUrls = array();
protected $hubUrls = [];
/**
* An array of optional parameters to be included in any
@ -31,7 +31,7 @@ class Subscriber
*
* @var array
*/
protected $parameters = array();
protected $parameters = [];
/**
* The URL of the topic (Rss or Atom feed) which is the subject of
@ -76,7 +76,7 @@ class Subscriber
*
* @var array
*/
protected $errors = array();
protected $errors = [];
/**
* An array of Hub Server URLs for Hubs operating at this time in
@ -84,7 +84,7 @@ class Subscriber
*
* @var array
*/
protected $asyncHubs = array();
protected $asyncHubs = [];
/**
* An instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used to background
@ -101,7 +101,7 @@ class Subscriber
*
* @var array
*/
protected $authentications = array();
protected $authentications = [];
/**
* Tells the Subscriber to append any subscription identifier to the path
@ -610,8 +610,8 @@ class Subscriber
throw new Exception\RuntimeException('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];
@ -623,10 +623,10 @@ class Subscriber
if ($response->getStatusCode() !== 204
&& $response->getStatusCode() !== 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
@ -635,10 +635,10 @@ class Subscriber
* move these to asynchronous processes.
*/
} elseif ($response->getStatusCode() == 202) {
$this->asyncHubs[] = array(
$this->asyncHubs[] = [
'response' => $response,
'hubUrl' => $url,
);
];
}
}
}
@ -652,8 +652,8 @@ class Subscriber
{
$client = PubSubHubbub::getHttpClient();
$client->setMethod(HttpRequest::METHOD_POST);
$client->setOptions(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/'
. Version::VERSION));
$client->setOptions(['useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/'
. Version::VERSION]);
return $client;
}
@ -668,30 +668,30 @@ class Subscriber
*/
protected function _getRequestParameters($hubUrl, $mode)
{
if (!in_array($mode, array('subscribe', 'unsubscribe'))) {
if (!in_array($mode, ['subscribe', 'unsubscribe'])) {
throw new Exception\InvalidArgumentException('Invalid mode specified: "'
. $mode . '" which should have been "subscribe" or "unsubscribe"');
}
$params = array(
$params = [
'hub.mode' => $mode,
'hub.topic' => $this->getTopicUrl(),
);
];
if ($this->getPreferredVerificationMode()
== PubSubHubbub::VERIFICATION_MODE_SYNC
) {
$vmodes = array(
$vmodes = [
PubSubHubbub::VERIFICATION_MODE_SYNC,
PubSubHubbub::VERIFICATION_MODE_ASYNC,
);
];
} else {
$vmodes = array(
$vmodes = [
PubSubHubbub::VERIFICATION_MODE_ASYNC,
PubSubHubbub::VERIFICATION_MODE_SYNC,
);
];
}
$params['hub.verify'] = array();
$params['hub.verify'] = [];
foreach ($vmodes as $vmode) {
$params['hub.verify'][] = $vmode;
}
@ -729,7 +729,7 @@ class Subscriber
$expires = $now->add(new DateInterval('PT' . $params['hub.lease_seconds'] . 'S'))
->format('Y-m-d H:i:s');
}
$data = array(
$data = [
'id' => $key,
'topic_url' => $params['hub.topic'],
'hub_url' => $hubUrl,
@ -739,7 +739,7 @@ class Subscriber
'secret' => null,
'expiration_time' => $expires,
'subscription_state' => ($mode == 'unsubscribe')? PubSubHubbub::SUBSCRIPTION_TODELETE : PubSubHubbub::SUBSCRIPTION_NOTVERIFIED,
);
];
$this->getStorage()->setSubscription($data);
return $this->_toByteValueOrderedString(
@ -786,11 +786,11 @@ class Subscriber
*/
protected function _urlEncode(array $params)
{
$encoded = array();
$encoded = [];
foreach ($params as $key => $value) {
if (is_array($value)) {
$ekey = PubSubHubbub::urlencode($key);
$encoded[$ekey] = array();
$encoded[$ekey] = [];
foreach ($value as $duplicateKey) {
$encoded[$ekey][]
= PubSubHubbub::urlencode($duplicateKey);
@ -811,7 +811,7 @@ class Subscriber
*/
protected function _toByteValueOrderedString(array $params)
{
$return = array();
$return = [];
uksort($params, 'strnatcmp');
foreach ($params as $key => $value) {
if (is_array($value)) {

View File

@ -140,12 +140,12 @@ class Callback extends PubSubHubbub\AbstractCallback
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;
@ -288,13 +288,13 @@ class Callback extends PubSubHubbub\AbstractCallback
*/
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) {
@ -305,7 +305,7 @@ class Callback extends PubSubHubbub\AbstractCallback
if (is_array($params[$key])) {
$params[$key][] = $value;
} else {
$params[$key] = array($params[$key], $value);
$params[$key] = [$params[$key], $value];
}
} else {
$params[$key] = $value;

View File

@ -20,7 +20,7 @@ abstract class AbstractEntry
*
* @var array
*/
protected $data = array();
protected $data = [];
/**
* DOM document object
@ -55,7 +55,7 @@ abstract class AbstractEntry
*
* @var array
*/
protected $extensions = array();
protected $extensions = [];
/**
* Constructor
@ -195,7 +195,7 @@ abstract class AbstractEntry
{
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);
}
}
throw new Exception\BadMethodCallException('Method: ' . $method

View File

@ -20,7 +20,7 @@ abstract class AbstractFeed implements Feed\FeedInterface
*
* @var array
*/
protected $data = array();
protected $data = [];
/**
* Parsed feed data in the shape of a DOMDocument
@ -34,7 +34,7 @@ abstract class AbstractFeed implements Feed\FeedInterface
*
* @var array
*/
protected $entries = array();
protected $entries = [];
/**
* A pointer for the iterator to keep track of the entries array
@ -55,7 +55,7 @@ abstract class AbstractFeed implements Feed\FeedInterface
*
* @var array
*/
protected $extensions = array();
protected $extensions = [];
/**
* Original Source URI (set if imported from a URI)
@ -248,7 +248,7 @@ abstract class AbstractFeed implements Feed\FeedInterface
{
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);
}
}
throw new Exception\BadMethodCallException('Method: ' . $method

View File

@ -19,7 +19,7 @@ class Author extends AbstractCollection
*/
public function getValues()
{
$authors = array();
$authors = [];
foreach ($this->getIterator() as $element) {
$authors[] = $element['name'];
}

View File

@ -21,7 +21,7 @@ class Category extends AbstractCollection
*/
public function getValues()
{
$categories = array();
$categories = [];
foreach ($this->getIterator() as $element) {
if (isset($element['label']) && !empty($element['label'])) {
$categories[] = $element['label'];

View File

@ -22,7 +22,7 @@ abstract class AbstractEntry
*
* @var array
*/
protected $data = array();
protected $data = [];
/**
* DOM document object
@ -57,7 +57,7 @@ abstract class AbstractEntry
*
* @var array
*/
protected $extensions = array();
protected $extensions = [];
/**
* Constructor
@ -200,7 +200,7 @@ abstract class AbstractEntry
{
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);
}
}
throw new Exception\RuntimeException(sprintf(

View File

@ -37,7 +37,7 @@ class Atom extends AbstractEntry implements EntryInterface
$this->xpathQuery = '//atom:entry[' . ($this->entryKey + 1) . ']';
$manager = Reader\Reader::getExtensionManager();
$extensions = array('Atom\Entry', 'Thread\Entry', 'DublinCore\Entry');
$extensions = ['Atom\Entry', 'Thread\Entry', 'DublinCore\Entry'];
foreach ($extensions as $name) {
$extension = $manager->get($name);

View File

@ -45,14 +45,14 @@ class Rss extends AbstractEntry implements EntryInterface
$this->xpathQueryRdf = '//rss:item[' . ($this->entryKey+1) . ']';
$manager = Reader\Reader::getExtensionManager();
$extensions = array(
$extensions = [
'DublinCore\Entry',
'Content\Entry',
'Atom\Entry',
'WellFormedWeb\Entry',
'Slash\Entry',
'Thread\Entry',
);
];
foreach ($extensions as $name) {
$extension = $manager->get($name);
$extension->setEntryElement($entry);
@ -90,13 +90,13 @@ class Rss extends AbstractEntry implements EntryInterface
return $this->data['authors'];
}
$authors = array();
$authors = [];
$authorsDc = $this->getExtension('DublinCore')->getAuthors();
if (!empty($authorsDc)) {
foreach ($authorsDc as $author) {
$authors[] = array(
$authors[] = [
'name' => $author['name']
);
];
}
}
@ -109,7 +109,7 @@ class Rss extends AbstractEntry implements EntryInterface
if ($list->length) {
foreach ($list as $author) {
$string = trim($author->nodeValue);
$data = array();
$data = [];
// Pretty rough parsing - but it's a catchall
if (preg_match("/^.*@[^ ]*/", $string, $matches)) {
$data['email'] = trim($matches[0]);
@ -197,14 +197,14 @@ class Rss extends AbstractEntry implements EntryInterface
if ($dateModifiedParsed) {
$date = new DateTime('@' . $dateModifiedParsed);
} else {
$dateStandards = array(DateTime::RSS, DateTime::RFC822,
DateTime::RFC2822, null);
$dateStandards = [DateTime::RSS, DateTime::RFC822,
DateTime::RFC2822, null];
foreach ($dateStandards as $standard) {
try {
$date = date_create_from_format($standard, $dateModified);
break;
} catch (\Exception $e) {
if ($standard == null) {
if ($standard === null) {
throw new Exception\RuntimeException(
'Could not load date due to unrecognised'
.' format (should follow RFC 822 or 2822):'
@ -377,7 +377,7 @@ class Rss extends AbstractEntry implements EntryInterface
return $this->data['links'];
}
$links = array();
$links = [];
if ($this->getType() !== Reader\Reader::TYPE_RSS_10 &&
$this->getType() !== Reader\Reader::TYPE_RSS_090) {
@ -420,11 +420,11 @@ class Rss extends AbstractEntry implements EntryInterface
if ($list->length) {
$categoryCollection = new 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();

View File

@ -21,7 +21,7 @@ abstract class AbstractEntry
*
* @var array
*/
protected $data = array();
protected $data = [];
/**
* DOM document object

View File

@ -20,7 +20,7 @@ abstract class AbstractFeed
*
* @var array
*/
protected $data = array();
protected $data = [];
/**
* Parsed feed data in the shape of a DOMDocument

View File

@ -48,7 +48,7 @@ class Entry extends Extension\AbstractEntry
return $this->data['authors'];
}
$authors = array();
$authors = [];
$list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:author');
if (!$list->length) {
@ -142,10 +142,10 @@ class Entry extends Extension\AbstractEntry
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);
@ -347,7 +347,7 @@ class Entry extends Extension\AbstractEntry
return $this->data['links'];
}
$links = array();
$links = [];
$list = $this->getXpath()->query(
$this->getXpathPrefix() . '//atom:link[@rel="alternate"]/@href' . '|' .
@ -505,11 +505,11 @@ class Entry extends Extension\AbstractEntry
if ($list->length) {
$categoryCollection = new Collection\Category;
foreach ($list as $category) {
$categoryCollection[] = array(
$categoryCollection[] = [
'term' => $category->getAttribute('term'),
'scheme' => $category->getAttribute('scheme'),
'label' => $category->getAttribute('label')
);
];
}
} else {
return new Collection\Category;
@ -573,7 +573,7 @@ class Entry extends Extension\AbstractEntry
*/
protected function getAuthorFromElement(DOMElement $element)
{
$author = array();
$author = [];
$emailNode = $element->getElementsByTagName('email');
$nameNode = $element->getElementsByTagName('name');

View File

@ -48,7 +48,7 @@ class Feed extends Extension\AbstractFeed
$list = $this->xpath->query('//atom:author');
$authors = array();
$authors = [];
if ($list->length) {
foreach ($list as $author) {
@ -276,7 +276,7 @@ class Feed extends Extension\AbstractFeed
if (!$imageUrl) {
$image = null;
} else {
$image = array('uri' => $imageUrl);
$image = ['uri' => $imageUrl];
}
$this->data['image'] = $image;
@ -363,7 +363,7 @@ class Feed extends Extension\AbstractFeed
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');
@ -429,11 +429,11 @@ class Feed extends Extension\AbstractFeed
if ($list->length) {
$categoryCollection = new Collection\Category;
foreach ($list as $category) {
$categoryCollection[] = array(
$categoryCollection[] = [
'term' => $category->getAttribute('term'),
'scheme' => $category->getAttribute('scheme'),
'label' => $category->getAttribute('label')
);
];
}
} else {
return new Collection\Category;
@ -452,7 +452,7 @@ class Feed extends Extension\AbstractFeed
*/
protected function getAuthorFromElement(DOMElement $element)
{
$author = array();
$author = [];
$emailNode = $element->getElementsByTagName('email');
$nameNode = $element->getElementsByTagName('name');

View File

@ -42,7 +42,7 @@ class Entry extends Extension\AbstractEntry
return $this->data[$name];
}
$licenses = array();
$licenses = [];
$list = $this->xpath->evaluate($this->getXpathPrefix() . '//cc:license');
if ($list->length) {

View File

@ -42,7 +42,7 @@ class Feed extends Extension\AbstractFeed
return $this->data[$name];
}
$licenses = array();
$licenses = [];
$list = $this->xpath->evaluate('channel/cc:license');
if ($list->length) {

View File

@ -44,7 +44,7 @@ class Entry extends Extension\AbstractEntry
return $this->data['authors'];
}
$authors = array();
$authors = [];
$list = $this->getXpath()->evaluate($this->getXpathPrefix() . '//dc11:creator');
if (!$list->length) {
@ -60,9 +60,9 @@ class Entry extends Extension\AbstractEntry
if ($list->length) {
foreach ($list as $author) {
$authors[] = array(
$authors[] = [
'name' => $author->nodeValue
);
];
}
$authors = new Collection\Author(
Reader\Reader::arrayUnique($authors)
@ -96,11 +96,11 @@ class Entry extends Extension\AbstractEntry
if ($list->length) {
$categoryCollection = new Collection\Category;
foreach ($list as $category) {
$categoryCollection[] = array(
$categoryCollection[] = [
'term' => $category->nodeValue,
'scheme' => null,
'label' => $category->nodeValue,
);
];
}
} else {
$categoryCollection = new Collection\Category;

View File

@ -44,7 +44,7 @@ class Feed extends Extension\AbstractFeed
return $this->data['authors'];
}
$authors = array();
$authors = [];
$list = $this->getXpath()->query('//dc11:creator');
if (!$list->length) {
@ -60,9 +60,9 @@ class Feed extends Extension\AbstractFeed
if ($list->length) {
foreach ($list as $author) {
$authors[] = array(
$authors[] = [
'name' => $author->nodeValue
);
];
}
$authors = new Collection\Author(
Reader\Reader::arrayUnique($authors)
@ -249,11 +249,11 @@ class Feed extends Extension\AbstractFeed
if ($list->length) {
$categoryCollection = new Collection\Category;
foreach ($list as $category) {
$categoryCollection[] = array(
$categoryCollection[] = [
'term' => $category->nodeValue,
'scheme' => null,
'label' => $category->nodeValue,
);
];
}
} else {
$categoryCollection = new Collection\Category;

View File

@ -73,14 +73,14 @@ class Feed extends Extension\AbstractFeed
$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)) {

View File

@ -49,7 +49,7 @@ class Entry extends Extension\AbstractEntry
}
$stringParade = $this->getData($name);
$hitParade = array();
$hitParade = [];
if (!empty($stringParade)) {
$stringParade = explode(',', $stringParade);

View File

@ -53,7 +53,7 @@ class ExtensionManager implements ExtensionManagerInterface
__CLASS__
));
}
return call_user_func_array(array($this->pluginManager, $method), $args);
return call_user_func_array([$this->pluginManager, $method], $args);
}
/**

View File

@ -25,7 +25,7 @@ class ExtensionPluginManager extends AbstractPluginManager
*
* @var array
*/
protected $invokableClasses = array(
protected $invokableClasses = [
'atomentry' => 'Zend\Feed\Reader\Extension\Atom\Entry',
'atomfeed' => 'Zend\Feed\Reader\Extension\Atom\Feed',
'contententry' => 'Zend\Feed\Reader\Extension\Content\Entry',
@ -39,7 +39,7 @@ class ExtensionPluginManager extends AbstractPluginManager
'syndicationfeed' => 'Zend\Feed\Reader\Extension\Syndication\Feed',
'threadentry' => 'Zend\Feed\Reader\Extension\Thread\Entry',
'wellformedwebentry' => 'Zend\Feed\Reader\Extension\WellFormedWeb\Entry',
);
];
/**
* Do not share instances

View File

@ -24,7 +24,7 @@ abstract class AbstractFeed implements FeedInterface
*
* @var array
*/
protected $data = array();
protected $data = [];
/**
* Parsed feed data in the shape of a DOMDocument
@ -38,7 +38,7 @@ abstract class AbstractFeed implements FeedInterface
*
* @var array
*/
protected $entries = array();
protected $entries = [];
/**
* A pointer for the iterator to keep track of the entries array
@ -59,7 +59,7 @@ abstract class AbstractFeed implements FeedInterface
*
* @var array
*/
protected $extensions = array();
protected $extensions = [];
/**
* Original Source URI (set if imported from a URI)
@ -252,7 +252,7 @@ abstract class AbstractFeed implements FeedInterface
{
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);
}
}
throw new Exception\BadMethodCallException('Method: ' . $method

View File

@ -36,7 +36,7 @@ class Source extends Feed\Atom
$this->loadExtensions();
$manager = Reader\Reader::getExtensionManager();
$extensions = array('Atom\Feed', 'DublinCore\Feed');
$extensions = ['Atom\Feed', 'DublinCore\Feed'];
foreach ($extensions as $name) {
$extension = $manager->get($name);

View File

@ -83,13 +83,13 @@ class Rss extends AbstractFeed
return $this->data['authors'];
}
$authors = array();
$authors = [];
$authorsDc = $this->getExtension('DublinCore')->getAuthors();
if (!empty($authorsDc)) {
foreach ($authorsDc as $author) {
$authors[] = array(
$authors[] = [
'name' => $author['name']
);
];
}
}
@ -106,7 +106,7 @@ class Rss extends AbstractFeed
if ($list->length) {
foreach ($list as $author) {
$string = trim($author->nodeValue);
$data = array();
$data = [];
// Pretty rough parsing - but it's a catchall
if (preg_match("/^.*@[^ ]*/", $string, $matches)) {
$data['email'] = trim($matches[0]);
@ -205,14 +205,14 @@ class Rss extends AbstractFeed
if ($dateModifiedParsed) {
$date = new DateTime('@' . $dateModifiedParsed);
} else {
$dateStandards = array(DateTime::RSS, DateTime::RFC822,
DateTime::RFC2822, null);
$dateStandards = [DateTime::RSS, DateTime::RFC822,
DateTime::RFC2822, null];
foreach ($dateStandards as $standard) {
try {
$date = DateTime::createFromFormat($standard, $dateModified);
break;
} catch (\Exception $e) {
if ($standard == null) {
if ($standard === null) {
throw new Exception\RuntimeException(
'Could not load date due to unrecognised'
.' format (should follow RFC 822 or 2822):'
@ -265,14 +265,14 @@ class Rss extends AbstractFeed
if ($lastBuildDateParsed) {
$date = new DateTime('@' . $lastBuildDateParsed);
} else {
$dateStandards = array(DateTime::RSS, DateTime::RFC822,
DateTime::RFC2822, null);
$dateStandards = [DateTime::RSS, DateTime::RFC822,
DateTime::RFC2822, null];
foreach ($dateStandards as $standard) {
try {
$date = DateTime::createFromFormat($standard, $lastBuildDateParsed);
break;
} catch (\Exception $e) {
if ($standard == null) {
if ($standard === null) {
throw new Exception\RuntimeException(
'Could not load date due to unrecognised'
.' format (should follow RFC 822 or 2822):'
@ -391,7 +391,7 @@ class Rss extends AbstractFeed
$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;
@ -637,11 +637,11 @@ class Rss extends AbstractFeed
if ($list->length) {
$categoryCollection = new 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();

View File

@ -13,8 +13,6 @@ use ArrayObject;
use DOMNodeList;
use Zend\Feed\Uri;
/**
*/
class FeedSet extends ArrayObject
{
public $rss = null;
@ -53,11 +51,11 @@ class FeedSet extends ArrayObject
} elseif (!isset($this->rdf) && $link->getAttribute('type') == 'application/rdf+xml') {
$this->rdf = $this->absolutiseUri(trim($link->getAttribute('href')), $uri);
}
$this[] = new static(array(
$this[] = new static([
'rel' => 'alternate',
'type' => $link->getAttribute('type'),
'href' => $this->absolutiseUri(trim($link->getAttribute('href')), $uri),
));
]);
}
}
@ -75,7 +73,13 @@ class FeedSet extends ArrayObject
$link = $uri->getPath() . '/' . $link;
}
$link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->canonicalizePath($link);
$link = sprintf(
'%s://%s/%s',
($uri->getScheme() ?: 'http'),
$uri->getHost(),
$this->canonicalizePath($link)
);
if (!Uri::factory($link)->isValid()) {
$link = null;
}
@ -90,7 +94,7 @@ class FeedSet extends ArrayObject
protected function canonicalizePath($path)
{
$parts = array_filter(explode('/', $path));
$absolutes = array();
$absolutes = [];
foreach ($parts as $part) {
if ('.' == $part) {
continue;

View File

@ -72,24 +72,24 @@ class Reader implements ReaderImportInterface
protected static $extensionManager = null;
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
@ -619,24 +619,24 @@ class Reader implements ReaderImportInterface
static::$httpMethodOverride = false;
static::$httpConditionalGet = false;
static::$extensionManager = null;
static::$extensions = array(
'feed' => array(
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'
)
);
]
];
}
/**

View File

@ -11,7 +11,7 @@ namespace Zend\Feed\Reader;
class StandaloneExtensionManager implements ExtensionManagerInterface
{
private $extensions = array(
private $extensions = [
'Atom\Entry' => 'Zend\Feed\Reader\Extension\Atom\Entry',
'Atom\Feed' => 'Zend\Feed\Reader\Extension\Atom\Feed',
'Content\Entry' => 'Zend\Feed\Reader\Extension\Content\Entry',
@ -25,7 +25,7 @@ class StandaloneExtensionManager implements ExtensionManagerInterface
'Syndication\Feed' => 'Zend\Feed\Reader\Extension\Syndication\Feed',
'Thread\Entry' => 'Zend\Feed\Reader\Extension\Thread\Entry',
'WellFormedWeb\Entry' => 'Zend\Feed\Reader\Extension\WellFormedWeb\Entry',
);
];
/**
* Do we have the extension?

View File

@ -59,11 +59,11 @@ class Uri
/**
* Valid schemes
*/
protected $validSchemes = array(
protected $validSchemes = [
'http',
'https',
'file',
);
];
/**
* @param string $uri

View File

@ -20,7 +20,7 @@ class AbstractFeed
*
* @var array
*/
protected $data = array();
protected $data = [];
/**
* Holds the value "atom" or "rss" depending on the feed type set when
@ -221,7 +221,7 @@ class AbstractFeed
if (empty($data['name']) || !is_string($data['name'])) {
throw new Exception\InvalidArgumentException('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'])) {
throw new Exception\InvalidArgumentException('Invalid parameter: "version" must be a non-empty string');
@ -238,7 +238,7 @@ class AbstractFeed
if (empty($name) || !is_string($name)) {
throw new Exception\InvalidArgumentException('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)) {
throw new Exception\InvalidArgumentException('Invalid parameter: "version" must be a non-empty string');
@ -377,7 +377,7 @@ class AbstractFeed
if (empty($link) || !is_string($link) || !Uri::factory($link)->isValid()) {
throw new Exception\InvalidArgumentException('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'])) {
throw new Exception\InvalidArgumentException('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom');
}
$this->data['feedLinks'][strtolower($type)] = $link;
@ -451,7 +451,7 @@ class AbstractFeed
. ' 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;
@ -497,7 +497,7 @@ class AbstractFeed
}
}
if (!isset($this->data['categories'])) {
$this->data['categories'] = array();
$this->data['categories'] = [];
}
$this->data['categories'][] = $category;
@ -762,7 +762,7 @@ class AbstractFeed
*/
public function reset()
{
$this->data = array();
$this->data = [];
}
/**
@ -815,7 +815,7 @@ class AbstractFeed
{
foreach ($this->extensions as $extension) {
try {
return call_user_func_array(array($extension, $method), $args);
return call_user_func_array([$extension, $method], $args);
} catch (Exception\BadMethodCallException $e) {
}
}

View File

@ -21,7 +21,7 @@ class Deleted
*
* @var array
*/
protected $data = array();
protected $data = [];
/**
* Holds the value "atom" or "rss" depending on the feed type set when
@ -171,7 +171,7 @@ class Deleted
*/
public function setBy(array $by)
{
$author = array();
$author = [];
if (!array_key_exists('name', $by)
|| empty($by['name'])
|| !is_string($by['name'])

View File

@ -21,14 +21,14 @@ class 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
@ -311,12 +311,12 @@ class Entry
if (!isset($link['uri']) || !is_string($link['uri']) || !Uri::factory($link['uri'])->isValid()) {
throw new Exception\InvalidArgumentException('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'])) {
throw new Exception\InvalidArgumentException('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;
@ -552,7 +552,7 @@ class Entry
}
}
if (!isset($this->data['categories'])) {
$this->data['categories'] = array();
$this->data['categories'] = [];
}
$this->data['categories'][] = $category;
@ -698,7 +698,7 @@ class Entry
{
foreach ($this->extensions as $extension) {
try {
return call_user_func_array(array($extension, $method), $args);
return call_user_func_array([$extension, $method], $args);
} catch (\BadMethodCallException $e) {
}
}

View File

@ -23,7 +23,7 @@ class Entry
*
* @var array
*/
protected $data = array();
protected $data = [];
/**
* Encoding of all text values
@ -116,7 +116,7 @@ class Entry
. ' 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;
@ -152,7 +152,7 @@ class Entry
*/
public function setItunesExplicit($value)
{
if (!in_array($value, array('yes', 'no', 'clean'))) {
if (!in_array($value, ['yes', 'no', 'clean'])) {
throw new Writer\Exception\InvalidArgumentException('invalid parameter: "explicit" may only'
. ' be one of "yes", "no" or "clean"');
}

Some files were not shown because too many files have changed in this diff Show More