Create implementations for PSR-17 Response- and StreamFactoryInterface

This commit is contained in:
PJ Dietz 2020-08-16 10:47:39 -04:00
parent 9243dd7663
commit 95c3be85c9
8 changed files with 493 additions and 274 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "wellrested/wellrested", "name": "wellrested/wellrested",
"description": "Simple PHP Library for RESTful APIs", "description": "Simple PHP Library for RESTful APIs",
"keywords": ["rest", "restful", "api", "http", "psr7", "psr-7", "psr15", "psr-15"], "keywords": ["rest", "restful", "api", "http", "psr7", "psr-7", "psr15", "psr-15", "psr17", "psr-17"],
"homepage": "https://www.wellrested.org", "homepage": "https://www.wellrested.org",
"license": "MIT", "license": "MIT",
"type": "library", "type": "library",
@ -13,6 +13,7 @@
], ],
"require": { "require": {
"php": ">=7.2", "php": ">=7.2",
"psr/http-factory": "~1.0",
"psr/http-message": "~1.0", "psr/http-message": "~1.0",
"psr/http-server-handler": "~1.0", "psr/http-server-handler": "~1.0",
"psr/http-server-middleware": "~1.0" "psr/http-server-middleware": "~1.0"

526
composer.lock generated
View File

@ -4,8 +4,60 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "4d35c0aa434d9f710cd5a8a7246367d4", "content-hash": "041c27e394aba3e5c3bf6cbe8751f845",
"packages": [ "packages": [
{
"name": "psr/http-factory",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"time": "2019-04-30T12:38:16+00:00"
},
{ {
"name": "psr/http-message", "name": "psr/http-message",
"version": "1.0.1", "version": "1.0.1",
@ -314,6 +366,75 @@
], ],
"time": "2020-06-29T18:35:05+00:00" "time": "2020-06-29T18:35:05+00:00"
}, },
{
"name": "composer/package-versions-deprecated",
"version": "1.10.99.1",
"source": {
"type": "git",
"url": "https://github.com/composer/package-versions-deprecated.git",
"reference": "68c9b502036e820c33445ff4d174327f6bb87486"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/68c9b502036e820c33445ff4d174327f6bb87486",
"reference": "68c9b502036e820c33445ff4d174327f6bb87486",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.1.0 || ^2.0",
"php": "^7 || ^8"
},
"replace": {
"ocramius/package-versions": "1.10.99"
},
"require-dev": {
"composer/composer": "^1.9.3 || ^2.0@dev",
"ext-zip": "^1.13",
"phpunit/phpunit": "^6.5 || ^7"
},
"type": "composer-plugin",
"extra": {
"class": "PackageVersions\\Installer",
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"PackageVersions\\": "src/PackageVersions"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
},
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be"
}
],
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2020-08-13T12:55:41+00:00"
},
{ {
"name": "composer/semver", "name": "composer/semver",
"version": "1.5.1", "version": "1.5.1",
@ -435,16 +556,16 @@
}, },
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
"version": "1.10.3", "version": "1.10.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/annotations.git", "url": "https://github.com/doctrine/annotations.git",
"reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d" "reference": "bfe91e31984e2ba76df1c1339681770401ec262f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/5db60a4969eba0e0c197a19c077780aadbc43c5d", "url": "https://api.github.com/repos/doctrine/annotations/zipball/bfe91e31984e2ba76df1c1339681770401ec262f",
"reference": "5db60a4969eba0e0c197a19c077780aadbc43c5d", "reference": "bfe91e31984e2ba76df1c1339681770401ec262f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -454,7 +575,8 @@
}, },
"require-dev": { "require-dev": {
"doctrine/cache": "1.*", "doctrine/cache": "1.*",
"phpunit/phpunit": "^7.5" "phpstan/phpstan": "^0.12.20",
"phpunit/phpunit": "^7.5 || ^9.1.5"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -500,7 +622,7 @@
"docblock", "docblock",
"parser" "parser"
], ],
"time": "2020-05-25T17:24:27+00:00" "time": "2020-08-10T19:35:50+00:00"
}, },
{ {
"name": "doctrine/instantiator", "name": "doctrine/instantiator",
@ -935,16 +1057,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v4.8.0", "version": "v4.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "8c58eb4cd4f3883f82611abeac2efbc3dbed787e" "reference": "c346bbfafe2ff60680258b631afb730d186ed864"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8c58eb4cd4f3883f82611abeac2efbc3dbed787e", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c346bbfafe2ff60680258b631afb730d186ed864",
"reference": "8c58eb4cd4f3883f82611abeac2efbc3dbed787e", "reference": "c346bbfafe2ff60680258b631afb730d186ed864",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -952,8 +1074,8 @@
"php": ">=7.0" "php": ">=7.0"
}, },
"require-dev": { "require-dev": {
"ircmaxell/php-yacc": "^0.0.6", "ircmaxell/php-yacc": "0.0.5",
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0"
}, },
"bin": [ "bin": [
"bin/php-parse" "bin/php-parse"
@ -961,7 +1083,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.8-dev" "dev-master": "4.3-dev"
} }
}, },
"autoload": { "autoload": {
@ -983,68 +1105,7 @@
"parser", "parser",
"php" "php"
], ],
"time": "2020-08-09T10:23:20+00:00" "time": "2020-07-02T17:12:47+00:00"
},
{
"name": "ocramius/package-versions",
"version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/Ocramius/PackageVersions.git",
"reference": "94c9d42a466c57f91390cdd49c81313264f49d85"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/94c9d42a466c57f91390cdd49c81313264f49d85",
"reference": "94c9d42a466c57f91390cdd49c81313264f49d85",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.1.0 || ^2.0",
"php": "^7.4.0"
},
"require-dev": {
"composer/composer": "^1.9.3 || ^2.0@dev",
"doctrine/coding-standard": "^7.0.2",
"ext-zip": "^1.15.0",
"infection/infection": "^0.15.3",
"phpunit/phpunit": "^9.1.1",
"vimeo/psalm": "^3.9.3"
},
"type": "composer-plugin",
"extra": {
"class": "PackageVersions\\Installer",
"branch-alias": {
"dev-master": "1.99.x-dev"
}
},
"autoload": {
"psr-4": {
"PackageVersions\\": "src/PackageVersions"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
"funding": [
{
"url": "https://github.com/Ocramius",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/ocramius/package-versions",
"type": "tidelift"
}
],
"time": "2020-06-22T14:15:44+00:00"
}, },
{ {
"name": "openlss/lib-array2xml", "name": "openlss/lib-array2xml",
@ -1142,29 +1203,28 @@
}, },
{ {
"name": "phar-io/manifest", "name": "phar-io/manifest",
"version": "2.0.1", "version": "1.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phar-io/manifest.git", "url": "https://github.com/phar-io/manifest.git",
"reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
"reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-phar": "*", "ext-phar": "*",
"ext-xmlwriter": "*", "phar-io/version": "^2.0",
"phar-io/version": "^3.0.1", "php": "^5.6 || ^7.0"
"php": "^7.2 || ^8.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.0.x-dev" "dev-master": "1.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -1194,24 +1254,24 @@
} }
], ],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"time": "2020-06-27T14:33:11+00:00" "time": "2018-07-08T19:23:20+00:00"
}, },
{ {
"name": "phar-io/version", "name": "phar-io/version",
"version": "3.0.2", "version": "2.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phar-io/version.git", "url": "https://github.com/phar-io/version.git",
"reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0" "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/c6bb6825def89e0a32220f88337f8ceaf1975fa0", "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6",
"reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0", "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2 || ^8.0" "php": "^5.6 || ^7.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -1241,7 +1301,7 @@
} }
], ],
"description": "Library for handling version information and constraints", "description": "Library for handling version information and constraints",
"time": "2020-06-27T14:39:04+00:00" "time": "2018-07-08T19:19:57+00:00"
}, },
{ {
"name": "php-cs-fixer/diff", "name": "php-cs-fixer/diff",
@ -1345,16 +1405,16 @@
}, },
{ {
"name": "phpdocumentor/reflection-docblock", "name": "phpdocumentor/reflection-docblock",
"version": "5.2.0", "version": "5.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "3170448f5769fe19f456173d833734e0ff1b84df" "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/3170448f5769fe19f456173d833734e0ff1b84df", "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d870572532cd70bc3fab58f2e23ad423c8404c44",
"reference": "3170448f5769fe19f456173d833734e0ff1b84df", "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1393,7 +1453,7 @@
} }
], ],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2020-07-20T20:05:34+00:00" "time": "2020-08-15T11:14:08+00:00"
}, },
{ {
"name": "phpdocumentor/type-resolver", "name": "phpdocumentor/type-resolver",
@ -1553,35 +1613,32 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "9.1.2", "version": "8.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "5210f9269e44e6d34419cb92242ef11aee9351ac" "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5210f9269e44e6d34419cb92242ef11aee9351ac", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca6647ffddd2add025ab3f21644a441d7c146cdc",
"reference": "5210f9269e44e6d34419cb92242ef11aee9351ac", "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"nikic/php-parser": "^4.7", "php": "^7.3",
"php": "^7.3 || ^8.0", "phpunit/php-file-iterator": "^3.0",
"phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0",
"phpunit/php-text-template": "^2.0.2", "phpunit/php-token-stream": "^4.0",
"sebastian/code-unit-reverse-lookup": "^2.0.2", "sebastian/code-unit-reverse-lookup": "^2.0",
"sebastian/complexity": "^2.0", "sebastian/environment": "^5.0",
"sebastian/environment": "^5.1.2", "sebastian/version": "^3.0",
"sebastian/lines-of-code": "^1.0", "theseer/tokenizer": "^1.1.3"
"sebastian/version": "^3.0.1",
"theseer/tokenizer": "^1.2.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.3" "phpunit/phpunit": "^9.0"
}, },
"suggest": { "suggest": {
"ext-pcov": "*", "ext-pcov": "*",
@ -1590,7 +1647,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "9.1-dev" "dev-master": "8.0-dev"
} }
}, },
"autoload": { "autoload": {
@ -1622,7 +1679,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-08-10T07:24:51+00:00" "time": "2020-05-23T08:02:54+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@ -1850,17 +1907,73 @@
"time": "2020-06-26T11:58:13+00:00" "time": "2020-06-26T11:58:13+00:00"
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/php-token-stream",
"version": "9.3.5", "version": "4.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "7115b00b23bcd4f62a73855c9615694d2f206e71" "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7115b00b23bcd4f62a73855c9615694d2f206e71", "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3",
"reference": "7115b00b23bcd4f62a73855c9615694d2f206e71", "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"abandoned": true,
"time": "2020-08-04T08:28:15+00:00"
},
{
"name": "phpunit/phpunit",
"version": "9.2.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c6a9e4312e209e659f1fce3ce88dd197c2448f6",
"reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1871,30 +1984,30 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-xml": "*", "ext-xml": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.10.1", "myclabs/deep-copy": "^1.9.5",
"phar-io/manifest": "^2.0.1", "phar-io/manifest": "^1.0.3",
"phar-io/version": "^3.0.2", "phar-io/version": "^2.0.1",
"php": "^7.3 || ^8.0", "php": "^7.3",
"phpspec/prophecy": "^1.11.1", "phpspec/prophecy": "^1.10.3",
"phpunit/php-code-coverage": "^9.1.1", "phpunit/php-code-coverage": "^8.0.2",
"phpunit/php-file-iterator": "^3.0.4", "phpunit/php-file-iterator": "^3.0.3",
"phpunit/php-invoker": "^3.1", "phpunit/php-invoker": "^3.0.2",
"phpunit/php-text-template": "^2.0.2", "phpunit/php-text-template": "^2.0.2",
"phpunit/php-timer": "^5.0.1", "phpunit/php-timer": "^5.0.1",
"sebastian/code-unit": "^1.0.5", "sebastian/code-unit": "^1.0.5",
"sebastian/comparator": "^4.0.3", "sebastian/comparator": "^4.0.3",
"sebastian/diff": "^4.0.2", "sebastian/diff": "^4.0.1",
"sebastian/environment": "^5.1.2", "sebastian/environment": "^5.1.2",
"sebastian/exporter": "^4.0.2", "sebastian/exporter": "^4.0.2",
"sebastian/global-state": "^5.0", "sebastian/global-state": "^4.0",
"sebastian/object-enumerator": "^4.0.2", "sebastian/object-enumerator": "^4.0.2",
"sebastian/resource-operations": "^3.0.2", "sebastian/resource-operations": "^3.0.2",
"sebastian/type": "^2.2.1", "sebastian/type": "^2.1.1",
"sebastian/version": "^3.0.1" "sebastian/version": "^3.0.1"
}, },
"require-dev": { "require-dev": {
"ext-pdo": "*", "ext-pdo": "*",
"phpspec/prophecy-phpunit": "^2.0.1" "phpspec/prophecy-phpunit": "^2.0"
}, },
"suggest": { "suggest": {
"ext-soap": "*", "ext-soap": "*",
@ -1906,7 +2019,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "9.3-dev" "dev-master": "9.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -1945,7 +2058,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2020-08-10T06:50:08+00:00" "time": "2020-07-13T17:55:55+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@ -2262,59 +2375,6 @@
], ],
"time": "2020-06-26T12:05:46+00:00" "time": "2020-06-26T12:05:46+00:00"
}, },
{
"name": "sebastian/complexity",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/complexity.git",
"reference": "33fcd6a26656c6546f70871244ecba4b4dced097"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/33fcd6a26656c6546f70871244ecba4b4dced097",
"reference": "33fcd6a26656c6546f70871244ecba4b4dced097",
"shasum": ""
},
"require": {
"nikic/php-parser": "^4.7",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for calculating the complexity of PHP code units",
"homepage": "https://github.com/sebastianbergmann/complexity",
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-07-25T14:01:34+00:00"
},
{ {
"name": "sebastian/diff", "name": "sebastian/diff",
"version": "4.0.2", "version": "4.0.2",
@ -2511,26 +2571,26 @@
}, },
{ {
"name": "sebastian/global-state", "name": "sebastian/global-state",
"version": "5.0.0", "version": "4.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git", "url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "22ae663c951bdc39da96603edc3239ed3a299097" "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/22ae663c951bdc39da96603edc3239ed3a299097", "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bdb1e7c79e592b8c82cb1699be3c8743119b8a72",
"reference": "22ae663c951bdc39da96603edc3239ed3a299097", "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.3 || ^8.0", "php": "^7.3",
"sebastian/object-reflector": "^2.0", "sebastian/object-reflector": "^2.0",
"sebastian/recursion-context": "^4.0" "sebastian/recursion-context": "^4.0"
}, },
"require-dev": { "require-dev": {
"ext-dom": "*", "ext-dom": "*",
"phpunit/phpunit": "^9.3" "phpunit/phpunit": "^9.0"
}, },
"suggest": { "suggest": {
"ext-uopz": "*" "ext-uopz": "*"
@ -2538,7 +2598,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "5.0-dev" "dev-master": "4.0-dev"
} }
}, },
"autoload": { "autoload": {
@ -2561,66 +2621,7 @@
"keywords": [ "keywords": [
"global state" "global state"
], ],
"funding": [ "time": "2020-02-07T06:11:37+00:00"
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-08-07T04:09:03+00:00"
},
{
"name": "sebastian/lines-of-code",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/lines-of-code.git",
"reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e02bf626f404b5daec382a7b8a6a4456e49017e5",
"reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5",
"shasum": ""
},
"require": {
"nikic/php-parser": "^4.6",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for counting the lines of code in PHP source code",
"homepage": "https://github.com/sebastianbergmann/lines-of-code",
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-07-22T18:33:42+00:00"
}, },
{ {
"name": "sebastian/object-enumerator", "name": "sebastian/object-enumerator",
@ -4408,21 +4409,22 @@
}, },
{ {
"name": "vimeo/psalm", "name": "vimeo/psalm",
"version": "3.12.2", "version": "3.13.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/vimeo/psalm.git", "url": "https://github.com/vimeo/psalm.git",
"reference": "7c7ebd068f8acaba211d4a2c707c4ba90874fa26" "reference": "afd8874a9e4562eac42a02de90e42e430c3a1db1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/7c7ebd068f8acaba211d4a2c707c4ba90874fa26", "url": "https://api.github.com/repos/vimeo/psalm/zipball/afd8874a9e4562eac42a02de90e42e430c3a1db1",
"reference": "7c7ebd068f8acaba211d4a2c707c4ba90874fa26", "reference": "afd8874a9e4562eac42a02de90e42e430c3a1db1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"amphp/amp": "^2.1", "amphp/amp": "^2.1",
"amphp/byte-stream": "^1.5", "amphp/byte-stream": "^1.5",
"composer/package-versions-deprecated": "^1.8.0",
"composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/semver": "^1.4 || ^2.0 || ^3.0",
"composer/xdebug-handler": "^1.1", "composer/xdebug-handler": "^1.1",
"ext-dom": "*", "ext-dom": "*",
@ -4432,9 +4434,8 @@
"ext-tokenizer": "*", "ext-tokenizer": "*",
"felixfbecker/advanced-json-rpc": "^3.0.3", "felixfbecker/advanced-json-rpc": "^3.0.3",
"felixfbecker/language-server-protocol": "^1.4", "felixfbecker/language-server-protocol": "^1.4",
"netresearch/jsonmapper": "^1.0 || ^2.0", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0",
"nikic/php-parser": "^4.3", "nikic/php-parser": "4.3.* || 4.4.* || 4.5.* || 4.6.*",
"ocramius/package-versions": "^1.2",
"openlss/lib-array2xml": "^1.0", "openlss/lib-array2xml": "^1.0",
"php": "^7.1.3|^8", "php": "^7.1.3|^8",
"sebastian/diff": "^3.0 || ^4.0", "sebastian/diff": "^3.0 || ^4.0",
@ -4450,7 +4451,6 @@
"bamarni/composer-bin-plugin": "^1.2", "bamarni/composer-bin-plugin": "^1.2",
"brianium/paratest": "^4.0.0", "brianium/paratest": "^4.0.0",
"ext-curl": "*", "ext-curl": "*",
"php-coveralls/php-coveralls": "^2.2",
"phpmyadmin/sql-parser": "5.1.0", "phpmyadmin/sql-parser": "5.1.0",
"phpspec/prophecy": ">=1.9.0", "phpspec/prophecy": ">=1.9.0",
"phpunit/phpunit": "^7.5.16 || ^8.5 || ^9.0", "phpunit/phpunit": "^7.5.16 || ^8.5 || ^9.0",
@ -4501,7 +4501,7 @@
"inspection", "inspection",
"php" "php"
], ],
"time": "2020-07-03T16:59:07+00:00" "time": "2020-07-30T19:42:34+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",

View File

@ -9,18 +9,17 @@
stopOnFailure="false" stopOnFailure="false"
verbose="true" verbose="true"
> >
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="./coverage"/>
</report>
</coverage>
<testsuites> <testsuites>
<testsuite name="unit"> <testsuite name="unit">
<directory>./tests</directory> <directory>./tests</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<logging/> <filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./coverage" />
</logging>
</phpunit> </phpunit>

View File

@ -0,0 +1,27 @@
<?php
namespace WellRESTed\Message;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
class ResponseFactory implements ResponseFactoryInterface
{
/**
* Create a new response.
*
* @param int $code HTTP status code; defaults to 200
* @param string $reasonPhrase Reason phrase to associate with status code
* in generated response; if none is provided implementations MAY use
* the defaults as suggested in the HTTP specification.
*
* @return ResponseInterface
*/
public function createResponse(
int $code = 200,
string $reasonPhrase = ''
): ResponseInterface {
return (new Response())
->withStatus($code, $reasonPhrase);
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace WellRESTed\Message;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\StreamInterface;
use RuntimeException;
class StreamFactory implements StreamFactoryInterface
{
/**
* Create a new stream from a string.
*
* @param string $content String content with which to populate the stream.
* @return StreamInterface
*/
public function createStream(string $content = ''): StreamInterface
{
return new Stream($content);
}
/**
* Create a stream from an existing file.
*
* @param string $filename Filename or stream URI to use as basis of stream.
* @param string $mode Mode with which to open the underlying file/stream.
*
* @return StreamInterface
* @throws RuntimeException If the file cannot be opened.
*/
public function createStreamFromFile(
string $filename,
string $mode = 'r'
): StreamInterface {
$f = fopen($filename, $mode);
if ($f === false) {
throw new RuntimeException();
}
return new Stream($f);
}
/**
* Create a new stream from an existing resource.
*
* @param resource $resource PHP resource to use as basis of stream.
*
* @return StreamInterface
*/
public function createStreamFromResource($resource): StreamInterface
{
return new Stream($resource);
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace WellRESTed\Message;
use WellRESTed\Test\TestCase;
class ResponseFactoryTest extends TestCase
{
public function testCreatesResponseWithStatusCode200ByDefault(): void
{
$statusCode = 200;
$reasonPhrase = 'OK';
$factory = new ResponseFactory();
$response = $factory->createResponse();
$this->assertEquals($statusCode, $response->getStatusCode());
$this->assertEquals($reasonPhrase, $response->getReasonPhrase());
}
public function testCreateResponseWithStatusCode(): void
{
$statusCode = 201;
$reasonPhrase = 'Created';
$factory = new ResponseFactory();
$response = $factory->createResponse($statusCode);
$this->assertEquals($statusCode, $response->getStatusCode());
$this->assertEquals($reasonPhrase, $response->getReasonPhrase());
}
public function testCreateResponseWithStatusCodeAndCustomReasonPhrase(): void
{
$statusCode = 512;
$reasonPhrase = 'Shortage of Chairs';
$factory = new ResponseFactory();
$response = $factory->createResponse($statusCode, $reasonPhrase);
$this->assertEquals($statusCode, $response->getStatusCode());
$this->assertEquals($reasonPhrase, $response->getReasonPhrase());
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace WellRESTed\Message;
use RuntimeException;
use WellRESTed\Test\TestCase;
class StreamFactoryTest extends TestCase
{
private const CONTENT = 'Stream content';
/** @var string $tempPath */
private $tempPath;
protected function setUp(): void
{
parent::setUp();
$this->tempPath = tempnam(sys_get_temp_dir(), 'test');
file_put_contents($this->tempPath, self::CONTENT);
}
protected function tearDown(): void
{
parent::tearDown();
unlink($this->tempPath);
}
// -------------------------------------------------------------------------
public function testCreatesStreamFromString(): void
{
$factory = new StreamFactory();
$stream = $factory->createStream(self::CONTENT);
$this->assertEquals(self::CONTENT, (string) $stream);
}
public function testCreatesStreamFromFile(): void
{
$factory = new StreamFactory();
$stream = $factory->createStreamFromFile($this->tempPath);
$this->assertEquals(self::CONTENT, (string) $stream);
}
public function testCreatesStreamFromFileWithModeRByDefault(): void
{
$factory = new StreamFactory();
$stream = $factory->createStreamFromFile($this->tempPath);
$mode = $stream->getMetadata('mode');
$this->assertEquals('r', $mode);
}
/**
* @dataProvider modeProvider
* @param string $mode
*/
public function testCreatesStreamFromFileWithPassedMode(string $mode): void
{
$factory = new StreamFactory();
$stream = $factory->createStreamFromFile($this->tempPath, $mode);
$actual = $stream->getMetadata('mode');
$this->assertEquals($mode, $actual);
}
public function modeProvider(): array
{
return [
['r'],
['r+'],
['w'],
['w+']
];
}
public function testCreateStreamFromFileThrowsRuntimeExceptionWhenUnableToOpenFile(): void
{
$this->expectException(RuntimeException::class);
$factory = new StreamFactory();
@$factory->createStreamFromFile('/dev/null/not-a-file', 'w');
}
public function testCreatesStreamFromResource(): void
{
$f = fopen($this->tempPath, 'r');
$factory = new StreamFactory();
$stream = $factory->createStreamFromResource($f);
$this->assertEquals(self::CONTENT, (string) $stream);
}
}