1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00
Daniel Neto 2025-03-27 09:23:53 -03:00
parent 8eb0a49081
commit c7e819c483
210 changed files with 3966 additions and 20977 deletions

View file

@ -19,15 +19,13 @@
"google/apiclient-services": "*", "google/apiclient-services": "*",
"google/auth": "^1.14.3", "google/auth": "^1.14.3",
"guzzlehttp/guzzle": "^7.4", "guzzlehttp/guzzle": "^7.4",
"guzzlehttp/psr7": "^2.7", "guzzlehttp/psr7": "^2.0 || ^2.4 || ^2.6 || ^2.7",
"hybridauth/hybridauth": "^3.3", "hybridauth/hybridauth": "^3.3",
"james-heinrich/getid3": "^1.9", "james-heinrich/getid3": "^1.9",
"monolog/monolog": "^2.6", "monolog/monolog": "^2.6",
"phpmailer/phpmailer": "^6.2", "phpmailer/phpmailer": "^6.2",
"psr/cache": "^3.0", "psr/cache": "^3.0",
"psr/http-message": "^2.0", "psr/http-message": "^2.0",
"cboden/ratchet": "^0.4.3",
"ratchet/pawl": "^0.4.1",
"singpolyma/openpgp-php": "^0.7.0", "singpolyma/openpgp-php": "^0.7.0",
"aws/aws-sdk-php": "^3.180", "aws/aws-sdk-php": "^3.180",
"gliterd/backblaze-b2": "^1.1", "gliterd/backblaze-b2": "^1.1",
@ -39,7 +37,6 @@
"emojione/emojione": "^4.5", "emojione/emojione": "^4.5",
"abraham/twitteroauth": "^7.0", "abraham/twitteroauth": "^7.0",
"symfony/http-client": "^5.3", "symfony/http-client": "^5.3",
"nyholm/psr7": "^1.4",
"norkunas/onesignal-php-api": "^2.7", "norkunas/onesignal-php-api": "^2.7",
"stripe/stripe-php": "^16.1", "stripe/stripe-php": "^16.1",
"symfony/translation": "^5.3", "symfony/translation": "^5.3",
@ -55,6 +52,7 @@
"react/socket": "^1.16", "react/socket": "^1.16",
"react/event-loop": "^1.5", "react/event-loop": "^1.5",
"elephantio/elephant.io": "^4.13", "elephantio/elephant.io": "^4.13",
"iamcal/sql-parser": "^0.6" "iamcal/sql-parser": "^0.6",
"ratchet/pawl": "^0.4.3"
} }
} }

255
composer.lock generated
View file

@ -4,7 +4,7 @@
"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": "9ca6cb14ba86e1e302c228132ca26cbf", "content-hash": "065c961cc46399bcab2a49230cce8d62",
"packages": [ "packages": [
{ {
"name": "abraham/twitteroauth", "name": "abraham/twitteroauth",
@ -619,69 +619,6 @@
], ],
"time": "2023-12-11T17:09:12+00:00" "time": "2023-12-11T17:09:12+00:00"
}, },
{
"name": "cboden/ratchet",
"version": "v0.4.4",
"source": {
"type": "git",
"url": "https://github.com/ratchetphp/Ratchet.git",
"reference": "5012dc954541b40c5599d286fd40653f5716a38f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ratchetphp/Ratchet/zipball/5012dc954541b40c5599d286fd40653f5716a38f",
"reference": "5012dc954541b40c5599d286fd40653f5716a38f",
"shasum": ""
},
"require": {
"guzzlehttp/psr7": "^1.7|^2.0",
"php": ">=5.4.2",
"ratchet/rfc6455": "^0.3.1",
"react/event-loop": ">=0.4",
"react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5",
"symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0",
"symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"type": "library",
"autoload": {
"psr-4": {
"Ratchet\\": "src/Ratchet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"role": "Developer"
},
{
"name": "Matt Bonneau",
"role": "Developer"
}
],
"description": "PHP WebSocket library",
"homepage": "http://socketo.me",
"keywords": [
"Ratchet",
"WebSockets",
"server",
"sockets",
"websocket"
],
"support": {
"chat": "https://gitter.im/reactphp/reactphp",
"issues": "https://github.com/ratchetphp/Ratchet/issues",
"source": "https://github.com/ratchetphp/Ratchet/tree/v0.4.4"
},
"time": "2021-12-14T00:20:41+00:00"
},
{ {
"name": "chillerlan/php-qrcode", "name": "chillerlan/php-qrcode",
"version": "5.0.3", "version": "5.0.3",
@ -2527,84 +2464,6 @@
}, },
"time": "2024-09-01T15:54:00+00:00" "time": "2024-09-01T15:54:00+00:00"
}, },
{
"name": "nyholm/psr7",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/Nyholm/psr7.git",
"reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Nyholm/psr7/zipball/a71f2b11690f4b24d099d6b16690a90ae14fc6f3",
"reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3",
"shasum": ""
},
"require": {
"php": ">=7.2",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.1 || ^2.0"
},
"provide": {
"php-http/message-factory-implementation": "1.0",
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"http-interop/http-factory-tests": "^0.9",
"php-http/message-factory": "^1.0",
"php-http/psr7-integration-tests": "^1.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
"symfony/error-handler": "^4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"autoload": {
"psr-4": {
"Nyholm\\Psr7\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
},
{
"name": "Martijn van der Ven",
"email": "martijn@vanderven.se"
}
],
"description": "A fast PHP7 implementation of PSR-7",
"homepage": "https://tnyholm.se",
"keywords": [
"psr-17",
"psr-7"
],
"support": {
"issues": "https://github.com/Nyholm/psr7/issues",
"source": "https://github.com/Nyholm/psr7/tree/1.8.2"
},
"funding": [
{
"url": "https://github.com/Zegnat",
"type": "github"
},
{
"url": "https://github.com/nyholm",
"type": "github"
}
],
"time": "2024-09-09T07:06:30+00:00"
},
{ {
"name": "paragonie/constant_time_encoding", "name": "paragonie/constant_time_encoding",
"version": "v2.7.0", "version": "v2.7.0",
@ -3862,24 +3721,26 @@
}, },
{ {
"name": "ratchet/rfc6455", "name": "ratchet/rfc6455",
"version": "v0.3.1", "version": "v0.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/ratchetphp/RFC6455.git", "url": "https://github.com/ratchetphp/RFC6455.git",
"reference": "7c964514e93456a52a99a20fcfa0de242a43ccdb" "reference": "859d95f85dda0912c6d5b936d036d044e3af47ef"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ratchetphp/RFC6455/zipball/7c964514e93456a52a99a20fcfa0de242a43ccdb", "url": "https://api.github.com/repos/ratchetphp/RFC6455/zipball/859d95f85dda0912c6d5b936d036d044e3af47ef",
"reference": "7c964514e93456a52a99a20fcfa0de242a43ccdb", "reference": "859d95f85dda0912c6d5b936d036d044e3af47ef",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"guzzlehttp/psr7": "^2 || ^1.7", "php": ">=7.4",
"php": ">=5.4.2" "psr/http-factory-implementation": "^1.0",
"symfony/polyfill-php80": "^1.15"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^5.7", "guzzlehttp/psr7": "^2.7",
"phpunit/phpunit": "^9.5",
"react/socket": "^1.3" "react/socket": "^1.3"
}, },
"type": "library", "type": "library",
@ -3913,9 +3774,9 @@
"support": { "support": {
"chat": "https://gitter.im/reactphp/reactphp", "chat": "https://gitter.im/reactphp/reactphp",
"issues": "https://github.com/ratchetphp/RFC6455/issues", "issues": "https://github.com/ratchetphp/RFC6455/issues",
"source": "https://github.com/ratchetphp/RFC6455/tree/v0.3.1" "source": "https://github.com/ratchetphp/RFC6455/tree/v0.4.0"
}, },
"time": "2021-12-09T23:20:49+00:00" "time": "2025-02-24T01:18:22+00:00"
}, },
{ {
"name": "react/cache", "name": "react/cache",
@ -6009,96 +5870,6 @@
], ],
"time": "2024-09-09T11:45:10+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{
"name": "symfony/routing",
"version": "v5.4.48",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "dd08c19879a9b37ff14fd30dcbdf99a4cf045db1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/dd08c19879a9b37ff14fd30dcbdf99a4cf045db1",
"reference": "dd08c19879a9b37ff14fd30dcbdf99a4cf045db1",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-php80": "^1.16"
},
"conflict": {
"doctrine/annotations": "<1.12",
"symfony/config": "<5.3",
"symfony/dependency-injection": "<4.4",
"symfony/yaml": "<4.4"
},
"require-dev": {
"doctrine/annotations": "^1.12|^2",
"psr/log": "^1|^2|^3",
"symfony/config": "^5.3|^6.0",
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
"symfony/expression-language": "^4.4|^5.0|^6.0",
"symfony/http-foundation": "^4.4|^5.0|^6.0",
"symfony/yaml": "^4.4|^5.0|^6.0"
},
"suggest": {
"symfony/config": "For using the all-in-one router or any loader",
"symfony/expression-language": "For using expression matching",
"symfony/http-foundation": "For using a Symfony Request object",
"symfony/yaml": "For using the YAML loader"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Routing\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Maps an HTTP request to a set of configuration variables",
"homepage": "https://symfony.com",
"keywords": [
"router",
"routing",
"uri",
"url"
],
"support": {
"source": "https://github.com/symfony/routing/tree/v5.4.48"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-11-12T18:20:21+00:00"
},
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
"version": "v2.5.4", "version": "v2.5.4",
@ -6651,5 +6422,5 @@
"platform-overrides": { "platform-overrides": {
"php": "8" "php": "8"
}, },
"plugin-api-version": "2.6.0" "plugin-api-version": "2.3.0"
} }

17
vendor/autoload.php vendored
View file

@ -3,21 +3,8 @@
// autoload.php @generated by Composer // autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) { if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) { echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
header('HTTP/1.1 500 Internal Server Error'); exit(1);
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
} }
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';

View file

@ -1,52 +0,0 @@
name: "CI"
on:
pull_request:
push:
branches:
- "master"
schedule:
- cron: "42 3 * * *"
jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"
strategy:
matrix:
php-version:
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
dependencies:
- "highest"
include:
- dependencies: "lowest"
php-version: "5.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"
ini-values: "zend.assertions=1"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit"

View file

@ -1,5 +0,0 @@
phpunit.xml
reports
sandbox
vendor
composer.lock

View file

@ -1,150 +0,0 @@
CHANGELOG
=========
### Legend
* "BC": Backwards compatibility break (from public component APIs)
* "BF": Bug fix
---
* 0.4.4 (2021-12-11)
* Correct and update dependencies for forward compatibility
* Added context for React Socket server to App
* Use non-deprecated Guzzle API calls
* 0.4.3 (2020-06-04)
* BF: Fixed interface acceptable regression in `App`
* Update RFC6455 library with latest fixes
* 0.4.2 (2020-01-27)
* Support Symfony 5
* BF: Use phpunit from vendor directory
* Allow disabling of xdebug warning by defining `RATCHET_DISABLE_XDEBUG_WARN`
* Stop using `LoopInterface::tick()` for testing
* 0.4.1 (2017-12-11)
* Only enableKeepAlive in App if no WsServer passed allowing user to set their own timeout duration
* Support Symfony 4
* BF: Plug NOOP controller in connection from router in case of misbehaving client
* BF: Raise error from invalid WAMP payload
* 0.4 (2017-09-14)
* BC: $conn->WebSocket->request replaced with $conn->httpRequest which is a PSR-7 object
* Binary messages now supported via Ratchet\WebSocket\MessageComponentInterface
* Added heartbeat support via ping/pong in WsServer
* BC: No longer support old (and insecure) Hixie76 and Hybi protocols
* BC: No longer support disabling UTF-8 checks
* BC: The Session component implements HttpServerInterface instead of WsServerInterface
* BC: PHP 5.3 no longer supported
* BC: Update to newer version of react/socket dependency
* BC: WAMP topics reduced to 0 subscriptions are deleted, new subs to same name will result in new Topic instance
* Significant performance enhancements
* 0.3.6 (2017-01-06)
* BF: Keep host and scheme in HTTP request object attatched to connection
* BF: Return correct HTTP response (405) when non-GET request made
* 0.3.5 (2016-05-25)
* BF: Unmask responding close frame
* Added write handler for PHP session serializer
* 0.3.4 (2015-12-23)
* BF: Edge case where version check wasn't run on message coalesce
* BF: Session didn't start when using pdo_sqlite
* BF: WAMP currie prefix check when using '#'
* Compatibility with Symfony 3
* 0.3.3 (2015-05-26)
* BF: Framing bug on large messages upon TCP fragmentation
* BF: Symfony Router query parameter defaults applied to Request
* BF: WAMP CURIE on all URIs
* OriginCheck rules applied to FlashPolicy
* Switched from PSR-0 to PSR-4
* 0.3.2 (2014-06-08)
* BF: No messages after closing handshake (fixed rare race condition causing 100% CPU)
* BF: Fixed accidental BC break from v0.3.1
* Added autoDelete parameter to Topic to destroy when empty of connections
* Exposed React Socket on IoServer (allowing FlashPolicy shutdown in App)
* Normalized Exceptions in WAMP
* 0.3.1 (2014-05-26)
* Added query parameter support to Router, set in HTTP request (ws://server?hello=world)
* HHVM compatibility
* BF: React/0.4 support; CPU starvation bug fixes
* BF: Allow App::route to ignore Host header
* Added expected filters to WAMP Topic broadcast method
* Resource cleanup in WAMP TopicManager
* 0.3.0 (2013-10-14)
* Added the `App` class to help making Ratchet so easy to use it's silly
* BC: Require hostname to do HTTP Host header match and do Origin HTTP header check, verify same name by default, helping prevent CSRF attacks
* Added Symfony/2.2 based HTTP Router component to allowing for a single Ratchet server to handle multiple apps -> Ratchet\Http\Router
* BC: Decoupled HTTP from WebSocket component -> Ratchet\Http\HttpServer
* BF: Single sub-protocol selection to conform with RFC6455
* BF: Sanity checks on WAMP protocol to prevent errors
* 0.2.8 (2013-09-19)
* React 0.3 support
* 0.2.7 (2013-06-09)
* BF: Sub-protocol negotation with Guzzle 3.6
* 0.2.6 (2013-06-01)
* Guzzle 3.6 support
* 0.2.5 (2013-04-01)
* Fixed Hixie-76 handshake bug
* 0.2.4 (2013-03-09)
* Support for Symfony 2.2 and Guzzle 2.3
* Minor bug fixes when handling errors
* 0.2.3 (2012-11-21)
* Bumped dep: Guzzle to v3, React to v0.2.4
* More tests
* 0.2.2 (2012-10-20)
* Bumped deps to use React v0.2
* 0.2.1 (2012-10-13)
* BF: No more UTF-8 warnings in browsers (no longer sending empty sub-protocol string)
* Documentation corrections
* Using new composer structure
* 0.2 (2012-09-07)
* Ratchet passes every non-binary-frame test from the Autobahn Testsuite
* Major performance improvements
* BC: Renamed "WampServer" to "ServerProtocol"
* BC: New "WampServer" component passes Topic container objects of subscribed Connections
* Option to turn off UTF-8 checks in order to increase performance
* Switched dependency guzzle/guzzle to guzzle/http (no API changes)
* mbstring no longer required
* 0.1.5 (2012-07-12)
* BF: Error where service wouldn't run on PHP <= 5.3.8
* Dependency library updates
* 0.1.4 (2012-06-17)
* Fixed dozens of failing AB tests
* BF: Proper socket buffer handling
* 0.1.3 (2012-06-15)
* Major refactor inside WebSocket protocol handling, more loosley coupled
* BF: Proper error handling on failed WebSocket connections
* BF: Handle TCP message concatenation
* Inclusion of the AutobahnTestSuite checking WebSocket protocol compliance
* mb_string now a requirement
* 0.1.2 (2012-05-19)
* BC/BF: Updated WAMP API to coincide with the official spec
* Tweaks to improve running as a long lived process
* 0.1.1 (2012-05-14)
* Separated interfaces allowing WebSockets to support multiple sub protocols
* BF: remoteAddress variable on connections returns proper value
* 0.1 (2012-05-11)
* First release with components: IoServer, WsServer, SessionProvider, WampServer, FlashPolicy, IpBlackList
* I/O now handled by React, making Ratchet fully asynchronous

View file

@ -1,19 +0,0 @@
Copyright (c) 2011 Chris Boden
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -1,42 +0,0 @@
# This file is intended to ease the author's development and testing process
# Users do not need to use `make`; Ratchet does not need to be compiled
test:
vendor/bin/phpunit
cover:
vendor/bin/phpunit --coverage-text --coverage-html=reports/coverage
abtests:
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver.php 8001 LibEvent &
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver.php 8002 StreamSelect &
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver.php 8004 LibEv &
wstest -m testeeserver -w ws://localhost:8000 &
sleep 1
wstest -m fuzzingclient -s tests/autobahn/fuzzingclient-all.json
killall php wstest
abtest:
ulimit -n 2048 && php tests/autobahn/bin/fuzzingserver.php 8000 StreamSelect &
sleep 1
wstest -m fuzzingclient -s tests/autobahn/fuzzingclient-quick.json
killall php
profile:
php -d 'xdebug.profiler_enable=1' tests/autobahn/bin/fuzzingserver.php 8000 LibEvent &
sleep 1
wstest -m fuzzingclient -s tests/autobahn/fuzzingclient-profile.json
killall php
apidocs:
apigen --title Ratchet -d reports/api \
-s src/ \
-s vendor/ratchet/rfc6455/src \
-s vendor/react/event-loop/src \
-s vendor/react/socket/src \
-s vendor/react/stream/src \
-s vendor/psr/http-message/src \
-s vendor/symfony/http-foundation/Session \
-s vendor/symfony/routing \
-s vendor/evenement/evenement/src/Evenement \
--exclude=vendor/symfony/routing/Tests \

View file

@ -1,87 +0,0 @@
# Ratchet
[![GitHub Actions][GA Image]][GA Link]
[![Autobahn Testsuite](https://img.shields.io/badge/Autobahn-passing-brightgreen.svg)](http://socketo.me/reports/ab/index.html)
[![Latest Stable Version](https://poser.pugx.org/cboden/ratchet/v/stable.png)](https://packagist.org/packages/cboden/ratchet)
A PHP library for asynchronously serving WebSockets.
Build up your application through simple interfaces and re-use your application without changing any of its code just by combining different components.
## Requirements
Shell access is required and root access is recommended.
To avoid proxy/firewall blockage it's recommended WebSockets are requested on port 80 or 443 (SSL), which requires root access.
In order to do this, along with your sync web stack, you can either use a reverse proxy or two separate machines.
You can find more details in the [server conf docs](http://socketo.me/docs/deploy#server_configuration).
### Documentation
User and API documentation is available on Ratchet's website: http://socketo.me
See https://github.com/cboden/Ratchet-examples for some out-of-the-box working demos using Ratchet.
Need help? Have a question? Want to provide feedback? Write a message on the [Google Groups Mailing List](https://groups.google.com/forum/#!forum/ratchet-php).
---
### A quick example
```php
<?php
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
// Make sure composer dependencies have been installed
require __DIR__ . '/vendor/autoload.php';
/**
* chat.php
* Send any incoming messages to all connected clients (except sender)
*/
class MyChat implements MessageComponentInterface {
protected $clients;
public function __construct() {
$this->clients = new \SplObjectStorage;
}
public function onOpen(ConnectionInterface $conn) {
$this->clients->attach($conn);
}
public function onMessage(ConnectionInterface $from, $msg) {
foreach ($this->clients as $client) {
if ($from != $client) {
$client->send($msg);
}
}
}
public function onClose(ConnectionInterface $conn) {
$this->clients->detach($conn);
}
public function onError(ConnectionInterface $conn, \Exception $e) {
$conn->close();
}
}
// Run the server application through the WebSocket protocol on port 8080
$app = new Ratchet\App('localhost', 8080);
$app->route('/chat', new MyChat, array('*'));
$app->route('/echo', new Ratchet\Server\EchoServer, array('*'));
$app->run();
```
$ php chat.php
```javascript
// Then some JavaScript in the browser:
var conn = new WebSocket('ws://localhost:8080/echo');
conn.onmessage = function(e) { console.log(e.data); };
conn.onopen = function(e) { conn.send('Hello Me!'); };
```
[GA Image]: https://github.com/ratchetphp/Ratchet/workflows/CI/badge.svg
[GA Link]: https://github.com/ratchetphp/Ratchet/actions?query=workflow%3A%22CI%22+branch%3Amaster

View file

@ -1,8 +0,0 @@
# Security Policy
## Reporting a Vulnerability
Please report security issues to:
* Chris Boden [cboden@gmail.com](cboden@gmail.com)
* Matt Bonneau [matt@bonneau.net](matt@bonneau.net)

View file

@ -1,40 +0,0 @@
{
"name": "cboden/ratchet"
, "type": "library"
, "description": "PHP WebSocket library"
, "keywords": ["WebSockets", "Server", "Ratchet", "Sockets", "WebSocket"]
, "homepage": "http://socketo.me"
, "license": "MIT"
, "authors": [
{
"name": "Chris Boden"
, "email": "cboden@gmail.com"
, "role": "Developer"
}
, {
"name": "Matt Bonneau"
, "role": "Developer"
}
]
, "support": {
"issues": "https://github.com/ratchetphp/Ratchet/issues"
, "chat": "https://gitter.im/reactphp/reactphp"
}
, "autoload": {
"psr-4": {
"Ratchet\\": "src/Ratchet"
}
}
, "require": {
"php": ">=5.4.2"
, "ratchet/rfc6455": "^0.3.1"
, "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5"
, "react/event-loop": ">=0.4"
, "guzzlehttp/psr7": "^1.7|^2.0"
, "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0"
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0"
}
, "require-dev": {
"phpunit/phpunit": "~4.8"
}
}

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
forceCoversAnnotation="true"
mapTestClassNameToCoveredClassName="true"
bootstrap="tests/bootstrap.php"
colors="true"
backupGlobals="false"
backupStaticAttributes="false"
syntaxCheck="false"
stopOnError="false"
>
<testsuites>
<testsuite name="unit">
<directory>./tests/unit/</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="integration">
<directory>./tests/integration/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>

View file

@ -1,41 +0,0 @@
<?php
namespace Ratchet;
/**
* Wraps ConnectionInterface objects via the decorator pattern but allows
* parameters to bubble through with magic methods
* @todo It sure would be nice if I could make most of this a trait...
*/
abstract class AbstractConnectionDecorator implements ConnectionInterface {
/**
* @var ConnectionInterface
*/
protected $wrappedConn;
public function __construct(ConnectionInterface $conn) {
$this->wrappedConn = $conn;
}
/**
* @return ConnectionInterface
*/
protected function getConnection() {
return $this->wrappedConn;
}
public function __set($name, $value) {
$this->wrappedConn->$name = $value;
}
public function __get($name) {
return $this->wrappedConn->$name;
}
public function __isset($name) {
return isset($this->wrappedConn->$name);
}
public function __unset($name) {
unset($this->wrappedConn->$name);
}
}

View file

@ -1,147 +0,0 @@
<?php
namespace Ratchet;
use React\EventLoop\LoopInterface;
use React\EventLoop\Factory as LoopFactory;
use React\Socket\Server as Reactor;
use React\Socket\SecureServer as SecureReactor;
use Ratchet\Http\HttpServerInterface;
use Ratchet\Http\OriginCheck;
use Ratchet\Wamp\WampServerInterface;
use Ratchet\Server\IoServer;
use Ratchet\Server\FlashPolicy;
use Ratchet\Http\HttpServer;
use Ratchet\Http\Router;
use Ratchet\WebSocket\MessageComponentInterface as WsMessageComponentInterface;
use Ratchet\WebSocket\WsServer;
use Ratchet\Wamp\WampServer;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Matcher\UrlMatcher;
/**
* An opinionated facade class to quickly and easily create a WebSocket server.
* A few configuration assumptions are made and some best-practice security conventions are applied by default.
*/
class App {
/**
* @var \Symfony\Component\Routing\RouteCollection
*/
public $routes;
/**
* @var \Ratchet\Server\IoServer
*/
public $flashServer;
/**
* @var \Ratchet\Server\IoServer
*/
protected $_server;
/**
* The Host passed in construct used for same origin policy
* @var string
*/
protected $httpHost;
/***
* The port the socket is listening
* @var int
*/
protected $port;
/**
* @var int
*/
protected $_routeCounter = 0;
/**
* @param string $httpHost HTTP hostname clients intend to connect to. MUST match JS `new WebSocket('ws://$httpHost');`
* @param int $port Port to listen on. If 80, assuming production, Flash on 843 otherwise expecting Flash to be proxied through 8843
* @param string $address IP address to bind to. Default is localhost/proxy only. '0.0.0.0' for any machine.
* @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you.
* @param array $context
*/
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null, $context = array()) {
if (extension_loaded('xdebug') && getenv('RATCHET_DISABLE_XDEBUG_WARN') === false) {
trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING);
}
if (null === $loop) {
$loop = LoopFactory::create();
}
$this->httpHost = $httpHost;
$this->port = $port;
$socket = new Reactor($address . ':' . $port, $loop, $context);
$this->routes = new RouteCollection;
$this->_server = new IoServer(new HttpServer(new Router(new UrlMatcher($this->routes, new RequestContext))), $socket, $loop);
$policy = new FlashPolicy;
$policy->addAllowedAccess($httpHost, 80);
$policy->addAllowedAccess($httpHost, $port);
if (80 == $port) {
$flashUri = '0.0.0.0:843';
} else {
$flashUri = 8843;
}
$flashSock = new Reactor($flashUri, $loop);
$this->flashServer = new IoServer($policy, $flashSock);
}
/**
* Add an endpoint/application to the server
* @param string $path The URI the client will connect to
* @param ComponentInterface $controller Your application to server for the route. If not specified, assumed to be for a WebSocket
* @param array $allowedOrigins An array of hosts allowed to connect (same host by default), ['*'] for any
* @param string $httpHost Override the $httpHost variable provided in the __construct
* @return ComponentInterface|WsServer
*/
public function route($path, ComponentInterface $controller, array $allowedOrigins = array(), $httpHost = null) {
if ($controller instanceof HttpServerInterface || $controller instanceof WsServer) {
$decorated = $controller;
} elseif ($controller instanceof WampServerInterface) {
$decorated = new WsServer(new WampServer($controller));
$decorated->enableKeepAlive($this->_server->loop);
} elseif ($controller instanceof MessageComponentInterface || $controller instanceof WsMessageComponentInterface) {
$decorated = new WsServer($controller);
$decorated->enableKeepAlive($this->_server->loop);
} else {
$decorated = $controller;
}
if ($httpHost === null) {
$httpHost = $this->httpHost;
}
$allowedOrigins = array_values($allowedOrigins);
if (0 === count($allowedOrigins)) {
$allowedOrigins[] = $httpHost;
}
if ('*' !== $allowedOrigins[0]) {
$decorated = new OriginCheck($decorated, $allowedOrigins);
}
//allow origins in flash policy server
if(empty($this->flashServer) === false) {
foreach($allowedOrigins as $allowedOrgin) {
$this->flashServer->app->addAllowedAccess($allowedOrgin, $this->port);
}
}
$this->routes->add('rr-' . ++$this->_routeCounter, new Route($path, array('_controller' => $decorated), array('Origin' => $this->httpHost), array(), $httpHost, array(), array('GET')));
return $decorated;
}
/**
* Run the server by entering the event loop
*/
public function run() {
$this->_server->run();
}
}

View file

@ -1,31 +0,0 @@
<?php
namespace Ratchet;
/**
* This is the interface to build a Ratchet application with.
* It implements the decorator pattern to build an application stack
*/
interface ComponentInterface {
/**
* When a new connection is opened it will be passed to this method
* @param ConnectionInterface $conn The socket/connection that just connected to your application
* @throws \Exception
*/
function onOpen(ConnectionInterface $conn);
/**
* This is called before or after a socket is closed (depends on how it's closed). SendMessage to $conn will not result in an error if it has already been closed.
* @param ConnectionInterface $conn The socket/connection that is closing/closed
* @throws \Exception
*/
function onClose(ConnectionInterface $conn);
/**
* If there is an error with one of the sockets, or somewhere in the application where an Exception is thrown,
* the Exception is sent back down the stack, handled by the Server and bubbled back up the application through this method
* @param ConnectionInterface $conn
* @param \Exception $e
* @throws \Exception
*/
function onError(ConnectionInterface $conn, \Exception $e);
}

View file

@ -1,26 +0,0 @@
<?php
namespace Ratchet;
/**
* The version of Ratchet being used
* @var string
*/
const VERSION = 'Ratchet/0.4.4';
/**
* A proxy object representing a connection to the application
* This acts as a container to store data (in memory) about the connection
*/
interface ConnectionInterface {
/**
* Send data to the connection
* @param string $data
* @return \Ratchet\ConnectionInterface
*/
function send($data);
/**
* Close the connection
*/
function close();
}

View file

@ -1,22 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\ConnectionInterface;
use GuzzleHttp\Psr7\Message;
use GuzzleHttp\Psr7\Response;
trait CloseResponseTrait {
/**
* Close a connection with an HTTP response
* @param \Ratchet\ConnectionInterface $conn
* @param int $code HTTP status code
* @return null
*/
private function close(ConnectionInterface $conn, $code = 400, array $additional_headers = []) {
$response = new Response($code, array_merge([
'X-Powered-By' => \Ratchet\VERSION
], $additional_headers));
$conn->send(Message::toString($response));
$conn->close();
}
}

View file

@ -1,64 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\MessageInterface;
use Ratchet\ConnectionInterface;
use GuzzleHttp\Psr7\Message;
/**
* This class receives streaming data from a client request
* and parses HTTP headers, returning a PSR-7 Request object
* once it's been buffered
*/
class HttpRequestParser implements MessageInterface {
const EOM = "\r\n\r\n";
/**
* The maximum number of bytes the request can be
* This is a security measure to prevent attacks
* @var int
*/
public $maxSize = 4096;
/**
* @param \Ratchet\ConnectionInterface $context
* @param string $data Data stream to buffer
* @return \Psr\Http\Message\RequestInterface
* @throws \OverflowException If the message buffer has become too large
*/
public function onMessage(ConnectionInterface $context, $data) {
if (!isset($context->httpBuffer)) {
$context->httpBuffer = '';
}
$context->httpBuffer .= $data;
if (strlen($context->httpBuffer) > (int)$this->maxSize) {
throw new \OverflowException("Maximum buffer size of {$this->maxSize} exceeded parsing HTTP header");
}
if ($this->isEom($context->httpBuffer)) {
$request = $this->parse($context->httpBuffer);
unset($context->httpBuffer);
return $request;
}
}
/**
* Determine if the message has been buffered as per the HTTP specification
* @param string $message
* @return boolean
*/
public function isEom($message) {
return (boolean)strpos($message, static::EOM);
}
/**
* @param string $headers
* @return \Psr\Http\Message\RequestInterface
*/
public function parse($headers) {
return Message::parseRequest($headers);
}
}

View file

@ -1,76 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
class HttpServer implements MessageComponentInterface {
use CloseResponseTrait;
/**
* Buffers incoming HTTP requests returning a Guzzle Request when coalesced
* @var HttpRequestParser
* @note May not expose this in the future, may do through facade methods
*/
protected $_reqParser;
/**
* @var \Ratchet\Http\HttpServerInterface
*/
protected $_httpServer;
/**
* @param HttpServerInterface
*/
public function __construct(HttpServerInterface $component) {
$this->_httpServer = $component;
$this->_reqParser = new HttpRequestParser;
}
/**
* {@inheritdoc}
*/
public function onOpen(ConnectionInterface $conn) {
$conn->httpHeadersReceived = false;
}
/**
* {@inheritdoc}
*/
public function onMessage(ConnectionInterface $from, $msg) {
if (true !== $from->httpHeadersReceived) {
try {
if (null === ($request = $this->_reqParser->onMessage($from, $msg))) {
return;
}
} catch (\OverflowException $oe) {
return $this->close($from, 413);
}
$from->httpHeadersReceived = true;
return $this->_httpServer->onOpen($from, $request);
}
$this->_httpServer->onMessage($from, $msg);
}
/**
* {@inheritdoc}
*/
public function onClose(ConnectionInterface $conn) {
if ($conn->httpHeadersReceived) {
$this->_httpServer->onClose($conn);
}
}
/**
* {@inheritdoc}
*/
public function onError(ConnectionInterface $conn, \Exception $e) {
if ($conn->httpHeadersReceived) {
$this->_httpServer->onError($conn, $e);
} else {
$this->close($conn, 500);
}
}
}

View file

@ -1,14 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
use Psr\Http\Message\RequestInterface;
interface HttpServerInterface extends MessageComponentInterface {
/**
* @param \Ratchet\ConnectionInterface $conn
* @param \Psr\Http\Message\RequestInterface $request null is default because PHP won't let me overload; don't pass null!!!
* @throws \UnexpectedValueException if a RequestInterface is not passed
*/
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null);
}

View file

@ -1,18 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\ConnectionInterface;
use Psr\Http\Message\RequestInterface;
class NoOpHttpServerController implements HttpServerInterface {
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
}
public function onMessage(ConnectionInterface $from, $msg) {
}
public function onClose(ConnectionInterface $conn) {
}
public function onError(ConnectionInterface $conn, \Exception $e) {
}
}

View file

@ -1,65 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\ConnectionInterface;
use Ratchet\MessageComponentInterface;
use Psr\Http\Message\RequestInterface;
/**
* A middleware to ensure JavaScript clients connecting are from the expected domain.
* This protects other websites from open WebSocket connections to your application.
* Note: This can be spoofed from non-web browser clients
*/
class OriginCheck implements HttpServerInterface {
use CloseResponseTrait;
/**
* @var \Ratchet\MessageComponentInterface
*/
protected $_component;
public $allowedOrigins = [];
/**
* @param MessageComponentInterface $component Component/Application to decorate
* @param array $allowed An array of allowed domains that are allowed to connect from
*/
public function __construct(MessageComponentInterface $component, array $allowed = []) {
$this->_component = $component;
$this->allowedOrigins += $allowed;
}
/**
* {@inheritdoc}
*/
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
$header = (string)$request->getHeader('Origin')[0];
$origin = parse_url($header, PHP_URL_HOST) ?: $header;
if (!in_array($origin, $this->allowedOrigins)) {
return $this->close($conn, 403);
}
return $this->_component->onOpen($conn, $request);
}
/**
* {@inheritdoc}
*/
function onMessage(ConnectionInterface $from, $msg) {
return $this->_component->onMessage($from, $msg);
}
/**
* {@inheritdoc}
*/
function onClose(ConnectionInterface $conn) {
return $this->_component->onClose($conn);
}
/**
* {@inheritdoc}
*/
function onError(ConnectionInterface $conn, \Exception $e) {
return $this->_component->onError($conn, $e);
}
}

View file

@ -1,96 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\ConnectionInterface;
use Psr\Http\Message\RequestInterface;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use GuzzleHttp\Psr7\Query;
class Router implements HttpServerInterface {
use CloseResponseTrait;
/**
* @var \Symfony\Component\Routing\Matcher\UrlMatcherInterface
*/
protected $_matcher;
private $_noopController;
public function __construct(UrlMatcherInterface $matcher) {
$this->_matcher = $matcher;
$this->_noopController = new NoOpHttpServerController;
}
/**
* {@inheritdoc}
* @throws \UnexpectedValueException If a controller is not \Ratchet\Http\HttpServerInterface
*/
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
if (null === $request) {
throw new \UnexpectedValueException('$request can not be null');
}
$conn->controller = $this->_noopController;
$uri = $request->getUri();
$context = $this->_matcher->getContext();
$context->setMethod($request->getMethod());
$context->setHost($uri->getHost());
try {
$route = $this->_matcher->match($uri->getPath());
} catch (MethodNotAllowedException $nae) {
return $this->close($conn, 405, array('Allow' => $nae->getAllowedMethods()));
} catch (ResourceNotFoundException $nfe) {
return $this->close($conn, 404);
}
if (is_string($route['_controller']) && class_exists($route['_controller'])) {
$route['_controller'] = new $route['_controller'];
}
if (!($route['_controller'] instanceof HttpServerInterface)) {
throw new \UnexpectedValueException('All routes must implement Ratchet\Http\HttpServerInterface');
}
$parameters = [];
foreach($route as $key => $value) {
if ((is_string($key)) && ('_' !== substr($key, 0, 1))) {
$parameters[$key] = $value;
}
}
$parameters = array_merge($parameters, Query::parse($uri->getQuery() ?: ''));
$request = $request->withUri($uri->withQuery(Query::build($parameters)));
$conn->controller = $route['_controller'];
$conn->controller->onOpen($conn, $request);
}
/**
* {@inheritdoc}
*/
public function onMessage(ConnectionInterface $from, $msg) {
$from->controller->onMessage($from, $msg);
}
/**
* {@inheritdoc}
*/
public function onClose(ConnectionInterface $conn) {
if (isset($conn->controller)) {
$conn->controller->onClose($conn);
}
}
/**
* {@inheritdoc}
*/
public function onError(ConnectionInterface $conn, \Exception $e) {
if (isset($conn->controller)) {
$conn->controller->onError($conn, $e);
}
}
}

View file

@ -1,5 +0,0 @@
<?php
namespace Ratchet;
interface MessageComponentInterface extends ComponentInterface, MessageInterface {
}

View file

@ -1,12 +0,0 @@
<?php
namespace Ratchet;
interface MessageInterface {
/**
* Triggered when a client sends data through the socket
* @param \Ratchet\ConnectionInterface $from The socket/connection that sent the message to your application
* @param string $msg The message received
* @throws \Exception
*/
function onMessage(ConnectionInterface $from, $msg);
}

View file

@ -1,23 +0,0 @@
<?php
namespace Ratchet\Server;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
/**
* A simple Ratchet application that will reply to all messages with the message it received
*/
class EchoServer implements MessageComponentInterface {
public function onOpen(ConnectionInterface $conn) {
}
public function onMessage(ConnectionInterface $from, $msg) {
$from->send($msg);
}
public function onClose(ConnectionInterface $conn) {
}
public function onError(ConnectionInterface $conn, \Exception $e) {
$conn->close();
}
}

View file

@ -1,200 +0,0 @@
<?php
namespace Ratchet\Server;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
/**
* An app to go on a server stack to pass a policy file to a Flash socket
* Useful if you're using Flash as a WebSocket polyfill on IE
* Be sure to run your server instance on port 843
* By default this lets accepts everything, make sure you tighten the rules up for production
* @final
* @link http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html
* @link http://learn.adobe.com/wiki/download/attachments/64389123/CrossDomain_PolicyFile_Specification.pdf?version=1
* @link view-source:http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd
*/
class FlashPolicy implements MessageComponentInterface {
/**
* Contains the root policy node
* @var string
*/
protected $_policy = '<?xml version="1.0"?><!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"><cross-domain-policy></cross-domain-policy>';
/**
* Stores an array of allowed domains and their ports
* @var array
*/
protected $_access = array();
/**
* @var string
*/
protected $_siteControl = '';
/**
* @var string
*/
protected $_cache = '';
/**
* @var string
*/
protected $_cacheValid = false;
/**
* Add a domain to an allowed access list.
*
* @param string $domain Specifies a requesting domain to be granted access. Both named domains and IP
* addresses are acceptable values. Subdomains are considered different domains. A wildcard (*) can
* be used to match all domains when used alone, or multiple domains (subdomains) when used as a
* prefix for an explicit, second-level domain name separated with a dot (.)
* @param string $ports A comma-separated list of ports or range of ports that a socket connection
* is allowed to connect to. A range of ports is specified through a dash (-) between two port numbers.
* Ranges can be used with individual ports when separated with a comma. A single wildcard (*) can
* be used to allow all ports.
* @param bool $secure
* @throws \UnexpectedValueException
* @return FlashPolicy
*/
public function addAllowedAccess($domain, $ports = '*', $secure = false) {
if (!$this->validateDomain($domain)) {
throw new \UnexpectedValueException('Invalid domain');
}
if (!$this->validatePorts($ports)) {
throw new \UnexpectedValueException('Invalid Port');
}
$this->_access[] = array($domain, $ports, (boolean)$secure);
$this->_cacheValid = false;
return $this;
}
/**
* Removes all domains from the allowed access list.
*
* @return \Ratchet\Server\FlashPolicy
*/
public function clearAllowedAccess() {
$this->_access = array();
$this->_cacheValid = false;
return $this;
}
/**
* site-control defines the meta-policy for the current domain. A meta-policy specifies acceptable
* domain policy files other than the master policy file located in the target domain's root and named
* crossdomain.xml.
*
* @param string $permittedCrossDomainPolicies
* @throws \UnexpectedValueException
* @return FlashPolicy
*/
public function setSiteControl($permittedCrossDomainPolicies = 'all') {
if (!$this->validateSiteControl($permittedCrossDomainPolicies)) {
throw new \UnexpectedValueException('Invalid site control set');
}
$this->_siteControl = $permittedCrossDomainPolicies;
$this->_cacheValid = false;
return $this;
}
/**
* {@inheritdoc}
*/
public function onOpen(ConnectionInterface $conn) {
}
/**
* {@inheritdoc}
*/
public function onMessage(ConnectionInterface $from, $msg) {
if (!$this->_cacheValid) {
$this->_cache = $this->renderPolicy()->asXML();
$this->_cacheValid = true;
}
$from->send($this->_cache . "\0");
$from->close();
}
/**
* {@inheritdoc}
*/
public function onClose(ConnectionInterface $conn) {
}
/**
* {@inheritdoc}
*/
public function onError(ConnectionInterface $conn, \Exception $e) {
$conn->close();
}
/**
* Builds the crossdomain file based on the template policy
*
* @throws \UnexpectedValueException
* @return \SimpleXMLElement
*/
public function renderPolicy() {
$policy = new \SimpleXMLElement($this->_policy);
$siteControl = $policy->addChild('site-control');
if ($this->_siteControl == '') {
$this->setSiteControl();
}
$siteControl->addAttribute('permitted-cross-domain-policies', $this->_siteControl);
if (empty($this->_access)) {
throw new \UnexpectedValueException('You must add a domain through addAllowedAccess()');
}
foreach ($this->_access as $access) {
$tmp = $policy->addChild('allow-access-from');
$tmp->addAttribute('domain', $access[0]);
$tmp->addAttribute('to-ports', $access[1]);
$tmp->addAttribute('secure', ($access[2] === true) ? 'true' : 'false');
}
return $policy;
}
/**
* Make sure the proper site control was passed
*
* @param string $permittedCrossDomainPolicies
* @return bool
*/
public function validateSiteControl($permittedCrossDomainPolicies) {
//'by-content-type' and 'by-ftp-filename' are not available for sockets
return (bool)in_array($permittedCrossDomainPolicies, array('none', 'master-only', 'all'));
}
/**
* Validate for proper domains (wildcards allowed)
*
* @param string $domain
* @return bool
*/
public function validateDomain($domain) {
return (bool)preg_match("/^((http(s)?:\/\/)?([a-z0-9-_]+\.|\*\.)*([a-z0-9-_\.]+)|\*)$/i", $domain);
}
/**
* Make sure valid ports were passed
*
* @param string $port
* @return bool
*/
public function validatePorts($port) {
return (bool)preg_match('/^(\*|(\d+[,-]?)*\d+)$/', $port);
}
}

View file

@ -1,38 +0,0 @@
<?php
namespace Ratchet\Server;
use Ratchet\ConnectionInterface;
use React\Socket\ConnectionInterface as ReactConn;
/**
* {@inheritdoc}
*/
class IoConnection implements ConnectionInterface {
/**
* @var \React\Socket\ConnectionInterface
*/
protected $conn;
/**
* @param \React\Socket\ConnectionInterface $conn
*/
public function __construct(ReactConn $conn) {
$this->conn = $conn;
}
/**
* {@inheritdoc}
*/
public function send($data) {
$this->conn->write($data);
return $this;
}
/**
* {@inheritdoc}
*/
public function close() {
$this->conn->end();
}
}

View file

@ -1,140 +0,0 @@
<?php
namespace Ratchet\Server;
use Ratchet\MessageComponentInterface;
use React\EventLoop\LoopInterface;
use React\Socket\ServerInterface;
use React\EventLoop\Factory as LoopFactory;
use React\Socket\Server as Reactor;
use React\Socket\SecureServer as SecureReactor;
/**
* Creates an open-ended socket to listen on a port for incoming connections.
* Events are delegated through this to attached applications
*/
class IoServer {
/**
* @var \React\EventLoop\LoopInterface
*/
public $loop;
/**
* @var \Ratchet\MessageComponentInterface
*/
public $app;
/**
* The socket server the Ratchet Application is run off of
* @var \React\Socket\ServerInterface
*/
public $socket;
/**
* @param \Ratchet\MessageComponentInterface $app The Ratchet application stack to host
* @param \React\Socket\ServerInterface $socket The React socket server to run the Ratchet application off of
* @param \React\EventLoop\LoopInterface|null $loop The React looper to run the Ratchet application off of
*/
public function __construct(MessageComponentInterface $app, ServerInterface $socket, LoopInterface $loop = null) {
if (false === strpos(PHP_VERSION, "hiphop")) {
gc_enable();
}
set_time_limit(0);
ob_implicit_flush();
$this->loop = $loop;
$this->app = $app;
$this->socket = $socket;
$socket->on('connection', array($this, 'handleConnect'));
}
/**
* @param \Ratchet\MessageComponentInterface $component The application that I/O will call when events are received
* @param int $port The port to server sockets on
* @param string $address The address to receive sockets on (0.0.0.0 means receive connections from any)
* @return IoServer
*/
public static function factory(MessageComponentInterface $component, $port = 80, $address = '0.0.0.0') {
$loop = LoopFactory::create();
$socket = new Reactor($address . ':' . $port, $loop);
return new static($component, $socket, $loop);
}
/**
* Run the application by entering the event loop
* @throws \RuntimeException If a loop was not previously specified
*/
public function run() {
if (null === $this->loop) {
throw new \RuntimeException("A React Loop was not provided during instantiation");
}
// @codeCoverageIgnoreStart
$this->loop->run();
// @codeCoverageIgnoreEnd
}
/**
* Triggered when a new connection is received from React
* @param \React\Socket\ConnectionInterface $conn
*/
public function handleConnect($conn) {
$conn->decor = new IoConnection($conn);
$conn->decor->resourceId = (int)$conn->stream;
$uri = $conn->getRemoteAddress();
$conn->decor->remoteAddress = trim(
parse_url((strpos($uri, '://') === false ? 'tcp://' : '') . $uri, PHP_URL_HOST),
'[]'
);
$this->app->onOpen($conn->decor);
$conn->on('data', function ($data) use ($conn) {
$this->handleData($data, $conn);
});
$conn->on('close', function () use ($conn) {
$this->handleEnd($conn);
});
$conn->on('error', function (\Exception $e) use ($conn) {
$this->handleError($e, $conn);
});
}
/**
* Data has been received from React
* @param string $data
* @param \React\Socket\ConnectionInterface $conn
*/
public function handleData($data, $conn) {
try {
$this->app->onMessage($conn->decor, $data);
} catch (\Exception $e) {
$this->handleError($e, $conn);
}
}
/**
* A connection has been closed by React
* @param \React\Socket\ConnectionInterface $conn
*/
public function handleEnd($conn) {
try {
$this->app->onClose($conn->decor);
} catch (\Exception $e) {
$this->handleError($e, $conn);
}
unset($conn->decor);
}
/**
* An error has occurred, let the listening application know
* @param \Exception $e
* @param \React\Socket\ConnectionInterface $conn
*/
public function handleError(\Exception $e, $conn) {
$this->app->onError($conn->decor, $e);
}
}

View file

@ -1,111 +0,0 @@
<?php
namespace Ratchet\Server;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
class IpBlackList implements MessageComponentInterface {
/**
* @var array
*/
protected $_blacklist = array();
/**
* @var \Ratchet\MessageComponentInterface
*/
protected $_decorating;
/**
* @param \Ratchet\MessageComponentInterface $component
*/
public function __construct(MessageComponentInterface $component) {
$this->_decorating = $component;
}
/**
* Add an address to the blacklist that will not be allowed to connect to your application
* @param string $ip IP address to block from connecting to your application
* @return IpBlackList
*/
public function blockAddress($ip) {
$this->_blacklist[$ip] = true;
return $this;
}
/**
* Unblock an address so they can access your application again
* @param string $ip IP address to unblock from connecting to your application
* @return IpBlackList
*/
public function unblockAddress($ip) {
if (isset($this->_blacklist[$this->filterAddress($ip)])) {
unset($this->_blacklist[$this->filterAddress($ip)]);
}
return $this;
}
/**
* @param string $address
* @return bool
*/
public function isBlocked($address) {
return (isset($this->_blacklist[$this->filterAddress($address)]));
}
/**
* Get an array of all the addresses blocked
* @return array
*/
public function getBlockedAddresses() {
return array_keys($this->_blacklist);
}
/**
* @param string $address
* @return string
*/
public function filterAddress($address) {
if (strstr($address, ':') && substr_count($address, '.') == 3) {
list($address, $port) = explode(':', $address);
}
return $address;
}
/**
* {@inheritdoc}
*/
function onOpen(ConnectionInterface $conn) {
if ($this->isBlocked($conn->remoteAddress)) {
return $conn->close();
}
return $this->_decorating->onOpen($conn);
}
/**
* {@inheritdoc}
*/
function onMessage(ConnectionInterface $from, $msg) {
return $this->_decorating->onMessage($from, $msg);
}
/**
* {@inheritdoc}
*/
function onClose(ConnectionInterface $conn) {
if (!$this->isBlocked($conn->remoteAddress)) {
$this->_decorating->onClose($conn);
}
}
/**
* {@inheritdoc}
*/
function onError(ConnectionInterface $conn, \Exception $e) {
if (!$this->isBlocked($conn->remoteAddress)) {
$this->_decorating->onError($conn, $e);
}
}
}

View file

@ -1,16 +0,0 @@
<?php
namespace Ratchet\Session\Serialize;
interface HandlerInterface {
/**
* @param array
* @return string
*/
function serialize(array $data);
/**
* @param string
* @return array
*/
function unserialize($raw);
}

View file

@ -1,33 +0,0 @@
<?php
namespace Ratchet\Session\Serialize;
class PhpBinaryHandler implements HandlerInterface {
/**
* {@inheritdoc}
*/
function serialize(array $data) {
throw new \RuntimeException("Serialize PhpHandler:serialize code not written yet, write me!");
}
/**
* {@inheritdoc}
* @link http://ca2.php.net/manual/en/function.session-decode.php#108037 Code from this comment on php.net
*/
public function unserialize($raw) {
$returnData = array();
$offset = 0;
while ($offset < strlen($raw)) {
$num = ord($raw[$offset]);
$offset += 1;
$varname = substr($raw, $offset, $num);
$offset += $num;
$data = unserialize(substr($raw, $offset));
$returnData[$varname] = $data;
$offset += strlen(serialize($data));
}
return $returnData;
}
}

View file

@ -1,49 +0,0 @@
<?php
namespace Ratchet\Session\Serialize;
class PhpHandler implements HandlerInterface {
/**
* Simply reverse behaviour of unserialize method.
* {@inheritdoc}
*/
function serialize(array $data) {
$preSerialized = array();
$serialized = '';
if (count($data)) {
foreach ($data as $bucket => $bucketData) {
$preSerialized[] = $bucket . '|' . serialize($bucketData);
}
$serialized = implode('', $preSerialized);
}
return $serialized;
}
/**
* {@inheritdoc}
* @link http://ca2.php.net/manual/en/function.session-decode.php#108037 Code from this comment on php.net
* @throws \UnexpectedValueException If there is a problem parsing the data
*/
public function unserialize($raw) {
$returnData = array();
$offset = 0;
while ($offset < strlen($raw)) {
if (!strstr(substr($raw, $offset), "|")) {
throw new \UnexpectedValueException("invalid data, remaining: " . substr($raw, $offset));
}
$pos = strpos($raw, "|", $offset);
$num = $pos - $offset;
$varname = substr($raw, $offset, $num);
$offset += $num + 1;
$data = unserialize(substr($raw, $offset));
$returnData[$varname] = $data;
$offset += strlen(serialize($data));
}
return $returnData;
}
}

View file

@ -1,243 +0,0 @@
<?php
namespace Ratchet\Session;
use Ratchet\ConnectionInterface;
use Ratchet\Http\HttpServerInterface;
use Psr\Http\Message\RequestInterface;
use Ratchet\Session\Storage\VirtualSessionStorage;
use Ratchet\Session\Serialize\HandlerInterface;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
/**
* This component will allow access to session data from your website for each user connected
* Symfony HttpFoundation is required for this component to work
* Your website must also use Symfony HttpFoundation Sessions to read your sites session data
* If your are not using at least PHP 5.4 you must include a SessionHandlerInterface stub (is included in Symfony HttpFoundation, loaded w/ composer)
*/
class SessionProvider implements HttpServerInterface {
/**
* @var \Ratchet\MessageComponentInterface
*/
protected $_app;
/**
* Selected handler storage assigned by the developer
* @var \SessionHandlerInterface
*/
protected $_handler;
/**
* Null storage handler if no previous session was found
* @var \SessionHandlerInterface
*/
protected $_null;
/**
* @var \Ratchet\Session\Serialize\HandlerInterface
*/
protected $_serializer;
/**
* @param \Ratchet\Http\HttpServerInterface $app
* @param \SessionHandlerInterface $handler
* @param array $options
* @param \Ratchet\Session\Serialize\HandlerInterface $serializer
* @throws \RuntimeException
*/
public function __construct(HttpServerInterface $app, \SessionHandlerInterface $handler, array $options = array(), HandlerInterface $serializer = null) {
$this->_app = $app;
$this->_handler = $handler;
$this->_null = new NullSessionHandler;
ini_set('session.auto_start', 0);
ini_set('session.cache_limiter', '');
ini_set('session.use_cookies', 0);
$this->setOptions($options);
if (null === $serializer) {
$serialClass = __NAMESPACE__ . "\\Serialize\\{$this->toClassCase(ini_get('session.serialize_handler'))}Handler"; // awesome/terrible hack, eh?
if (!class_exists($serialClass)) {
throw new \RuntimeException('Unable to parse session serialize handler');
}
$serializer = new $serialClass;
}
$this->_serializer = $serializer;
}
/**
* {@inheritdoc}
*/
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
$sessionName = ini_get('session.name');
$id = array_reduce($request->getHeader('Cookie'), function($accumulator, $cookie) use ($sessionName) {
if ($accumulator) {
return $accumulator;
}
$crumbs = $this->parseCookie($cookie);
return isset($crumbs['cookies'][$sessionName]) ? $crumbs['cookies'][$sessionName] : false;
}, false);
if (null === $request || false === $id) {
$saveHandler = $this->_null;
$id = '';
} else {
$saveHandler = $this->_handler;
}
$conn->Session = new Session(new VirtualSessionStorage($saveHandler, $id, $this->_serializer));
if (ini_get('session.auto_start')) {
$conn->Session->start();
}
return $this->_app->onOpen($conn, $request);
}
/**
* {@inheritdoc}
*/
function onMessage(ConnectionInterface $from, $msg) {
return $this->_app->onMessage($from, $msg);
}
/**
* {@inheritdoc}
*/
function onClose(ConnectionInterface $conn) {
// "close" session for Connection
return $this->_app->onClose($conn);
}
/**
* {@inheritdoc}
*/
function onError(ConnectionInterface $conn, \Exception $e) {
return $this->_app->onError($conn, $e);
}
/**
* Set all the php session. ini options
* © Symfony
* @param array $options
* @return array
*/
protected function setOptions(array $options) {
$all = array(
'auto_start', 'cache_limiter', 'cookie_domain', 'cookie_httponly',
'cookie_lifetime', 'cookie_path', 'cookie_secure',
'entropy_file', 'entropy_length', 'gc_divisor',
'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character',
'hash_function', 'name', 'referer_check',
'serialize_handler', 'use_cookies',
'use_only_cookies', 'use_trans_sid', 'upload_progress.enabled',
'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name',
'upload_progress.freq', 'upload_progress.min-freq', 'url_rewriter.tags'
);
foreach ($all as $key) {
if (!array_key_exists($key, $options)) {
$options[$key] = ini_get("session.{$key}");
} else {
ini_set("session.{$key}", $options[$key]);
}
}
return $options;
}
/**
* @param string $langDef Input to convert
* @return string
*/
protected function toClassCase($langDef) {
return str_replace(' ', '', ucwords(str_replace('_', ' ', $langDef)));
}
/**
* Taken from Guzzle3
*/
private static $cookieParts = array(
'domain' => 'Domain',
'path' => 'Path',
'max_age' => 'Max-Age',
'expires' => 'Expires',
'version' => 'Version',
'secure' => 'Secure',
'port' => 'Port',
'discard' => 'Discard',
'comment' => 'Comment',
'comment_url' => 'Comment-Url',
'http_only' => 'HttpOnly'
);
/**
* Taken from Guzzle3
*/
private function parseCookie($cookie, $host = null, $path = null, $decode = false) {
// Explode the cookie string using a series of semicolons
$pieces = array_filter(array_map('trim', explode(';', $cookie)));
// The name of the cookie (first kvp) must include an equal sign.
if (empty($pieces) || !strpos($pieces[0], '=')) {
return false;
}
// Create the default return array
$data = array_merge(array_fill_keys(array_keys(self::$cookieParts), null), array(
'cookies' => array(),
'data' => array(),
'path' => $path ?: '/',
'http_only' => false,
'discard' => false,
'domain' => $host
));
$foundNonCookies = 0;
// Add the cookie pieces into the parsed data array
foreach ($pieces as $part) {
$cookieParts = explode('=', $part, 2);
$key = trim($cookieParts[0]);
if (count($cookieParts) == 1) {
// Can be a single value (e.g. secure, httpOnly)
$value = true;
} else {
// Be sure to strip wrapping quotes
$value = trim($cookieParts[1], " \n\r\t\0\x0B\"");
if ($decode) {
$value = urldecode($value);
}
}
// Only check for non-cookies when cookies have been found
if (!empty($data['cookies'])) {
foreach (self::$cookieParts as $mapValue => $search) {
if (!strcasecmp($search, $key)) {
$data[$mapValue] = $mapValue == 'port' ? array_map('trim', explode(',', $value)) : $value;
$foundNonCookies++;
continue 2;
}
}
}
// If cookies have not yet been retrieved, or this value was not found in the pieces array, treat it as a
// cookie. IF non-cookies have been parsed, then this isn't a cookie, it's cookie data. Cookies then data.
$data[$foundNonCookies ? 'data' : 'cookies'][$key] = $value;
}
// Calculate the expires date
if (!$data['expires'] && $data['max_age']) {
$data['expires'] = time() + (int) $data['max_age'];
}
return $data;
}
}

View file

@ -1,54 +0,0 @@
<?php
namespace Ratchet\Session\Storage\Proxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
class VirtualProxy extends SessionHandlerProxy {
/**
* @var string
*/
protected $_sessionId;
/**
* @var string
*/
protected $_sessionName;
/**
* {@inheritdoc}
*/
public function __construct(\SessionHandlerInterface $handler) {
parent::__construct($handler);
$this->saveHandlerName = 'user';
$this->_sessionName = ini_get('session.name');
}
/**
* {@inheritdoc}
*/
public function getId() {
return $this->_sessionId;
}
/**
* {@inheritdoc}
*/
public function setId($id) {
$this->_sessionId = $id;
}
/**
* {@inheritdoc}
*/
public function getName() {
return $this->_sessionName;
}
/**
* DO NOT CALL THIS METHOD
* @internal
*/
public function setName($name) {
throw new \RuntimeException("Can not change session name in VirtualProxy");
}
}

View file

@ -1,88 +0,0 @@
<?php
namespace Ratchet\Session\Storage;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use Ratchet\Session\Storage\Proxy\VirtualProxy;
use Ratchet\Session\Serialize\HandlerInterface;
class VirtualSessionStorage extends NativeSessionStorage {
/**
* @var \Ratchet\Session\Serialize\HandlerInterface
*/
protected $_serializer;
/**
* @param \SessionHandlerInterface $handler
* @param string $sessionId The ID of the session to retrieve
* @param \Ratchet\Session\Serialize\HandlerInterface $serializer
*/
public function __construct(\SessionHandlerInterface $handler, $sessionId, HandlerInterface $serializer) {
$this->setSaveHandler($handler);
$this->saveHandler->setId($sessionId);
$this->_serializer = $serializer;
$this->setMetadataBag(null);
}
/**
* {@inheritdoc}
*/
public function start() {
if ($this->started && !$this->closed) {
return true;
}
// You have to call Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::open() to use
// pdo_sqlite (and possible pdo_*) as session storage, if you are using a DSN string instead of a \PDO object
// in the constructor. The method arguments are filled with the values, which are also used by the symfony
// framework in this case. This must not be the best choice, but it works.
$this->saveHandler->open(session_save_path(), session_name());
$rawData = $this->saveHandler->read($this->saveHandler->getId());
$sessionData = $this->_serializer->unserialize($rawData);
$this->loadSession($sessionData);
if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) {
$this->saveHandler->setActive(false);
}
return true;
}
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null) {
// .. ?
}
/**
* {@inheritdoc}
*/
public function save() {
// get the data from the bags?
// serialize the data
// save the data using the saveHandler
// $this->saveHandler->write($this->saveHandler->getId(),
if (!$this->saveHandler->isWrapper() && !$this->getSaveHandler()->isSessionHandlerInterface()) {
$this->saveHandler->setActive(false);
}
$this->closed = true;
}
/**
* {@inheritdoc}
*/
public function setSaveHandler($saveHandler = null) {
if (!($saveHandler instanceof \SessionHandlerInterface)) {
throw new \InvalidArgumentException('Handler must be instance of SessionHandlerInterface');
}
if (!($saveHandler instanceof VirtualProxy)) {
$saveHandler = new VirtualProxy($saveHandler);
}
$this->saveHandler = $saveHandler;
}
}

View file

@ -1,5 +0,0 @@
<?php
namespace Ratchet\Wamp;
class Exception extends \Exception {
}

View file

@ -1,31 +0,0 @@
<?php
namespace Ratchet\Wamp;
class JsonException extends Exception {
public function __construct() {
$code = json_last_error();
switch ($code) {
case JSON_ERROR_DEPTH:
$msg = 'Maximum stack depth exceeded';
break;
case JSON_ERROR_STATE_MISMATCH:
$msg = 'Underflow or the modes mismatch';
break;
case JSON_ERROR_CTRL_CHAR:
$msg = 'Unexpected control character found';
break;
case JSON_ERROR_SYNTAX:
$msg = 'Syntax error, malformed JSON';
break;
case JSON_ERROR_UTF8:
$msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
break;
default:
$msg = 'Unknown error';
break;
}
parent::__construct($msg, $code);
}
}

View file

@ -1,161 +0,0 @@
<?php
namespace Ratchet\Wamp;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\ConnectionInterface;
/**
* WebSocket Application Messaging Protocol
*
* @link http://wamp.ws/spec
* @link https://github.com/oberstet/autobahn-js
*
* +--------------+----+------------------+
* | Message Type | ID | DIRECTION |
* |--------------+----+------------------+
* | WELCOME | 0 | Server-to-Client |
* | PREFIX | 1 | Bi-Directional |
* | CALL | 2 | Client-to-Server |
* | CALL RESULT | 3 | Server-to-Client |
* | CALL ERROR | 4 | Server-to-Client |
* | SUBSCRIBE | 5 | Client-to-Server |
* | UNSUBSCRIBE | 6 | Client-to-Server |
* | PUBLISH | 7 | Client-to-Server |
* | EVENT | 8 | Server-to-Client |
* +--------------+----+------------------+
*/
class ServerProtocol implements MessageComponentInterface, WsServerInterface {
const MSG_WELCOME = 0;
const MSG_PREFIX = 1;
const MSG_CALL = 2;
const MSG_CALL_RESULT = 3;
const MSG_CALL_ERROR = 4;
const MSG_SUBSCRIBE = 5;
const MSG_UNSUBSCRIBE = 6;
const MSG_PUBLISH = 7;
const MSG_EVENT = 8;
/**
* @var WampServerInterface
*/
protected $_decorating;
/**
* @var \SplObjectStorage
*/
protected $connections;
/**
* @param WampServerInterface $serverComponent An class to propagate calls through
*/
public function __construct(WampServerInterface $serverComponent) {
$this->_decorating = $serverComponent;
$this->connections = new \SplObjectStorage;
}
/**
* {@inheritdoc}
*/
public function getSubProtocols() {
if ($this->_decorating instanceof WsServerInterface) {
$subs = $this->_decorating->getSubProtocols();
$subs[] = 'wamp';
return $subs;
}
return ['wamp'];
}
/**
* {@inheritdoc}
*/
public function onOpen(ConnectionInterface $conn) {
$decor = new WampConnection($conn);
$this->connections->attach($conn, $decor);
$this->_decorating->onOpen($decor);
}
/**
* {@inheritdoc}
* @throws \Ratchet\Wamp\Exception
* @throws \Ratchet\Wamp\JsonException
*/
public function onMessage(ConnectionInterface $from, $msg) {
$from = $this->connections[$from];
if (null === ($json = @json_decode($msg, true))) {
throw new JsonException;
}
if (!is_array($json) || $json !== array_values($json)) {
throw new Exception("Invalid WAMP message format");
}
if (isset($json[1]) && !(is_string($json[1]) || is_numeric($json[1]))) {
throw new Exception('Invalid Topic, must be a string');
}
switch ($json[0]) {
case static::MSG_PREFIX:
$from->WAMP->prefixes[$json[1]] = $json[2];
break;
case static::MSG_CALL:
array_shift($json);
$callID = array_shift($json);
$procURI = array_shift($json);
if (count($json) == 1 && is_array($json[0])) {
$json = $json[0];
}
$this->_decorating->onCall($from, $callID, $from->getUri($procURI), $json);
break;
case static::MSG_SUBSCRIBE:
$this->_decorating->onSubscribe($from, $from->getUri($json[1]));
break;
case static::MSG_UNSUBSCRIBE:
$this->_decorating->onUnSubscribe($from, $from->getUri($json[1]));
break;
case static::MSG_PUBLISH:
$exclude = (array_key_exists(3, $json) ? $json[3] : null);
if (!is_array($exclude)) {
if (true === (boolean)$exclude) {
$exclude = [$from->WAMP->sessionId];
} else {
$exclude = [];
}
}
$eligible = (array_key_exists(4, $json) ? $json[4] : []);
$this->_decorating->onPublish($from, $from->getUri($json[1]), $json[2], $exclude, $eligible);
break;
default:
throw new Exception('Invalid WAMP message type');
}
}
/**
* {@inheritdoc}
*/
public function onClose(ConnectionInterface $conn) {
$decor = $this->connections[$conn];
$this->connections->detach($conn);
$this->_decorating->onClose($decor);
}
/**
* {@inheritdoc}
*/
public function onError(ConnectionInterface $conn, \Exception $e) {
return $this->_decorating->onError($this->connections[$conn], $e);
}
}

View file

@ -1,101 +0,0 @@
<?php
namespace Ratchet\Wamp;
use Ratchet\ConnectionInterface;
/**
* A topic/channel containing connections that have subscribed to it
*/
class Topic implements \IteratorAggregate, \Countable {
private $id;
private $subscribers;
/**
* @param string $topicId Unique ID for this object
*/
public function __construct($topicId) {
$this->id = $topicId;
$this->subscribers = new \SplObjectStorage;
}
/**
* @return string
*/
public function getId() {
return $this->id;
}
public function __toString() {
return $this->getId();
}
/**
* Send a message to all the connections in this topic
* @param string|array $msg Payload to publish
* @param array $exclude A list of session IDs the message should be excluded from (blacklist)
* @param array $eligible A list of session Ids the message should be send to (whitelist)
* @return Topic The same Topic object to chain
*/
public function broadcast($msg, array $exclude = array(), array $eligible = array()) {
$useEligible = (bool)count($eligible);
foreach ($this->subscribers as $client) {
if (in_array($client->WAMP->sessionId, $exclude)) {
continue;
}
if ($useEligible && !in_array($client->WAMP->sessionId, $eligible)) {
continue;
}
$client->event($this->id, $msg);
}
return $this;
}
/**
* @param WampConnection $conn
* @return boolean
*/
public function has(ConnectionInterface $conn) {
return $this->subscribers->contains($conn);
}
/**
* @param WampConnection $conn
* @return Topic
*/
public function add(ConnectionInterface $conn) {
$this->subscribers->attach($conn);
return $this;
}
/**
* @param WampConnection $conn
* @return Topic
*/
public function remove(ConnectionInterface $conn) {
if ($this->subscribers->contains($conn)) {
$this->subscribers->detach($conn);
}
return $this;
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function getIterator() {
return $this->subscribers;
}
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function count() {
return $this->subscribers->count();
}
}

View file

@ -1,125 +0,0 @@
<?php
namespace Ratchet\Wamp;
use Ratchet\ConnectionInterface;
use Ratchet\WebSocket\WsServerInterface;
class TopicManager implements WsServerInterface, WampServerInterface {
/**
* @var WampServerInterface
*/
protected $app;
/**
* @var array
*/
protected $topicLookup = array();
public function __construct(WampServerInterface $app) {
$this->app = $app;
}
/**
* {@inheritdoc}
*/
public function onOpen(ConnectionInterface $conn) {
$conn->WAMP->subscriptions = new \SplObjectStorage;
$this->app->onOpen($conn);
}
/**
* {@inheritdoc}
*/
public function onCall(ConnectionInterface $conn, $id, $topic, array $params) {
$this->app->onCall($conn, $id, $this->getTopic($topic), $params);
}
/**
* {@inheritdoc}
*/
public function onSubscribe(ConnectionInterface $conn, $topic) {
$topicObj = $this->getTopic($topic);
if ($conn->WAMP->subscriptions->contains($topicObj)) {
return;
}
$this->topicLookup[$topic]->add($conn);
$conn->WAMP->subscriptions->attach($topicObj);
$this->app->onSubscribe($conn, $topicObj);
}
/**
* {@inheritdoc}
*/
public function onUnsubscribe(ConnectionInterface $conn, $topic) {
$topicObj = $this->getTopic($topic);
if (!$conn->WAMP->subscriptions->contains($topicObj)) {
return;
}
$this->cleanTopic($topicObj, $conn);
$this->app->onUnsubscribe($conn, $topicObj);
}
/**
* {@inheritdoc}
*/
public function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude, array $eligible) {
$this->app->onPublish($conn, $this->getTopic($topic), $event, $exclude, $eligible);
}
/**
* {@inheritdoc}
*/
public function onClose(ConnectionInterface $conn) {
$this->app->onClose($conn);
foreach ($this->topicLookup as $topic) {
$this->cleanTopic($topic, $conn);
}
}
/**
* {@inheritdoc}
*/
public function onError(ConnectionInterface $conn, \Exception $e) {
$this->app->onError($conn, $e);
}
/**
* {@inheritdoc}
*/
public function getSubProtocols() {
if ($this->app instanceof WsServerInterface) {
return $this->app->getSubProtocols();
}
return array();
}
/**
* @param string
* @return Topic
*/
protected function getTopic($topic) {
if (!array_key_exists($topic, $this->topicLookup)) {
$this->topicLookup[$topic] = new Topic($topic);
}
return $this->topicLookup[$topic];
}
protected function cleanTopic(Topic $topic, ConnectionInterface $conn) {
if ($conn->WAMP->subscriptions->contains($topic)) {
$conn->WAMP->subscriptions->detach($topic);
}
$this->topicLookup[$topic->getId()]->remove($conn);
if (0 === $topic->count()) {
unset($this->topicLookup[$topic->getId()]);
}
}
}

View file

@ -1,115 +0,0 @@
<?php
namespace Ratchet\Wamp;
use Ratchet\ConnectionInterface;
use Ratchet\AbstractConnectionDecorator;
use Ratchet\Wamp\ServerProtocol as WAMP;
/**
* A ConnectionInterface object wrapper that is passed to your WAMP application
* representing a client. Methods on this Connection are therefore different.
* @property \stdClass $WAMP
*/
class WampConnection extends AbstractConnectionDecorator {
/**
* {@inheritdoc}
*/
public function __construct(ConnectionInterface $conn) {
parent::__construct($conn);
$this->WAMP = new \StdClass;
$this->WAMP->sessionId = str_replace('.', '', uniqid(mt_rand(), true));
$this->WAMP->prefixes = array();
$this->send(json_encode(array(WAMP::MSG_WELCOME, $this->WAMP->sessionId, 1, \Ratchet\VERSION)));
}
/**
* Successfully respond to a call made by the client
* @param string $id The unique ID given by the client to respond to
* @param array $data an object or array
* @return WampConnection
*/
public function callResult($id, $data = array()) {
return $this->send(json_encode(array(WAMP::MSG_CALL_RESULT, $id, $data)));
}
/**
* Respond with an error to a client call
* @param string $id The unique ID given by the client to respond to
* @param string $errorUri The URI given to identify the specific error
* @param string $desc A developer-oriented description of the error
* @param string $details An optional human readable detail message to send back
* @return WampConnection
*/
public function callError($id, $errorUri, $desc = '', $details = null) {
if ($errorUri instanceof Topic) {
$errorUri = (string)$errorUri;
}
$data = array(WAMP::MSG_CALL_ERROR, $id, $errorUri, $desc);
if (null !== $details) {
$data[] = $details;
}
return $this->send(json_encode($data));
}
/**
* @param string $topic The topic to broadcast to
* @param mixed $msg Data to send with the event. Anything that is json'able
* @return WampConnection
*/
public function event($topic, $msg) {
return $this->send(json_encode(array(WAMP::MSG_EVENT, (string)$topic, $msg)));
}
/**
* @param string $curie
* @param string $uri
* @return WampConnection
*/
public function prefix($curie, $uri) {
$this->WAMP->prefixes[$curie] = (string)$uri;
return $this->send(json_encode(array(WAMP::MSG_PREFIX, $curie, (string)$uri)));
}
/**
* Get the full request URI from the connection object if a prefix has been established for it
* @param string $uri
* @return string
*/
public function getUri($uri) {
$curieSeperator = ':';
if (preg_match('/http(s*)\:\/\//', $uri) == false) {
if (strpos($uri, $curieSeperator) !== false) {
list($prefix, $action) = explode($curieSeperator, $uri);
if(isset($this->WAMP->prefixes[$prefix]) === true){
return $this->WAMP->prefixes[$prefix] . '#' . $action;
}
}
}
return $uri;
}
/**
* @internal
*/
public function send($data) {
$this->getConnection()->send($data);
return $this;
}
/**
* {@inheritdoc}
*/
public function close($opt = null) {
$this->getConnection()->close($opt);
}
}

View file

@ -1,67 +0,0 @@
<?php
namespace Ratchet\Wamp;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\ConnectionInterface;
/**
* Enable support for the official WAMP sub-protocol in your application
* WAMP allows for Pub/Sub and RPC
* @link http://wamp.ws The WAMP specification
* @link https://github.com/oberstet/autobahn-js Souce for client side library
* @link http://autobahn.s3.amazonaws.com/js/autobahn.min.js Minified client side library
*/
class WampServer implements MessageComponentInterface, WsServerInterface {
/**
* @var ServerProtocol
*/
protected $wampProtocol;
/**
* This class just makes it 1 step easier to use Topic objects in WAMP
* If you're looking at the source code, look in the __construct of this
* class and use that to make your application instead of using this
*/
public function __construct(WampServerInterface $app) {
$this->wampProtocol = new ServerProtocol(new TopicManager($app));
}
/**
* {@inheritdoc}
*/
public function onOpen(ConnectionInterface $conn) {
$this->wampProtocol->onOpen($conn);
}
/**
* {@inheritdoc}
*/
public function onMessage(ConnectionInterface $conn, $msg) {
try {
$this->wampProtocol->onMessage($conn, $msg);
} catch (Exception $we) {
$conn->close(1007);
}
}
/**
* {@inheritdoc}
*/
public function onClose(ConnectionInterface $conn) {
$this->wampProtocol->onClose($conn);
}
/**
* {@inheritdoc}
*/
public function onError(ConnectionInterface $conn, \Exception $e) {
$this->wampProtocol->onError($conn, $e);
}
/**
* {@inheritdoc}
*/
public function getSubProtocols() {
return $this->wampProtocol->getSubProtocols();
}
}

View file

@ -1,43 +0,0 @@
<?php
namespace Ratchet\Wamp;
use Ratchet\ComponentInterface;
use Ratchet\ConnectionInterface;
/**
* An extension of Ratchet\ComponentInterface to server a WAMP application
* onMessage is replaced by various types of messages for this protocol (pub/sub or rpc)
*/
interface WampServerInterface extends ComponentInterface {
/**
* An RPC call has been received
* @param \Ratchet\ConnectionInterface $conn
* @param string $id The unique ID of the RPC, required to respond to
* @param string|Topic $topic The topic to execute the call against
* @param array $params Call parameters received from the client
*/
function onCall(ConnectionInterface $conn, $id, $topic, array $params);
/**
* A request to subscribe to a topic has been made
* @param \Ratchet\ConnectionInterface $conn
* @param string|Topic $topic The topic to subscribe to
*/
function onSubscribe(ConnectionInterface $conn, $topic);
/**
* A request to unsubscribe from a topic has been made
* @param \Ratchet\ConnectionInterface $conn
* @param string|Topic $topic The topic to unsubscribe from
*/
function onUnSubscribe(ConnectionInterface $conn, $topic);
/**
* A client is attempting to publish content to a subscribed connections on a URI
* @param \Ratchet\ConnectionInterface $conn
* @param string|Topic $topic The topic the user has attempted to publish to
* @param string $event Payload of the publish
* @param array $exclude A list of session IDs the message should be excluded from (blacklist)
* @param array $eligible A list of session Ids the message should be send to (whitelist)
*/
function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude, array $eligible);
}

View file

@ -1,20 +0,0 @@
<?php
namespace Ratchet\WebSocket;
use Ratchet\RFC6455\Messaging\MessageBuffer;
class ConnContext {
/**
* @var \Ratchet\WebSocket\WsConnection
*/
public $connection;
/**
* @var \Ratchet\RFC6455\Messaging\MessageBuffer;
*/
public $buffer;
public function __construct(WsConnection $conn, MessageBuffer $buffer) {
$this->connection = $conn;
$this->buffer = $buffer;
}
}

View file

@ -1,8 +0,0 @@
<?php
namespace Ratchet\WebSocket;
use Ratchet\ConnectionInterface;
use Ratchet\RFC6455\Messaging\MessageInterface;
interface MessageCallableInterface {
public function onMessage(ConnectionInterface $conn, MessageInterface $msg);
}

View file

@ -1,6 +0,0 @@
<?php
namespace Ratchet\WebSocket;
use Ratchet\ComponentInterface;
interface MessageComponentInterface extends ComponentInterface, MessageCallableInterface {
}

View file

@ -1,45 +0,0 @@
<?php
namespace Ratchet\WebSocket;
use Ratchet\AbstractConnectionDecorator;
use Ratchet\RFC6455\Messaging\DataInterface;
use Ratchet\RFC6455\Messaging\Frame;
/**
* {@inheritdoc}
* @property \StdClass $WebSocket
*/
class WsConnection extends AbstractConnectionDecorator {
/**
* {@inheritdoc}
*/
public function send($msg) {
if (!$this->WebSocket->closing) {
if (!($msg instanceof DataInterface)) {
$msg = new Frame($msg);
}
$this->getConnection()->send($msg->getContents());
}
return $this;
}
/**
* @param int|\Ratchet\RFC6455\Messaging\DataInterface
*/
public function close($code = 1000) {
if ($this->WebSocket->closing) {
return;
}
if ($code instanceof DataInterface) {
$this->send($code);
} else {
$this->send(new Frame(pack('n', $code), true, Frame::OP_CLOSE));
}
$this->getConnection()->close();
$this->WebSocket->closing = true;
}
}

View file

@ -1,225 +0,0 @@
<?php
namespace Ratchet\WebSocket;
use Ratchet\ComponentInterface;
use Ratchet\ConnectionInterface;
use Ratchet\MessageComponentInterface as DataComponentInterface;
use Ratchet\Http\HttpServerInterface;
use Ratchet\Http\CloseResponseTrait;
use Psr\Http\Message\RequestInterface;
use Ratchet\RFC6455\Messaging\MessageInterface;
use Ratchet\RFC6455\Messaging\FrameInterface;
use Ratchet\RFC6455\Messaging\Frame;
use Ratchet\RFC6455\Messaging\MessageBuffer;
use Ratchet\RFC6455\Messaging\CloseFrameChecker;
use Ratchet\RFC6455\Handshake\ServerNegotiator;
use Ratchet\RFC6455\Handshake\RequestVerifier;
use React\EventLoop\LoopInterface;
use GuzzleHttp\Psr7\Message;
/**
* The adapter to handle WebSocket requests/responses
* This is a mediator between the Server and your application to handle real-time messaging through a web browser
* @link http://ca.php.net/manual/en/ref.http.php
* @link http://dev.w3.org/html5/websockets/
*/
class WsServer implements HttpServerInterface {
use CloseResponseTrait;
/**
* Decorated component
* @var \Ratchet\ComponentInterface
*/
private $delegate;
/**
* @var \SplObjectStorage
*/
protected $connections;
/**
* @var \Ratchet\RFC6455\Messaging\CloseFrameChecker
*/
private $closeFrameChecker;
/**
* @var \Ratchet\RFC6455\Handshake\ServerNegotiator
*/
private $handshakeNegotiator;
/**
* @var \Closure
*/
private $ueFlowFactory;
/**
* @var \Closure
*/
private $pongReceiver;
/**
* @var \Closure
*/
private $msgCb;
/**
* @param \Ratchet\WebSocket\MessageComponentInterface|\Ratchet\MessageComponentInterface $component Your application to run with WebSockets
* @note If you want to enable sub-protocols have your component implement WsServerInterface as well
*/
public function __construct(ComponentInterface $component) {
if ($component instanceof MessageComponentInterface) {
$this->msgCb = function(ConnectionInterface $conn, MessageInterface $msg) {
$this->delegate->onMessage($conn, $msg);
};
} elseif ($component instanceof DataComponentInterface) {
$this->msgCb = function(ConnectionInterface $conn, MessageInterface $msg) {
$this->delegate->onMessage($conn, $msg->getPayload());
};
} else {
throw new \UnexpectedValueException('Expected instance of \Ratchet\WebSocket\MessageComponentInterface or \Ratchet\MessageComponentInterface');
}
if (bin2hex('✓') !== 'e29c93') {
throw new \DomainException('Bad encoding, unicode character ✓ did not match expected value. Ensure charset UTF-8 and check ini val mbstring.func_autoload');
}
$this->delegate = $component;
$this->connections = new \SplObjectStorage;
$this->closeFrameChecker = new CloseFrameChecker;
$this->handshakeNegotiator = new ServerNegotiator(new RequestVerifier);
$this->handshakeNegotiator->setStrictSubProtocolCheck(true);
if ($component instanceof WsServerInterface) {
$this->handshakeNegotiator->setSupportedSubProtocols($component->getSubProtocols());
}
$this->pongReceiver = function() {};
$reusableUnderflowException = new \UnderflowException;
$this->ueFlowFactory = function() use ($reusableUnderflowException) {
return $reusableUnderflowException;
};
}
/**
* {@inheritdoc}
*/
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
if (null === $request) {
throw new \UnexpectedValueException('$request can not be null');
}
$conn->httpRequest = $request;
$conn->WebSocket = new \StdClass;
$conn->WebSocket->closing = false;
$response = $this->handshakeNegotiator->handshake($request)->withHeader('X-Powered-By', \Ratchet\VERSION);
$conn->send(Message::toString($response));
if (101 !== $response->getStatusCode()) {
return $conn->close();
}
$wsConn = new WsConnection($conn);
$streamer = new MessageBuffer(
$this->closeFrameChecker,
function(MessageInterface $msg) use ($wsConn) {
$cb = $this->msgCb;
$cb($wsConn, $msg);
},
function(FrameInterface $frame) use ($wsConn) {
$this->onControlFrame($frame, $wsConn);
},
true,
$this->ueFlowFactory
);
$this->connections->attach($conn, new ConnContext($wsConn, $streamer));
return $this->delegate->onOpen($wsConn);
}
/**
* {@inheritdoc}
*/
public function onMessage(ConnectionInterface $from, $msg) {
if ($from->WebSocket->closing) {
return;
}
$this->connections[$from]->buffer->onData($msg);
}
/**
* {@inheritdoc}
*/
public function onClose(ConnectionInterface $conn) {
if ($this->connections->contains($conn)) {
$context = $this->connections[$conn];
$this->connections->detach($conn);
$this->delegate->onClose($context->connection);
}
}
/**
* {@inheritdoc}
*/
public function onError(ConnectionInterface $conn, \Exception $e) {
if ($this->connections->contains($conn)) {
$this->delegate->onError($this->connections[$conn]->connection, $e);
} else {
$conn->close();
}
}
public function onControlFrame(FrameInterface $frame, WsConnection $conn) {
switch ($frame->getOpCode()) {
case Frame::OP_CLOSE:
$conn->close($frame);
break;
case Frame::OP_PING:
$conn->send(new Frame($frame->getPayload(), true, Frame::OP_PONG));
break;
case Frame::OP_PONG:
$pongReceiver = $this->pongReceiver;
$pongReceiver($frame, $conn);
break;
}
}
public function setStrictSubProtocolCheck($enable) {
$this->handshakeNegotiator->setStrictSubProtocolCheck($enable);
}
public function enableKeepAlive(LoopInterface $loop, $interval = 30) {
$lastPing = new Frame(uniqid(), true, Frame::OP_PING);
$pingedConnections = new \SplObjectStorage;
$splClearer = new \SplObjectStorage;
$this->pongReceiver = function(FrameInterface $frame, $wsConn) use ($pingedConnections, &$lastPing) {
if ($frame->getPayload() === $lastPing->getPayload()) {
$pingedConnections->detach($wsConn);
}
};
$loop->addPeriodicTimer((int)$interval, function() use ($pingedConnections, &$lastPing, $splClearer) {
foreach ($pingedConnections as $wsConn) {
$wsConn->close();
}
$pingedConnections->removeAllExcept($splClearer);
$lastPing = new Frame(uniqid(), true, Frame::OP_PING);
foreach ($this->connections as $key => $conn) {
$wsConn = $this->connections[$conn]->connection;
$wsConn->send($lastPing);
$pingedConnections->attach($wsConn);
}
});
}
}

View file

@ -1,14 +0,0 @@
<?php
namespace Ratchet\WebSocket;
/**
* WebSocket Server Interface
*/
interface WsServerInterface {
/**
* If any component in a stack supports a WebSocket sub-protocol return each supported in an array
* @return array
* @todo This method may be removed in future version (note that will not break code, just make some code obsolete)
*/
function getSubProtocols();
}

View file

@ -1,36 +0,0 @@
<?php
use Ratchet\ConnectionInterface;
require dirname(dirname(dirname(__DIR__))) . '/vendor/autoload.php';
class BinaryEcho implements \Ratchet\WebSocket\MessageComponentInterface {
public function onMessage(ConnectionInterface $from, \Ratchet\RFC6455\Messaging\MessageInterface $msg) {
$from->send($msg);
}
public function onOpen(ConnectionInterface $conn) {
}
public function onClose(ConnectionInterface $conn) {
}
public function onError(ConnectionInterface $conn, \Exception $e) {
}
}
$port = $argc > 1 ? $argv[1] : 8000;
$impl = sprintf('React\EventLoop\%sLoop', $argc > 2 ? $argv[2] : 'StreamSelect');
$loop = new $impl;
$sock = new React\Socket\Server('0.0.0.0:' . $port, $loop);
$wsServer = new Ratchet\WebSocket\WsServer(new BinaryEcho);
// This is enabled to test https://github.com/ratchetphp/Ratchet/issues/430
// The time is left at 10 minutes so that it will not try to every ping anything
// This causes the Ratchet server to crash on test 2.7
$wsServer->enableKeepAlive($loop, 600);
$app = new Ratchet\Http\HttpServer($wsServer);
$server = new Ratchet\Server\IoServer($app, $sock, $loop);
$server->run();

View file

@ -1,15 +0,0 @@
{
"options": {"failByDrop": false}
, "outdir": "reports/ab"
, "servers": [
{"agent": "Ratchet/0.4 libevent", "url": "ws://localhost:8001", "options": {"version": 18}}
, {"agent": "Ratchet/0.4 libev", "url": "ws://localhost:8004", "options": {"version": 18}}
, {"agent": "Ratchet/0.4 streams", "url": "ws://localhost:8002", "options": {"version": 18}}
, {"agent": "AutobahnTestSuite/0.5.9", "url": "ws://localhost:8000", "options": {"version": 18}}
]
, "cases": ["*"]
, "exclude-cases": []
, "exclude-agent-cases": {}
}

View file

@ -1,12 +0,0 @@
{
"options": {"failByDrop": false}
, "outdir": "reports/profile"
, "servers": [
{"agent": "Ratchet", "url": "ws://localhost:8000", "options": {"version": 18}}
]
, "cases": ["9.7.4"]
, "exclude-cases": ["1.2.*", "2.3", "2.4", "2.6", "9.2.*", "9.4.*", "9.6.*", "9.8.*"]
, "exclude-agent-cases": {}
}

View file

@ -1,12 +0,0 @@
{
"options": {"failByDrop": false}
, "outdir": "reports/rfc"
, "servers": [
{"agent": "Ratchet", "url": "ws://localhost:8000", "options": {"version": 18}}
]
, "cases": ["*"]
, "exclude-cases": []
, "exclude-agent-cases": {}
}

View file

@ -1,4 +0,0 @@
<?php
$loader = require __DIR__ . '/../vendor/autoload.php';
$loader->addPsr4('Ratchet\\', __DIR__ . '/helpers/Ratchet');

View file

@ -1,50 +0,0 @@
<?php
namespace Ratchet;
abstract class AbstractMessageComponentTestCase extends \PHPUnit_Framework_TestCase {
protected $_app;
protected $_serv;
protected $_conn;
abstract public function getConnectionClassString();
abstract public function getDecoratorClassString();
abstract public function getComponentClassString();
public function setUp() {
$this->_app = $this->getMock($this->getComponentClassString());
$decorator = $this->getDecoratorClassString();
$this->_serv = new $decorator($this->_app);
$this->_conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->doOpen($this->_conn);
}
protected function doOpen($conn) {
$this->_serv->onOpen($conn);
}
public function isExpectedConnection() {
return new \PHPUnit_Framework_Constraint_IsInstanceOf($this->getConnectionClassString());
}
public function testOpen() {
$this->_app->expects($this->once())->method('onOpen')->with($this->isExpectedConnection());
$this->doOpen($this->getMock('\Ratchet\ConnectionInterface'));
}
public function testOnClose() {
$this->_app->expects($this->once())->method('onClose')->with($this->isExpectedConnection());
$this->_serv->onClose($this->_conn);
}
public function testOnError() {
$e = new \Exception('Whoops!');
$this->_app->expects($this->once())->method('onError')->with($this->isExpectedConnection(), $e);
$this->_serv->onError($this->_conn, $e);
}
public function passthroughMessageTest($value) {
$this->_app->expects($this->once())->method('onMessage')->with($this->isExpectedConnection(), $value);
$this->_serv->onMessage($this->_conn, $value);
}
}

View file

@ -1,35 +0,0 @@
<?php
namespace Ratchet\Mock;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\ConnectionInterface;
class Component implements MessageComponentInterface, WsServerInterface {
public $last = array();
public $protocols = array();
public function __construct(ComponentInterface $app = null) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onOpen(ConnectionInterface $conn) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onMessage(ConnectionInterface $from, $msg) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onClose(ConnectionInterface $conn) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onError(ConnectionInterface $conn, \Exception $e) {
$this->last[__FUNCTION__] = func_get_args();
}
public function getSubProtocols() {
return $this->protocols;
}
}

View file

@ -1,20 +0,0 @@
<?php
namespace Ratchet\Mock;
use Ratchet\ConnectionInterface;
class Connection implements ConnectionInterface {
public $last = array(
'send' => ''
, 'close' => false
);
public $remoteAddress = '127.0.0.1';
public function send($data) {
$this->last[__FUNCTION__] = $data;
}
public function close() {
$this->last[__FUNCTION__] = true;
}
}

View file

@ -1,22 +0,0 @@
<?php
namespace Ratchet\Mock;
use Ratchet\AbstractConnectionDecorator;
class ConnectionDecorator extends AbstractConnectionDecorator {
public $last = array(
'write' => ''
, 'end' => false
);
public function send($data) {
$this->last[__FUNCTION__] = $data;
$this->getConnection()->send($data);
}
public function close() {
$this->last[__FUNCTION__] = true;
$this->getConnection()->close();
}
}

View file

@ -1,43 +0,0 @@
<?php
namespace Ratchet\Mock;
use Ratchet\Wamp\WampServerInterface;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\ConnectionInterface;
class WampComponent implements WampServerInterface, WsServerInterface {
public $last = array();
public $protocols = array();
public function getSubProtocols() {
return $this->protocols;
}
public function onCall(ConnectionInterface $conn, $id, $procURI, array $params) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onSubscribe(ConnectionInterface $conn, $topic) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onUnSubscribe(ConnectionInterface $conn, $topic) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude, array $eligible) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onOpen(ConnectionInterface $conn) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onClose(ConnectionInterface $conn) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onError(ConnectionInterface $conn, \Exception $e) {
$this->last[__FUNCTION__] = func_get_args();
}
}

View file

@ -1,28 +0,0 @@
<?php
namespace Ratchet;
use Ratchet\ConnectionInterface;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\Wamp\WampServerInterface;
class NullComponent implements MessageComponentInterface, WsServerInterface, WampServerInterface {
public function onOpen(ConnectionInterface $conn) {}
public function onMessage(ConnectionInterface $conn, $msg) {}
public function onClose(ConnectionInterface $conn) {}
public function onError(ConnectionInterface $conn, \Exception $e) {}
public function onCall(ConnectionInterface $conn, $id, $topic, array $params) {}
public function onSubscribe(ConnectionInterface $conn, $topic) {}
public function onUnSubscribe(ConnectionInterface $conn, $topic) {}
public function onPublish(ConnectionInterface $conn, $topic, $event, array $exclude = array(), array $eligible = array()) {}
public function getSubProtocols() {
return array();
}
}

View file

@ -1,7 +0,0 @@
<?php
namespace Ratchet\Wamp\Stub;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\Wamp\WampServerInterface;
interface WsWampServerInterface extends WsServerInterface, WampServerInterface {
}

View file

@ -1,7 +0,0 @@
<?php
namespace Ratchet\WebSocket\Stub;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;
interface WsMessageComponentInterface extends MessageComponentInterface, WsServerInterface {
}

View file

@ -1,147 +0,0 @@
<?php
namespace Ratchet;
use Ratchet\Mock\ConnectionDecorator;
/**
* @covers Ratchet\AbstractConnectionDecorator
* @covers Ratchet\ConnectionInterface
*/
class AbstractConnectionDecoratorTest extends \PHPUnit_Framework_TestCase {
protected $mock;
protected $l1;
protected $l2;
public function setUp() {
$this->mock = $this->getMock('\Ratchet\ConnectionInterface');
$this->l1 = new ConnectionDecorator($this->mock);
$this->l2 = new ConnectionDecorator($this->l1);
}
public function testGet() {
$var = 'hello';
$val = 'world';
$this->mock->$var = $val;
$this->assertEquals($val, $this->l1->$var);
$this->assertEquals($val, $this->l2->$var);
}
public function testSet() {
$var = 'Chris';
$val = 'Boden';
$this->l1->$var = $val;
$this->assertEquals($val, $this->mock->$var);
}
public function testSetLevel2() {
$var = 'Try';
$val = 'Again';
$this->l2->$var = $val;
$this->assertEquals($val, $this->mock->$var);
}
public function testIsSetTrue() {
$var = 'PHP';
$val = 'Ratchet';
$this->mock->$var = $val;
$this->assertTrue(isset($this->l1->$var));
$this->assertTrue(isset($this->l2->$var));
}
public function testIsSetFalse() {
$var = 'herp';
$val = 'derp';
$this->assertFalse(isset($this->l1->$var));
$this->assertFalse(isset($this->l2->$var));
}
public function testUnset() {
$var = 'Flying';
$val = 'Monkey';
$this->mock->$var = $val;
unset($this->l1->$var);
$this->assertFalse(isset($this->mock->$var));
}
public function testUnsetLevel2() {
$var = 'Flying';
$val = 'Monkey';
$this->mock->$var = $val;
unset($this->l2->$var);
$this->assertFalse(isset($this->mock->$var));
}
public function testGetConnection() {
$class = new \ReflectionClass('\\Ratchet\\AbstractConnectionDecorator');
$method = $class->getMethod('getConnection');
$method->setAccessible(true);
$conn = $method->invokeArgs($this->l1, array());
$this->assertSame($this->mock, $conn);
}
public function testGetConnectionLevel2() {
$class = new \ReflectionClass('\\Ratchet\\AbstractConnectionDecorator');
$method = $class->getMethod('getConnection');
$method->setAccessible(true);
$conn = $method->invokeArgs($this->l2, array());
$this->assertSame($this->l1, $conn);
}
public function testWrapperCanStoreSelfInDecorator() {
$this->mock->decorator = $this->l1;
$this->assertSame($this->l1, $this->l2->decorator);
}
public function testDecoratorRecursion() {
$this->mock->decorator = new \stdClass;
$this->mock->decorator->conn = $this->l1;
$this->assertSame($this->l1, $this->mock->decorator->conn);
$this->assertSame($this->l1, $this->l1->decorator->conn);
$this->assertSame($this->l1, $this->l2->decorator->conn);
}
public function testDecoratorRecursionLevel2() {
$this->mock->decorator = new \stdClass;
$this->mock->decorator->conn = $this->l2;
$this->assertSame($this->l2, $this->mock->decorator->conn);
$this->assertSame($this->l2, $this->l1->decorator->conn);
$this->assertSame($this->l2, $this->l2->decorator->conn);
// just for fun
$this->assertSame($this->l2, $this->l2->decorator->conn->decorator->conn->decorator->conn);
}
public function testWarningGettingNothing() {
$this->setExpectedException('PHPUnit_Framework_Error');
$var = $this->mock->nonExistant;
}
public function testWarningGettingNothingLevel1() {
$this->setExpectedException('PHPUnit_Framework_Error');
$var = $this->l1->nonExistant;
}
public function testWarningGettingNothingLevel2() {
$this->setExpectedException('PHPUnit_Framework_Error');
$var = $this->l2->nonExistant;
}
}

View file

@ -1,50 +0,0 @@
<?php
namespace Ratchet\Http;
/**
* @covers Ratchet\Http\HttpRequestParser
*/
class HttpRequestParserTest extends \PHPUnit_Framework_TestCase {
protected $parser;
public function setUp() {
$this->parser = new HttpRequestParser;
}
public function headersProvider() {
return array(
array(false, "GET / HTTP/1.1\r\nHost: socketo.me\r\n")
, array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n")
, array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n1")
, array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie✖")
, array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie✖\r\n\r\n")
, array(true, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\nHixie\r\n")
);
}
/**
* @dataProvider headersProvider
*/
public function testIsEom($expected, $message) {
$this->assertEquals($expected, $this->parser->isEom($message));
}
public function testBufferOverflowResponse() {
$conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->parser->maxSize = 20;
$this->assertNull($this->parser->onMessage($conn, "GET / HTTP/1.1\r\n"));
$this->setExpectedException('OverflowException');
$this->parser->onMessage($conn, "Header-Is: Too Big");
}
public function testReturnTypeIsRequest() {
$conn = $this->getMock('\Ratchet\ConnectionInterface');
$return = $this->parser->onMessage($conn, "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n");
$this->assertInstanceOf('\Psr\Http\Message\RequestInterface', $return);
}
}

View file

@ -1,64 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\AbstractMessageComponentTestCase;
/**
* @covers Ratchet\Http\HttpServer
*/
class HttpServerTest extends AbstractMessageComponentTestCase {
public function setUp() {
parent::setUp();
$this->_conn->httpHeadersReceived = true;
}
public function getConnectionClassString() {
return '\Ratchet\ConnectionInterface';
}
public function getDecoratorClassString() {
return '\Ratchet\Http\HttpServer';
}
public function getComponentClassString() {
return '\Ratchet\Http\HttpServerInterface';
}
public function testOpen() {
$headers = "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n";
$this->_conn->httpHeadersReceived = false;
$this->_app->expects($this->once())->method('onOpen')->with($this->isExpectedConnection());
$this->_serv->onMessage($this->_conn, $headers);
}
public function testOnMessageAfterHeaders() {
$headers = "GET / HTTP/1.1\r\nHost: socketo.me\r\n\r\n";
$this->_conn->httpHeadersReceived = false;
$this->_serv->onMessage($this->_conn, $headers);
$message = "Hello World!";
$this->_app->expects($this->once())->method('onMessage')->with($this->isExpectedConnection(), $message);
$this->_serv->onMessage($this->_conn, $message);
}
public function testBufferOverflow() {
$this->_conn->expects($this->once())->method('close');
$this->_conn->httpHeadersReceived = false;
$this->_serv->onMessage($this->_conn, str_repeat('a', 5000));
}
public function testCloseIfNotEstablished() {
$this->_conn->httpHeadersReceived = false;
$this->_conn->expects($this->once())->method('close');
$this->_serv->onError($this->_conn, new \Exception('Whoops!'));
}
public function testBufferHeaders() {
$this->_conn->httpHeadersReceived = false;
$this->_app->expects($this->never())->method('onOpen');
$this->_app->expects($this->never())->method('onMessage');
$this->_serv->onMessage($this->_conn, "GET / HTTP/1.1");
}
}

View file

@ -1,46 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\AbstractMessageComponentTestCase;
/**
* @covers Ratchet\Http\OriginCheck
*/
class OriginCheckTest extends AbstractMessageComponentTestCase {
protected $_reqStub;
public function setUp() {
$this->_reqStub = $this->getMock('Psr\Http\Message\RequestInterface');
$this->_reqStub->expects($this->any())->method('getHeader')->will($this->returnValue(['localhost']));
parent::setUp();
$this->_serv->allowedOrigins[] = 'localhost';
}
protected function doOpen($conn) {
$this->_serv->onOpen($conn, $this->_reqStub);
}
public function getConnectionClassString() {
return '\Ratchet\ConnectionInterface';
}
public function getDecoratorClassString() {
return '\Ratchet\Http\OriginCheck';
}
public function getComponentClassString() {
return '\Ratchet\Http\HttpServerInterface';
}
public function testCloseOnNonMatchingOrigin() {
$this->_serv->allowedOrigins = ['socketo.me'];
$this->_conn->expects($this->once())->method('close');
$this->_serv->onOpen($this->_conn, $this->_reqStub);
}
public function testOnMessage() {
$this->passthroughMessageTest('Hello World!');
}
}

View file

@ -1,165 +0,0 @@
<?php
namespace Ratchet\Http;
use Ratchet\WebSocket\WsServerInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Matcher\UrlMatcher;
/**
* @covers Ratchet\Http\Router
*/
class RouterTest extends \PHPUnit_Framework_TestCase {
protected $_router;
protected $_matcher;
protected $_conn;
protected $_uri;
protected $_req;
public function setUp() {
$this->_conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->_uri = $this->getMock('Psr\Http\Message\UriInterface');
$this->_req = $this->getMock('\Psr\Http\Message\RequestInterface');
$this->_req
->expects($this->any())
->method('getUri')
->will($this->returnValue($this->_uri));
$this->_matcher = $this->getMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
$this->_matcher
->expects($this->any())
->method('getContext')
->will($this->returnValue($this->getMock('Symfony\Component\Routing\RequestContext')));
$this->_router = new Router($this->_matcher);
$this->_uri->expects($this->any())->method('getPath')->will($this->returnValue('ws://doesnt.matter/'));
$this->_uri->expects($this->any())->method('withQuery')->with($this->callback(function($val) {
$this->setResult($val);
return true;
}))->will($this->returnSelf());
$this->_uri->expects($this->any())->method('getQuery')->will($this->returnCallback([$this, 'getResult']));
$this->_req->expects($this->any())->method('withUri')->will($this->returnSelf());
}
public function testFourOhFour() {
$this->_conn->expects($this->once())->method('close');
$nope = new ResourceNotFoundException;
$this->_matcher->expects($this->any())->method('match')->will($this->throwException($nope));
$this->_router->onOpen($this->_conn, $this->_req);
}
public function testNullRequest() {
$this->setExpectedException('\UnexpectedValueException');
$this->_router->onOpen($this->_conn);
}
public function testControllerIsMessageComponentInterface() {
$this->setExpectedException('\UnexpectedValueException');
$this->_matcher->expects($this->any())->method('match')->will($this->returnValue(array('_controller' => new \StdClass)));
$this->_router->onOpen($this->_conn, $this->_req);
}
public function testControllerOnOpen() {
$controller = $this->getMockBuilder('\Ratchet\WebSocket\WsServer')->disableOriginalConstructor()->getMock();
$this->_matcher->expects($this->any())->method('match')->will($this->returnValue(array('_controller' => $controller)));
$this->_router->onOpen($this->_conn, $this->_req);
$expectedConn = new \PHPUnit_Framework_Constraint_IsInstanceOf('\Ratchet\ConnectionInterface');
$controller->expects($this->once())->method('onOpen')->with($expectedConn, $this->_req);
$this->_matcher->expects($this->any())->method('match')->will($this->returnValue(array('_controller' => $controller)));
$this->_router->onOpen($this->_conn, $this->_req);
}
public function testControllerOnMessageBubbles() {
$message = "The greatest trick the Devil ever pulled was convincing the world he didn't exist";
$controller = $this->getMockBuilder('\Ratchet\WebSocket\WsServer')->disableOriginalConstructor()->getMock();
$controller->expects($this->once())->method('onMessage')->with($this->_conn, $message);
$this->_conn->controller = $controller;
$this->_router->onMessage($this->_conn, $message);
}
public function testControllerOnCloseBubbles() {
$controller = $this->getMockBuilder('\Ratchet\WebSocket\WsServer')->disableOriginalConstructor()->getMock();
$controller->expects($this->once())->method('onClose')->with($this->_conn);
$this->_conn->controller = $controller;
$this->_router->onClose($this->_conn);
}
public function testControllerOnErrorBubbles() {
$e= new \Exception('One cannot be betrayed if one has no exceptions');
$controller = $this->getMockBuilder('\Ratchet\WebSocket\WsServer')->disableOriginalConstructor()->getMock();
$controller->expects($this->once())->method('onError')->with($this->_conn, $e);
$this->_conn->controller = $controller;
$this->_router->onError($this->_conn, $e);
}
public function testRouterGeneratesRouteParameters() {
/** @var $controller WsServerInterface */
$controller = $this->getMockBuilder('\Ratchet\WebSocket\WsServer')->disableOriginalConstructor()->getMock();
/** @var $matcher UrlMatcherInterface */
$this->_matcher->expects($this->any())->method('match')->will(
$this->returnValue(['_controller' => $controller, 'foo' => 'bar', 'baz' => 'qux'])
);
$conn = $this->getMock('Ratchet\Mock\Connection');
$router = new Router($this->_matcher);
$router->onOpen($conn, $this->_req);
$this->assertEquals('foo=bar&baz=qux', $this->_req->getUri()->getQuery());
}
public function testQueryParams() {
$controller = $this->getMockBuilder('\Ratchet\WebSocket\WsServer')->disableOriginalConstructor()->getMock();
$this->_matcher->expects($this->any())->method('match')->will(
$this->returnValue(['_controller' => $controller, 'foo' => 'bar', 'baz' => 'qux'])
);
$conn = $this->getMock('Ratchet\Mock\Connection');
$request = $this->getMock('Psr\Http\Message\RequestInterface');
$uri = new \GuzzleHttp\Psr7\Uri('ws://doesnt.matter/endpoint?hello=world&foo=nope');
$request->expects($this->any())->method('getUri')->will($this->returnCallback(function() use (&$uri) {
return $uri;
}));
$request->expects($this->any())->method('withUri')->with($this->callback(function($url) use (&$uri) {
$uri = $url;
return true;
}))->will($this->returnSelf());
$router = new Router($this->_matcher);
$router->onOpen($conn, $request);
$this->assertEquals('foo=nope&baz=qux&hello=world', $request->getUri()->getQuery());
$this->assertEquals('ws', $request->getUri()->getScheme());
$this->assertEquals('doesnt.matter', $request->getUri()->getHost());
}
public function testImpatientClientOverflow() {
$this->_conn->expects($this->once())->method('close');
$header = "GET /nope HTTP/1.1
Upgrade: websocket
Connection: upgrade
Host: localhost
Origin: http://localhost
Sec-WebSocket-Version: 13\r\n\r\n";
$app = new HttpServer(new Router(new UrlMatcher(new RouteCollection, new RequestContext)));
$app->onOpen($this->_conn);
$app->onMessage($this->_conn, $header);
$app->onMessage($this->_conn, 'Silly body');
}
}

View file

@ -1,26 +0,0 @@
<?php
namespace Ratchet\Server;
use Ratchet\Server\EchoServer;
class EchoServerTest extends \PHPUnit_Framework_TestCase {
protected $_conn;
protected $_comp;
public function setUp() {
$this->_conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->_comp = new EchoServer;
}
public function testMessageEchod() {
$message = 'Tillsonburg, my back still aches when I hear that word.';
$this->_conn->expects($this->once())->method('send')->with($message);
$this->_comp->onMessage($this->_conn, $message);
}
public function testErrorClosesConnection() {
ob_start();
$this->_conn->expects($this->once())->method('close');
$this->_comp->onError($this->_conn, new \Exception);
ob_end_clean();
}
}

View file

@ -1,152 +0,0 @@
<?php
namespace Ratchet\Application\Server;
use Ratchet\Server\FlashPolicy;
/**
* @covers Ratchet\Server\FlashPolicy
*/
class FlashPolicyTest extends \PHPUnit_Framework_TestCase {
protected $_policy;
public function setUp() {
$this->_policy = new FlashPolicy();
}
public function testPolicyRender() {
$this->_policy->setSiteControl('all');
$this->_policy->addAllowedAccess('example.com', '*');
$this->_policy->addAllowedAccess('dev.example.com', '*');
$this->assertInstanceOf('SimpleXMLElement', $this->_policy->renderPolicy());
}
public function testInvalidPolicyReader() {
$this->setExpectedException('UnexpectedValueException');
$this->_policy->renderPolicy();
}
public function testInvalidDomainPolicyReader() {
$this->setExpectedException('UnexpectedValueException');
$this->_policy->setSiteControl('all');
$this->_policy->addAllowedAccess('dev.example.*', '*');
$this->_policy->renderPolicy();
}
/**
* @dataProvider siteControl
*/
public function testSiteControlValidation($accept, $permittedCrossDomainPolicies) {
$this->assertEquals($accept, $this->_policy->validateSiteControl($permittedCrossDomainPolicies));
}
public static function siteControl() {
return array(
array(true, 'all')
, array(true, 'none')
, array(true, 'master-only')
, array(false, 'by-content-type')
, array(false, 'by-ftp-filename')
, array(false, '')
, array(false, 'all ')
, array(false, 'asdf')
, array(false, '@893830')
, array(false, '*')
);
}
/**
* @dataProvider URI
*/
public function testDomainValidation($accept, $domain) {
$this->assertEquals($accept, $this->_policy->validateDomain($domain));
}
public static function URI() {
return array(
array(true, '*')
, array(true, 'example.com')
, array(true, 'exam-ple.com')
, array(true, '*.example.com')
, array(true, 'www.example.com')
, array(true, 'dev.dev.example.com')
, array(true, 'http://example.com')
, array(true, 'https://example.com')
, array(true, 'http://*.example.com')
, array(false, 'exam*ple.com')
, array(true, '127.0.255.1')
, array(true, 'localhost')
, array(false, 'www.example.*')
, array(false, 'www.exa*le.com')
, array(false, 'www.example.*com')
, array(false, '*.example.*')
, array(false, 'gasldf*$#a0sdf0a8sdf')
);
}
/**
* @dataProvider ports
*/
public function testPortValidation($accept, $ports) {
$this->assertEquals($accept, $this->_policy->validatePorts($ports));
}
public static function ports() {
return array(
array(true, '*')
, array(true, '80')
, array(true, '80,443')
, array(true, '507,516-523')
, array(true, '507,516-523,333')
, array(true, '507,516-523,507,516-523')
, array(false, '516-')
, array(true, '516-523,11')
, array(false, '516,-523,11')
, array(false, 'example')
, array(false, 'asdf,123')
, array(false, '--')
, array(false, ',,,')
, array(false, '838*')
);
}
public function testAddAllowedAccessOnlyAcceptsValidPorts() {
$this->setExpectedException('UnexpectedValueException');
$this->_policy->addAllowedAccess('*', 'nope');
}
public function testSetSiteControlThrowsException() {
$this->setExpectedException('UnexpectedValueException');
$this->_policy->setSiteControl('nope');
}
public function testErrorClosesConnection() {
$conn = $this->getMock('\\Ratchet\\ConnectionInterface');
$conn->expects($this->once())->method('close');
$this->_policy->onError($conn, new \Exception);
}
public function testOnMessageSendsString() {
$this->_policy->addAllowedAccess('*', '*');
$conn = $this->getMock('\\Ratchet\\ConnectionInterface');
$conn->expects($this->once())->method('send')->with($this->isType('string'));
$this->_policy->onMessage($conn, ' ');
}
public function testOnOpenExists() {
$this->assertTrue(method_exists($this->_policy, 'onOpen'));
$conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->_policy->onOpen($conn);
}
public function testOnCloseExists() {
$this->assertTrue(method_exists($this->_policy, 'onClose'));
$conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->_policy->onClose($conn);
}
}

View file

@ -1,32 +0,0 @@
<?php
namespace Ratchet\Application\Server;
use Ratchet\Server\IoConnection;
/**
* @covers Ratchet\Server\IoConnection
*/
class IoConnectionTest extends \PHPUnit_Framework_TestCase {
protected $sock;
protected $conn;
public function setUp() {
$this->sock = $this->getMock('\\React\\Socket\\ConnectionInterface');
$this->conn = new IoConnection($this->sock);
}
public function testCloseBubbles() {
$this->sock->expects($this->once())->method('end');
$this->conn->close();
}
public function testSendBubbles() {
$msg = '6 hour rides are productive';
$this->sock->expects($this->once())->method('write')->with($msg);
$this->conn->send($msg);
}
public function testSendReturnsSelf() {
$this->assertSame($this->conn, $this->conn->send('fluent interface'));
}
}

View file

@ -1,127 +0,0 @@
<?php
namespace Ratchet\Server;
use Ratchet\Server\IoServer;
use React\EventLoop\StreamSelectLoop;
use React\EventLoop\LoopInterface;
use React\Socket\Server;
/**
* @covers Ratchet\Server\IoServer
*/
class IoServerTest extends \PHPUnit_Framework_TestCase {
protected $server;
protected $app;
protected $port;
protected $reactor;
protected function tickLoop(LoopInterface $loop) {
$loop->futureTick(function () use ($loop) {
$loop->stop();
});
$loop->run();
}
public function setUp() {
$this->app = $this->getMock('\\Ratchet\\MessageComponentInterface');
$loop = new StreamSelectLoop;
$this->reactor = new Server(0, $loop);
$uri = $this->reactor->getAddress();
$this->port = parse_url((strpos($uri, '://') === false ? 'tcp://' : '') . $uri, PHP_URL_PORT);
$this->server = new IoServer($this->app, $this->reactor, $loop);
}
public function testOnOpen() {
$this->app->expects($this->once())->method('onOpen')->with($this->isInstanceOf('\\Ratchet\\ConnectionInterface'));
$client = stream_socket_client("tcp://localhost:{$this->port}");
$this->tickLoop($this->server->loop);
//$this->assertTrue(is_string($this->app->last['onOpen'][0]->remoteAddress));
//$this->assertTrue(is_int($this->app->last['onOpen'][0]->resourceId));
}
public function testOnData() {
$msg = 'Hello World!';
$this->app->expects($this->once())->method('onMessage')->with(
$this->isInstanceOf('\\Ratchet\\ConnectionInterface')
, $msg
);
$client = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_option($client, SOL_SOCKET, SO_REUSEADDR, 1);
socket_set_option($client, SOL_SOCKET, SO_SNDBUF, 4096);
socket_set_block($client);
socket_connect($client, 'localhost', $this->port);
$this->tickLoop($this->server->loop);
socket_write($client, $msg);
$this->tickLoop($this->server->loop);
socket_shutdown($client, 1);
socket_shutdown($client, 0);
socket_close($client);
$this->tickLoop($this->server->loop);
}
public function testOnClose() {
$this->app->expects($this->once())->method('onClose')->with($this->isInstanceOf('\\Ratchet\\ConnectionInterface'));
$client = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_option($client, SOL_SOCKET, SO_REUSEADDR, 1);
socket_set_option($client, SOL_SOCKET, SO_SNDBUF, 4096);
socket_set_block($client);
socket_connect($client, 'localhost', $this->port);
$this->tickLoop($this->server->loop);
socket_shutdown($client, 1);
socket_shutdown($client, 0);
socket_close($client);
$this->tickLoop($this->server->loop);
}
public function testFactory() {
$this->assertInstanceOf('\\Ratchet\\Server\\IoServer', IoServer::factory($this->app, 0));
}
public function testNoLoopProvidedError() {
$this->setExpectedException('RuntimeException');
$io = new IoServer($this->app, $this->reactor);
$io->run();
}
public function testOnErrorPassesException() {
$conn = $this->getMock('\\React\\Socket\\ConnectionInterface');
$conn->decor = $this->getMock('\\Ratchet\\ConnectionInterface');
$err = new \Exception("Nope");
$this->app->expects($this->once())->method('onError')->with($conn->decor, $err);
$this->server->handleError($err, $conn);
}
public function onErrorCalledWhenExceptionThrown() {
$this->markTestIncomplete("Need to learn how to throw an exception from a mock");
$conn = $this->getMock('\\React\\Socket\\ConnectionInterface');
$this->server->handleConnect($conn);
$e = new \Exception;
$this->app->expects($this->once())->method('onMessage')->with($this->isInstanceOf('\\Ratchet\\ConnectionInterface'), 'f')->will($e);
$this->app->expects($this->once())->method('onError')->with($this->instanceOf('\\Ratchet\\ConnectionInterface', $e));
$this->server->handleData('f', $conn);
}
}

View file

@ -1,125 +0,0 @@
<?php
namespace Ratchet\Server;
use Ratchet\Server\IpBlackList;
/**
* @covers Ratchet\Server\IpBlackList
*/
class IpBlackListTest extends \PHPUnit_Framework_TestCase {
protected $blocker;
protected $mock;
public function setUp() {
$this->mock = $this->getMock('\\Ratchet\\MessageComponentInterface');
$this->blocker = new IpBlackList($this->mock);
}
public function testOnOpen() {
$this->mock->expects($this->exactly(3))->method('onOpen');
$conn1 = $this->newConn();
$conn2 = $this->newConn();
$conn3 = $this->newConn();
$this->blocker->onOpen($conn1);
$this->blocker->onOpen($conn3);
$this->blocker->onOpen($conn2);
}
public function testBlockDoesNotTriggerOnOpen() {
$conn = $this->newConn();
$this->blocker->blockAddress($conn->remoteAddress);
$this->mock->expects($this->never())->method('onOpen');
$ret = $this->blocker->onOpen($conn);
}
public function testBlockDoesNotTriggerOnClose() {
$conn = $this->newConn();
$this->blocker->blockAddress($conn->remoteAddress);
$this->mock->expects($this->never())->method('onClose');
$ret = $this->blocker->onOpen($conn);
}
public function testOnMessageDecoration() {
$conn = $this->newConn();
$msg = 'Hello not being blocked';
$this->mock->expects($this->once())->method('onMessage')->with($conn, $msg);
$this->blocker->onMessage($conn, $msg);
}
public function testOnCloseDecoration() {
$conn = $this->newConn();
$this->mock->expects($this->once())->method('onClose')->with($conn);
$this->blocker->onClose($conn);
}
public function testBlockClosesConnection() {
$conn = $this->newConn();
$this->blocker->blockAddress($conn->remoteAddress);
$conn->expects($this->once())->method('close');
$this->blocker->onOpen($conn);
}
public function testAddAndRemoveWithFluentInterfaces() {
$blockOne = '127.0.0.1';
$blockTwo = '192.168.1.1';
$unblock = '75.119.207.140';
$this->blocker
->blockAddress($unblock)
->blockAddress($blockOne)
->unblockAddress($unblock)
->blockAddress($blockTwo)
;
$this->assertEquals(array($blockOne, $blockTwo), $this->blocker->getBlockedAddresses());
}
public function testDecoratorPassesErrors() {
$conn = $this->newConn();
$e = new \Exception('I threw an error');
$this->mock->expects($this->once())->method('onError')->with($conn, $e);
$this->blocker->onError($conn, $e);
}
public function addressProvider() {
return array(
array('127.0.0.1', '127.0.0.1')
, array('localhost', 'localhost')
, array('fe80::1%lo0', 'fe80::1%lo0')
, array('127.0.0.1', '127.0.0.1:6392')
);
}
/**
* @dataProvider addressProvider
*/
public function testFilterAddress($expected, $input) {
$this->assertEquals($expected, $this->blocker->filterAddress($input));
}
public function testUnblockingSilentlyFails() {
$this->assertInstanceOf('\\Ratchet\\Server\\IpBlackList', $this->blocker->unblockAddress('localhost'));
}
protected function newConn() {
$conn = $this->getMock('\\Ratchet\\ConnectionInterface');
$conn->remoteAddress = '127.0.0.1';
return $conn;
}
}

View file

@ -1,43 +0,0 @@
<?php
namespace Ratchet\Session\Serialize;
use Ratchet\Session\Serialize\PhpHandler;
/**
* @covers Ratchet\Session\Serialize\PhpHandler
*/
class PhpHandlerTest extends \PHPUnit_Framework_TestCase {
protected $_handler;
public function setUp() {
$this->_handler = new PhpHandler;
}
public function serializedProvider() {
return array(
array(
'_sf2_attributes|a:2:{s:5:"hello";s:5:"world";s:4:"last";i:1332872102;}_sf2_flashes|a:0:{}'
, array(
'_sf2_attributes' => array(
'hello' => 'world'
, 'last' => 1332872102
)
, '_sf2_flashes' => array()
)
)
);
}
/**
* @dataProvider serializedProvider
*/
public function testUnserialize($in, $expected) {
$this->assertEquals($expected, $this->_handler->unserialize($in));
}
/**
* @dataProvider serializedProvider
*/
public function testSerialize($serialized, $original) {
$this->assertEquals($serialized, $this->_handler->serialize($original));
}
}

View file

@ -1,126 +0,0 @@
<?php
namespace Ratchet\Session;
use Ratchet\AbstractMessageComponentTestCase;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
/**
* @covers Ratchet\Session\SessionProvider
* @covers Ratchet\Session\Storage\VirtualSessionStorage
* @covers Ratchet\Session\Storage\Proxy\VirtualProxy
*/
class SessionProviderTest extends AbstractMessageComponentTestCase {
public function setUp() {
return $this->markTestIncomplete('Test needs to be updated for ini_set issue in PHP 7.2');
if (!class_exists('Symfony\Component\HttpFoundation\Session\Session')) {
return $this->markTestSkipped('Dependency of Symfony HttpFoundation failed');
}
parent::setUp();
$this->_serv = new SessionProvider($this->_app, new NullSessionHandler);
}
public function tearDown() {
ini_set('session.serialize_handler', 'php');
}
public function getConnectionClassString() {
return '\Ratchet\ConnectionInterface';
}
public function getDecoratorClassString() {
return '\Ratchet\NullComponent';
}
public function getComponentClassString() {
return '\Ratchet\Http\HttpServerInterface';
}
public function classCaseProvider() {
return array(
array('php', 'Php')
, array('php_binary', 'PhpBinary')
);
}
/**
* @dataProvider classCaseProvider
*/
public function testToClassCase($in, $out) {
$ref = new \ReflectionClass('\\Ratchet\\Session\\SessionProvider');
$method = $ref->getMethod('toClassCase');
$method->setAccessible(true);
$component = new SessionProvider($this->getMock($this->getComponentClassString()), $this->getMock('\SessionHandlerInterface'));
$this->assertEquals($out, $method->invokeArgs($component, array($in)));
}
/**
* I think I have severely butchered this test...it's not so much of a unit test as it is a full-fledged component test
*/
public function testConnectionValueFromPdo() {
if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) {
return $this->markTestSkipped('Session test requires PDO and pdo_sqlite');
}
$sessionId = md5('testSession');
$dbOptions = array(
'db_table' => 'sessions'
, 'db_id_col' => 'sess_id'
, 'db_data_col' => 'sess_data'
, 'db_time_col' => 'sess_time'
, 'db_lifetime_col' => 'sess_lifetime'
);
$pdo = new \PDO("sqlite::memory:");
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$pdo->exec(vsprintf("CREATE TABLE %s (%s TEXT NOT NULL PRIMARY KEY, %s BLOB NOT NULL, %s INTEGER NOT NULL, %s INTEGER)", $dbOptions));
$pdoHandler = new PdoSessionHandler($pdo, $dbOptions);
$pdoHandler->write($sessionId, '_sf2_attributes|a:2:{s:5:"hello";s:5:"world";s:4:"last";i:1332872102;}_sf2_flashes|a:0:{}');
$component = new SessionProvider($this->getMock($this->getComponentClassString()), $pdoHandler, array('auto_start' => 1));
$connection = $this->getMock('Ratchet\\ConnectionInterface');
$headers = $this->getMock('Psr\Http\Message\RequestInterface');
$headers->expects($this->once())->method('getHeader')->will($this->returnValue([ini_get('session.name') . "={$sessionId};"]));
$component->onOpen($connection, $headers);
$this->assertEquals('world', $connection->Session->get('hello'));
}
protected function newConn() {
$conn = $this->getMock('Ratchet\ConnectionInterface');
$headers = $this->getMock('Psr\Http\Message\Request', array('getCookie'), array('POST', '/', array()));
$headers->expects($this->once())->method('getCookie', array(ini_get('session.name')))->will($this->returnValue(null));
return $conn;
}
public function testOnMessageDecorator() {
$message = "Database calls are usually blocking :(";
$this->_app->expects($this->once())->method('onMessage')->with($this->isExpectedConnection(), $message);
$this->_serv->onMessage($this->_conn, $message);
}
public function testRejectInvalidSeralizers() {
if (!function_exists('wddx_serialize_value')) {
$this->markTestSkipped();
}
ini_set('session.serialize_handler', 'wddx');
$this->setExpectedException('\RuntimeException');
new SessionProvider($this->getMock($this->getComponentClassString()), $this->getMock('\SessionHandlerInterface'));
}
protected function doOpen($conn) {
$request = $this->getMock('Psr\Http\Message\RequestInterface');
$request->expects($this->any())->method('getHeader')->will($this->returnValue([]));
$this->_serv->onOpen($conn, $request);
}
}

View file

@ -1,53 +0,0 @@
<?php
namespace Ratchet\Session\Storage;
use Ratchet\Session\Serialize\PhpHandler;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
class VirtualSessionStoragePDOTest extends \PHPUnit_Framework_TestCase {
/**
* @var VirtualSessionStorage
*/
protected $_virtualSessionStorage;
protected $_pathToDB;
public function setUp() {
if (!extension_loaded('PDO') || !extension_loaded('pdo_sqlite')) {
return $this->markTestSkipped('Session test requires PDO and pdo_sqlite');
}
$schema = <<<SQL
CREATE TABLE `sessions` (
`sess_id` VARBINARY(128) NOT NULL PRIMARY KEY,
`sess_data` BLOB NOT NULL,
`sess_time` INTEGER UNSIGNED NOT NULL,
`sess_lifetime` MEDIUMINT NOT NULL
);
SQL;
$this->_pathToDB = tempnam(sys_get_temp_dir(), 'SQ3');;
$dsn = 'sqlite:' . $this->_pathToDB;
$pdo = new \PDO($dsn);
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
$pdo->exec($schema);
$pdo = null;
$sessionHandler = new PdoSessionHandler($dsn);
$serializer = new PhpHandler();
$this->_virtualSessionStorage = new VirtualSessionStorage($sessionHandler, 'foobar', $serializer);
$this->_virtualSessionStorage->registerBag(new FlashBag());
$this->_virtualSessionStorage->registerBag(new AttributeBag());
}
public function tearDown() {
unlink($this->_pathToDB);
}
public function testStartWithDSN() {
$this->_virtualSessionStorage->start();
$this->assertTrue($this->_virtualSessionStorage->isStarted());
}
}

View file

@ -1,295 +0,0 @@
<?php
namespace Ratchet\Wamp;
use Ratchet\Mock\Connection;
use Ratchet\Mock\WampComponent as TestComponent;
/**
* @covers \Ratchet\Wamp\ServerProtocol
* @covers \Ratchet\Wamp\WampServerInterface
* @covers \Ratchet\Wamp\WampConnection
*/
class ServerProtocolTest extends \PHPUnit_Framework_TestCase {
protected $_comp;
protected $_app;
public function setUp() {
$this->_app = new TestComponent;
$this->_comp = new ServerProtocol($this->_app);
}
protected function newConn() {
return new Connection;
}
public function invalidMessageProvider() {
return [
[0]
, [3]
, [4]
, [8]
, [9]
];
}
/**
* @dataProvider invalidMessageProvider
*/
public function testInvalidMessages($type) {
$this->setExpectedException('\Ratchet\Wamp\Exception');
$conn = $this->newConn();
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode([$type]));
}
public function testWelcomeMessage() {
$conn = $this->newConn();
$this->_comp->onOpen($conn);
$message = $conn->last['send'];
$json = json_decode($message);
$this->assertEquals(4, count($json));
$this->assertEquals(0, $json[0]);
$this->assertTrue(is_string($json[1]));
$this->assertEquals(1, $json[2]);
}
public function testSubscribe() {
$uri = 'http://example.com';
$clientMessage = array(5, $uri);
$conn = $this->newConn();
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode($clientMessage));
$this->assertEquals($uri, $this->_app->last['onSubscribe'][1]);
}
public function testUnSubscribe() {
$uri = 'http://example.com/endpoint';
$clientMessage = array(6, $uri);
$conn = $this->newConn();
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode($clientMessage));
$this->assertEquals($uri, $this->_app->last['onUnSubscribe'][1]);
}
public function callProvider() {
return [
[2, 'a', 'b']
, [2, ['a', 'b']]
, [1, 'one']
, [3, 'one', 'two', 'three']
, [3, ['un', 'deux', 'trois']]
, [2, 'hi', ['hello', 'world']]
, [2, ['hello', 'world'], 'hi']
, [2, ['hello' => 'world', 'herp' => 'derp']]
];
}
/**
* @dataProvider callProvider
*/
public function testCall() {
$args = func_get_args();
$paramNum = array_shift($args);
$uri = 'http://example.com/endpoint/' . rand(1, 100);
$id = uniqid('', false);
$clientMessage = array_merge(array(2, $id, $uri), $args);
$conn = $this->newConn();
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode($clientMessage));
$this->assertEquals($id, $this->_app->last['onCall'][1]);
$this->assertEquals($uri, $this->_app->last['onCall'][2]);
$this->assertEquals($paramNum, count($this->_app->last['onCall'][3]));
}
public function testPublish() {
$conn = $this->newConn();
$topic = 'pubsubhubbub';
$event = 'Here I am, publishing data';
$clientMessage = array(7, $topic, $event);
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode($clientMessage));
$this->assertEquals($topic, $this->_app->last['onPublish'][1]);
$this->assertEquals($event, $this->_app->last['onPublish'][2]);
$this->assertEquals(array(), $this->_app->last['onPublish'][3]);
$this->assertEquals(array(), $this->_app->last['onPublish'][4]);
}
public function testPublishAndExcludeMe() {
$conn = $this->newConn();
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode(array(7, 'topic', 'event', true)));
$this->assertEquals($conn->WAMP->sessionId, $this->_app->last['onPublish'][3][0]);
}
public function testPublishAndEligible() {
$conn = $this->newConn();
$buddy = uniqid('', false);
$friend = uniqid('', false);
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode(array(7, 'topic', 'event', false, array($buddy, $friend))));
$this->assertEquals(array(), $this->_app->last['onPublish'][3]);
$this->assertEquals(2, count($this->_app->last['onPublish'][4]));
}
public function eventProvider() {
return array(
array('http://example.com', array('one', 'two'))
, array('curie', array(array('hello' => 'world', 'herp' => 'derp')))
);
}
/**
* @dataProvider eventProvider
*/
public function testEvent($topic, $payload) {
$conn = new WampConnection($this->newConn());
$conn->event($topic, $payload);
$eventString = $conn->last['send'];
$this->assertSame(array(8, $topic, $payload), json_decode($eventString, true));
}
public function testOnClosePropagation() {
$conn = new Connection;
$this->_comp->onOpen($conn);
$this->_comp->onClose($conn);
$class = new \ReflectionClass('\\Ratchet\\Wamp\\WampConnection');
$method = $class->getMethod('getConnection');
$method->setAccessible(true);
$check = $method->invokeArgs($this->_app->last['onClose'][0], array());
$this->assertSame($conn, $check);
}
public function testOnErrorPropagation() {
$conn = new Connection;
$e = new \Exception('Nope');
$this->_comp->onOpen($conn);
$this->_comp->onError($conn, $e);
$class = new \ReflectionClass('\\Ratchet\\Wamp\\WampConnection');
$method = $class->getMethod('getConnection');
$method->setAccessible(true);
$check = $method->invokeArgs($this->_app->last['onError'][0], array());
$this->assertSame($conn, $check);
$this->assertSame($e, $this->_app->last['onError'][1]);
}
public function testPrefix() {
$conn = new WampConnection($this->newConn());
$this->_comp->onOpen($conn);
$prefix = 'incoming';
$fullURI = "http://example.com/$prefix";
$method = 'call';
$this->_comp->onMessage($conn, json_encode(array(1, $prefix, $fullURI)));
$this->assertEquals($fullURI, $conn->WAMP->prefixes[$prefix]);
$this->assertEquals("$fullURI#$method", $conn->getUri("$prefix:$method"));
}
public function testMessageMustBeJson() {
$this->setExpectedException('\\Ratchet\\Wamp\\JsonException');
$conn = new Connection;
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, 'Hello World!');
}
public function testGetSubProtocolsReturnsArray() {
$this->assertTrue(is_array($this->_comp->getSubProtocols()));
}
public function testGetSubProtocolsGetFromApp() {
$this->_app->protocols = array('hello', 'world');
$this->assertGreaterThanOrEqual(3, count($this->_comp->getSubProtocols()));
}
public function testWampOnMessageApp() {
$app = $this->getMock('\\Ratchet\\Wamp\\WampServerInterface');
$wamp = new ServerProtocol($app);
$this->assertContains('wamp', $wamp->getSubProtocols());
}
public function badFormatProvider() {
return array(
array(json_encode(true))
, array('{"valid":"json", "invalid": "message"}')
, array('{"0": "fail", "hello": "world"}')
);
}
/**
* @dataProvider badFormatProvider
*/
public function testValidJsonButInvalidProtocol($message) {
$this->setExpectedException('\Ratchet\Wamp\Exception');
$conn = $this->newConn();
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, $message);
}
public function testBadClientInputFromNonStringTopic() {
$this->setExpectedException('\Ratchet\Wamp\Exception');
$conn = new WampConnection($this->newConn());
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode([5, ['hells', 'nope']]));
}
public function testBadPrefixWithNonStringTopic() {
$this->setExpectedException('\Ratchet\Wamp\Exception');
$conn = new WampConnection($this->newConn());
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode([1, ['hells', 'nope'], ['bad', 'input']]));
}
public function testBadPublishWithNonStringTopic() {
$this->setExpectedException('\Ratchet\Wamp\Exception');
$conn = new WampConnection($this->newConn());
$this->_comp->onOpen($conn);
$this->_comp->onMessage($conn, json_encode([7, ['bad', 'input'], 'Hider']));
}
}

View file

@ -1,226 +0,0 @@
<?php
namespace Ratchet\Wamp;
/**
* @covers Ratchet\Wamp\TopicManager
*/
class TopicManagerTest extends \PHPUnit_Framework_TestCase {
private $mock;
/**
* @var \Ratchet\Wamp\TopicManager
*/
private $mngr;
/**
* @var \Ratchet\ConnectionInterface
*/
private $conn;
public function setUp() {
$this->conn = $this->getMock('\Ratchet\ConnectionInterface');
$this->mock = $this->getMock('\Ratchet\Wamp\WampServerInterface');
$this->mngr = new TopicManager($this->mock);
$this->conn->WAMP = new \StdClass;
$this->mngr->onOpen($this->conn);
}
public function testGetTopicReturnsTopicObject() {
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array('The Topic'));
$this->assertInstanceOf('Ratchet\Wamp\Topic', $topic);
}
public function testGetTopicCreatesTopicWithSameName() {
$name = 'The Topic';
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array($name));
$this->assertEquals($name, $topic->getId());
}
public function testGetTopicReturnsSameObject() {
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array('No copy'));
$again = $method->invokeArgs($this->mngr, array('No copy'));
$this->assertSame($topic, $again);
}
public function testOnOpen() {
$this->mock->expects($this->once())->method('onOpen');
$this->mngr->onOpen($this->conn);
}
public function testOnCall() {
$id = uniqid();
$this->mock->expects($this->once())->method('onCall')->with(
$this->conn
, $id
, $this->isInstanceOf('Ratchet\Wamp\Topic')
, array()
);
$this->mngr->onCall($this->conn, $id, 'new topic', array());
}
public function testOnSubscribeCreatesTopicObject() {
$this->mock->expects($this->once())->method('onSubscribe')->with(
$this->conn, $this->isInstanceOf('Ratchet\Wamp\Topic')
);
$this->mngr->onSubscribe($this->conn, 'new topic');
}
public function testTopicIsInConnectionOnSubscribe() {
$name = 'New Topic';
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array($name));
$this->mngr->onSubscribe($this->conn, $name);
$this->assertTrue($this->conn->WAMP->subscriptions->contains($topic));
}
public function testDoubleSubscriptionFiresOnce() {
$this->mock->expects($this->exactly(1))->method('onSubscribe');
$this->mngr->onSubscribe($this->conn, 'same topic');
$this->mngr->onSubscribe($this->conn, 'same topic');
}
public function testUnsubscribeEvent() {
$name = 'in and out';
$this->mock->expects($this->once())->method('onUnsubscribe')->with(
$this->conn, $this->isInstanceOf('Ratchet\Wamp\Topic')
);
$this->mngr->onSubscribe($this->conn, $name);
$this->mngr->onUnsubscribe($this->conn, $name);
}
public function testUnsubscribeFiresOnce() {
$name = 'getting sleepy';
$this->mock->expects($this->exactly(1))->method('onUnsubscribe');
$this->mngr->onSubscribe($this->conn, $name);
$this->mngr->onUnsubscribe($this->conn, $name);
$this->mngr->onUnsubscribe($this->conn, $name);
}
public function testUnsubscribeRemovesTopicFromConnection() {
$name = 'Bye Bye Topic';
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array($name));
$this->mngr->onSubscribe($this->conn, $name);
$this->mngr->onUnsubscribe($this->conn, $name);
$this->assertFalse($this->conn->WAMP->subscriptions->contains($topic));
}
public function testOnPublishBubbles() {
$msg = 'Cover all the code!';
$this->mock->expects($this->once())->method('onPublish')->with(
$this->conn
, $this->isInstanceOf('Ratchet\Wamp\Topic')
, $msg
, $this->isType('array')
, $this->isType('array')
);
$this->mngr->onPublish($this->conn, 'topic coverage', $msg, array(), array());
}
public function testOnCloseBubbles() {
$this->mock->expects($this->once())->method('onClose')->with($this->conn);
$this->mngr->onClose($this->conn);
}
protected function topicProvider($name) {
$class = new \ReflectionClass('Ratchet\Wamp\TopicManager');
$method = $class->getMethod('getTopic');
$method->setAccessible(true);
$attribute = $class->getProperty('topicLookup');
$attribute->setAccessible(true);
$topic = $method->invokeArgs($this->mngr, array($name));
return array($topic, $attribute);
}
public function testConnIsRemovedFromTopicOnClose() {
$name = 'State Testing';
list($topic, $attribute) = $this->topicProvider($name);
$this->assertCount(1, $attribute->getValue($this->mngr));
$this->mngr->onSubscribe($this->conn, $name);
$this->mngr->onClose($this->conn);
$this->assertFalse($topic->has($this->conn));
}
public static function topicConnExpectationProvider() {
return [
[ 'onClose', 0]
, ['onUnsubscribe', 0]
];
}
/**
* @dataProvider topicConnExpectationProvider
*/
public function testTopicRetentionFromLeavingConnections($methodCall, $expectation) {
$topicName = 'checkTopic';
list($topic, $attribute) = $this->topicProvider($topicName);
$this->mngr->onSubscribe($this->conn, $topicName);
call_user_func_array(array($this->mngr, $methodCall), array($this->conn, $topicName));
$this->assertCount($expectation, $attribute->getValue($this->mngr));
}
public function testOnErrorBubbles() {
$e = new \Exception('All work and no play makes Chris a dull boy');
$this->mock->expects($this->once())->method('onError')->with($this->conn, $e);
$this->mngr->onError($this->conn, $e);
}
public function testGetSubProtocolsReturnsArray() {
$this->assertInternalType('array', $this->mngr->getSubProtocols());
}
public function testGetSubProtocolsBubbles() {
$subs = array('hello', 'world');
$app = $this->getMock('Ratchet\Wamp\Stub\WsWampServerInterface');
$app->expects($this->once())->method('getSubProtocols')->will($this->returnValue($subs));
$mngr = new TopicManager($app);
$this->assertEquals($subs, $mngr->getSubProtocols());
}
}

View file

@ -1,164 +0,0 @@
<?php
namespace Ratchet\Wamp;
/**
* @covers Ratchet\Wamp\Topic
*/
class TopicTest extends \PHPUnit_Framework_TestCase {
public function testGetId() {
$id = uniqid();
$topic = new Topic($id);
$this->assertEquals($id, $topic->getId());
}
public function testAddAndCount() {
$topic = new Topic('merp');
$topic->add($this->newConn());
$topic->add($this->newConn());
$topic->add($this->newConn());
$this->assertEquals(3, count($topic));
}
public function testRemove() {
$topic = new Topic('boop');
$tracked = $this->newConn();
$topic->add($this->newConn());
$topic->add($tracked);
$topic->add($this->newConn());
$topic->remove($tracked);
$this->assertEquals(2, count($topic));
}
public function testBroadcast() {
$msg = 'Hello World!';
$name = 'Batman';
$protocol = json_encode(array(8, $name, $msg));
$first = $this->getMock('Ratchet\\Wamp\\WampConnection', array('send'), array($this->getMock('\\Ratchet\\ConnectionInterface')));
$second = $this->getMock('Ratchet\\Wamp\\WampConnection', array('send'), array($this->getMock('\\Ratchet\\ConnectionInterface')));
$first->expects($this->once())
->method('send')
->with($this->equalTo($protocol));
$second->expects($this->once())
->method('send')
->with($this->equalTo($protocol));
$topic = new Topic($name);
$topic->add($first);
$topic->add($second);
$topic->broadcast($msg);
}
public function testBroadcastWithExclude() {
$msg = 'Hello odd numbers';
$name = 'Excluding';
$protocol = json_encode(array(8, $name, $msg));
$first = $this->getMock('Ratchet\\Wamp\\WampConnection', array('send'), array($this->getMock('\\Ratchet\\ConnectionInterface')));
$second = $this->getMock('Ratchet\\Wamp\\WampConnection', array('send'), array($this->getMock('\\Ratchet\\ConnectionInterface')));
$third = $this->getMock('Ratchet\\Wamp\\WampConnection', array('send'), array($this->getMock('\\Ratchet\\ConnectionInterface')));
$first->expects($this->once())
->method('send')
->with($this->equalTo($protocol));
$second->expects($this->never())->method('send');
$third->expects($this->once())
->method('send')
->with($this->equalTo($protocol));
$topic = new Topic($name);
$topic->add($first);
$topic->add($second);
$topic->add($third);
$topic->broadcast($msg, array($second->WAMP->sessionId));
}
public function testBroadcastWithEligible() {
$msg = 'Hello white list';
$name = 'Eligible';
$protocol = json_encode(array(8, $name, $msg));
$first = $this->getMock('Ratchet\\Wamp\\WampConnection', array('send'), array($this->getMock('\\Ratchet\\ConnectionInterface')));
$second = $this->getMock('Ratchet\\Wamp\\WampConnection', array('send'), array($this->getMock('\\Ratchet\\ConnectionInterface')));
$third = $this->getMock('Ratchet\\Wamp\\WampConnection', array('send'), array($this->getMock('\\Ratchet\\ConnectionInterface')));
$first->expects($this->once())
->method('send')
->with($this->equalTo($protocol));
$second->expects($this->never())->method('send');
$third->expects($this->once())
->method('send')
->with($this->equalTo($protocol));
$topic = new Topic($name);
$topic->add($first);
$topic->add($second);
$topic->add($third);
$topic->broadcast($msg, array(), array($first->WAMP->sessionId, $third->WAMP->sessionId));
}
public function testIterator() {
$first = $this->newConn();
$second = $this->newConn();
$third = $this->newConn();
$topic = new Topic('Joker');
$topic->add($first)->add($second)->add($third);
$check = array($first, $second, $third);
foreach ($topic as $mock) {
$this->assertNotSame(false, array_search($mock, $check));
}
}
public function testToString() {
$name = 'Bane';
$topic = new Topic($name);
$this->assertEquals($name, (string)$topic);
}
public function testDoesHave() {
$conn = $this->newConn();
$topic = new Topic('Two Face');
$topic->add($conn);
$this->assertTrue($topic->has($conn));
}
public function testDoesNotHave() {
$conn = $this->newConn();
$topic = new Topic('Alfred');
$this->assertFalse($topic->has($conn));
}
public function testDoesNotHaveAfterRemove() {
$conn = $this->newConn();
$topic = new Topic('Ras');
$topic->add($conn)->remove($conn);
$this->assertFalse($topic->has($conn));
}
protected function newConn() {
return new WampConnection($this->getMock('\\Ratchet\\ConnectionInterface'));
}
}

View file

@ -1,77 +0,0 @@
<?php
namespace Ratchet\Wamp;
/**
* @covers Ratchet\Wamp\WampConnection
*/
class WampConnectionTest extends \PHPUnit_Framework_TestCase {
protected $conn;
protected $mock;
public function setUp() {
$this->mock = $this->getMock('\\Ratchet\\ConnectionInterface');
$this->conn = new WampConnection($this->mock);
}
public function testCallResult() {
$callId = uniqid();
$data = array('hello' => 'world', 'herp' => 'derp');
$this->mock->expects($this->once())->method('send')->with(json_encode(array(3, $callId, $data)));
$this->conn->callResult($callId, $data);
}
public function testCallError() {
$callId = uniqid();
$uri = 'http://example.com/end/point';
$this->mock->expects($this->once())->method('send')->with(json_encode(array(4, $callId, $uri, '')));
$this->conn->callError($callId, $uri);
}
public function testCallErrorWithTopic() {
$callId = uniqid();
$uri = 'http://example.com/end/point';
$this->mock->expects($this->once())->method('send')->with(json_encode(array(4, $callId, $uri, '')));
$this->conn->callError($callId, new Topic($uri));
}
public function testDetailedCallError() {
$callId = uniqid();
$uri = 'http://example.com/end/point';
$desc = 'beep boop beep';
$detail = 'Error: Too much awesome';
$this->mock->expects($this->once())->method('send')->with(json_encode(array(4, $callId, $uri, $desc, $detail)));
$this->conn->callError($callId, $uri, $desc, $detail);
}
public function testPrefix() {
$shortOut = 'outgoing';
$longOut = 'http://example.com/outgoing';
$this->mock->expects($this->once())->method('send')->with(json_encode(array(1, $shortOut, $longOut)));
$this->conn->prefix($shortOut, $longOut);
}
public function testGetUriWhenNoCurieGiven() {
$uri = 'http://example.com/noshort';
$this->assertEquals($uri, $this->conn->getUri($uri));
}
public function testClose() {
$mock = $this->getMock('\\Ratchet\\ConnectionInterface');
$conn = new WampConnection($mock);
$mock->expects($this->once())->method('close');
$conn->close();
}
}

View file

@ -1,49 +0,0 @@
<?php
namespace Ratchet\Wamp;
use Ratchet\AbstractMessageComponentTestCase;
/**
* @covers Ratchet\Wamp\WampServer
*/
class WampServerTest extends AbstractMessageComponentTestCase {
public function getConnectionClassString() {
return '\Ratchet\Wamp\WampConnection';
}
public function getDecoratorClassString() {
return 'Ratchet\Wamp\WampServer';
}
public function getComponentClassString() {
return '\Ratchet\Wamp\WampServerInterface';
}
public function testOnMessageToEvent() {
$published = 'Client published this message';
$this->_app->expects($this->once())->method('onPublish')->with(
$this->isExpectedConnection()
, new \PHPUnit_Framework_Constraint_IsInstanceOf('\Ratchet\Wamp\Topic')
, $published
, array()
, array()
);
$this->_serv->onMessage($this->_conn, json_encode(array(7, 'topic', $published)));
}
public function testGetSubProtocols() {
// todo: could expand on this
$this->assertInternalType('array', $this->_serv->getSubProtocols());
}
public function testConnectionClosesOnInvalidJson() {
$this->_conn->expects($this->once())->method('close');
$this->_serv->onMessage($this->_conn, 'invalid json');
}
public function testConnectionClosesOnProtocolError() {
$this->_conn->expects($this->once())->method('close');
$this->_serv->onMessage($this->_conn, json_encode(array('valid' => 'json', 'invalid' => 'protocol')));
}
}

View file

@ -42,37 +42,35 @@ namespace Composer\Autoload;
*/ */
class ClassLoader class ClassLoader
{ {
/** @var \Closure(string):void */ /** @var ?string */
private static $includeFile;
/** @var string|null */
private $vendorDir; private $vendorDir;
// PSR-4 // PSR-4
/** /**
* @var array<string, array<string, int>> * @var array[]
* @psalm-var array<string, array<string, int>>
*/ */
private $prefixLengthsPsr4 = array(); private $prefixLengthsPsr4 = array();
/** /**
* @var array<string, list<string>> * @var array[]
* @psalm-var array<string, array<int, string>>
*/ */
private $prefixDirsPsr4 = array(); private $prefixDirsPsr4 = array();
/** /**
* @var list<string> * @var array[]
* @psalm-var array<string, string>
*/ */
private $fallbackDirsPsr4 = array(); private $fallbackDirsPsr4 = array();
// PSR-0 // PSR-0
/** /**
* List of PSR-0 prefixes * @var array[]
* * @psalm-var array<string, array<string, string[]>>
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/ */
private $prefixesPsr0 = array(); private $prefixesPsr0 = array();
/** /**
* @var list<string> * @var array[]
* @psalm-var array<string, string>
*/ */
private $fallbackDirsPsr0 = array(); private $fallbackDirsPsr0 = array();
@ -80,7 +78,8 @@ class ClassLoader
private $useIncludePath = false; private $useIncludePath = false;
/** /**
* @var array<string, string> * @var string[]
* @psalm-var array<string, string>
*/ */
private $classMap = array(); private $classMap = array();
@ -88,29 +87,29 @@ class ClassLoader
private $classMapAuthoritative = false; private $classMapAuthoritative = false;
/** /**
* @var array<string, bool> * @var bool[]
* @psalm-var array<string, bool>
*/ */
private $missingClasses = array(); private $missingClasses = array();
/** @var string|null */ /** @var ?string */
private $apcuPrefix; private $apcuPrefix;
/** /**
* @var array<string, self> * @var self[]
*/ */
private static $registeredLoaders = array(); private static $registeredLoaders = array();
/** /**
* @param string|null $vendorDir * @param ?string $vendorDir
*/ */
public function __construct($vendorDir = null) public function __construct($vendorDir = null)
{ {
$this->vendorDir = $vendorDir; $this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
} }
/** /**
* @return array<string, list<string>> * @return string[]
*/ */
public function getPrefixes() public function getPrefixes()
{ {
@ -122,7 +121,8 @@ class ClassLoader
} }
/** /**
* @return array<string, list<string>> * @return array[]
* @psalm-return array<string, array<int, string>>
*/ */
public function getPrefixesPsr4() public function getPrefixesPsr4()
{ {
@ -130,7 +130,8 @@ class ClassLoader
} }
/** /**
* @return list<string> * @return array[]
* @psalm-return array<string, string>
*/ */
public function getFallbackDirs() public function getFallbackDirs()
{ {
@ -138,7 +139,8 @@ class ClassLoader
} }
/** /**
* @return list<string> * @return array[]
* @psalm-return array<string, string>
*/ */
public function getFallbackDirsPsr4() public function getFallbackDirsPsr4()
{ {
@ -146,7 +148,8 @@ class ClassLoader
} }
/** /**
* @return array<string, string> Array of classname => path * @return string[] Array of classname => path
* @psalm-return array<string, string>
*/ */
public function getClassMap() public function getClassMap()
{ {
@ -154,7 +157,8 @@ class ClassLoader
} }
/** /**
* @param array<string, string> $classMap Class to filename map * @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
* *
* @return void * @return void
*/ */
@ -171,25 +175,24 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, either * Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix. * appending or prepending to the ones previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories * @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
* *
* @return void * @return void
*/ */
public function add($prefix, $paths, $prepend = false) public function add($prefix, $paths, $prepend = false)
{ {
$paths = (array) $paths;
if (!$prefix) { if (!$prefix) {
if ($prepend) { if ($prepend) {
$this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0 = array_merge(
$paths, (array) $paths,
$this->fallbackDirsPsr0 $this->fallbackDirsPsr0
); );
} else { } else {
$this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0, $this->fallbackDirsPsr0,
$paths (array) $paths
); );
} }
@ -198,19 +201,19 @@ class ClassLoader
$first = $prefix[0]; $first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) { if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths; $this->prefixesPsr0[$first][$prefix] = (array) $paths;
return; return;
} }
if ($prepend) { if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix] = array_merge(
$paths, (array) $paths,
$this->prefixesPsr0[$first][$prefix] $this->prefixesPsr0[$first][$prefix]
); );
} else { } else {
$this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix], $this->prefixesPsr0[$first][$prefix],
$paths (array) $paths
); );
} }
} }
@ -219,9 +222,9 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, either * Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace. * appending or prepending to the ones previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories * @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* *
@ -229,18 +232,17 @@ class ClassLoader
*/ */
public function addPsr4($prefix, $paths, $prepend = false) public function addPsr4($prefix, $paths, $prepend = false)
{ {
$paths = (array) $paths;
if (!$prefix) { if (!$prefix) {
// Register directories for the root namespace. // Register directories for the root namespace.
if ($prepend) { if ($prepend) {
$this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4 = array_merge(
$paths, (array) $paths,
$this->fallbackDirsPsr4 $this->fallbackDirsPsr4
); );
} else { } else {
$this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4, $this->fallbackDirsPsr4,
$paths (array) $paths
); );
} }
} elseif (!isset($this->prefixDirsPsr4[$prefix])) { } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@ -250,18 +252,18 @@ class ClassLoader
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
} }
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths; $this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) { } elseif ($prepend) {
// Prepend directories for an already registered namespace. // Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix] = array_merge(
$paths, (array) $paths,
$this->prefixDirsPsr4[$prefix] $this->prefixDirsPsr4[$prefix]
); );
} else { } else {
// Append directories for an already registered namespace. // Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix], $this->prefixDirsPsr4[$prefix],
$paths (array) $paths
); );
} }
} }
@ -270,8 +272,8 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, * Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix. * replacing any others previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories * @param string[]|string $paths The PSR-0 base directories
* *
* @return void * @return void
*/ */
@ -288,8 +290,8 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, * Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace. * replacing any others previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories * @param string[]|string $paths The PSR-4 base directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* *
@ -423,8 +425,7 @@ class ClassLoader
public function loadClass($class) public function loadClass($class)
{ {
if ($file = $this->findFile($class)) { if ($file = $this->findFile($class)) {
$includeFile = self::$includeFile; includeFile($file);
$includeFile($file);
return true; return true;
} }
@ -475,9 +476,9 @@ class ClassLoader
} }
/** /**
* Returns the currently registered loaders keyed by their corresponding vendor directories. * Returns the currently registered loaders indexed by their corresponding vendor directories.
* *
* @return array<string, self> * @return self[]
*/ */
public static function getRegisteredLoaders() public static function getRegisteredLoaders()
{ {
@ -554,26 +555,18 @@ class ClassLoader
return false; return false;
} }
}
/**
* @return void /**
*/ * Scope isolated include.
private static function initializeIncludeClosure() *
{ * Prevents access to $this/self from included files.
if (self::$includeFile !== null) { *
return; * @param string $file
} * @return void
* @private
/** */
* Scope isolated include. function includeFile($file)
* {
* Prevents access to $this/self from included files. include $file;
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
} }

View file

@ -28,7 +28,7 @@ class InstalledVersions
{ {
/** /**
* @var mixed[]|null * @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
*/ */
private static $installed; private static $installed;
@ -39,7 +39,7 @@ class InstalledVersions
/** /**
* @var array[] * @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> * @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/ */
private static $installedByVendor = array(); private static $installedByVendor = array();
@ -98,7 +98,7 @@ class InstalledVersions
{ {
foreach (self::getInstalled() as $installed) { foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) { if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
} }
} }
@ -119,7 +119,7 @@ class InstalledVersions
*/ */
public static function satisfies(VersionParser $parser, $packageName, $constraint) public static function satisfies(VersionParser $parser, $packageName, $constraint)
{ {
$constraint = $parser->parseConstraints((string) $constraint); $constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint); return $provided->matches($constraint);
@ -243,7 +243,7 @@ class InstalledVersions
/** /**
* @return array * @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} * @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
*/ */
public static function getRootPackage() public static function getRootPackage()
{ {
@ -257,7 +257,7 @@ class InstalledVersions
* *
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[] * @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} * @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
*/ */
public static function getRawData() public static function getRawData()
{ {
@ -280,7 +280,7 @@ class InstalledVersions
* Returns the raw data of all installed.php which are currently loaded for custom implementations * Returns the raw data of all installed.php which are currently loaded for custom implementations
* *
* @return array[] * @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/ */
public static function getAllRawData() public static function getAllRawData()
{ {
@ -303,7 +303,7 @@ class InstalledVersions
* @param array[] $data A vendor/composer/installed.php data set * @param array[] $data A vendor/composer/installed.php data set
* @return void * @return void
* *
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data * @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
*/ */
public static function reload($data) public static function reload($data)
{ {
@ -313,7 +313,7 @@ class InstalledVersions
/** /**
* @return array[] * @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}> * @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/ */
private static function getInstalled() private static function getInstalled()
{ {
@ -328,9 +328,7 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) { if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir]; $installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) { } elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1]; self::$installed = $installed[count($installed) - 1];
} }
@ -342,17 +340,12 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location, // only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') { if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ self::$installed = require __DIR__ . '/installed.php';
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else { } else {
self::$installed = array(); self::$installed = array();
} }
} }
$installed[] = self::$installed;
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed; return $installed;
} }

View file

@ -1,3 +1,4 @@
Copyright (c) Nils Adermann, Jordi Boggiano Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
@ -17,3 +18,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.

View file

@ -26,7 +26,6 @@ return array(
'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'), 'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'),
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'), 'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'), 'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
'Symfony\\Component\\Mime\\' => array($vendorDir . '/symfony/mime'), 'Symfony\\Component\\Mime\\' => array($vendorDir . '/symfony/mime'),
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
@ -44,7 +43,6 @@ return array(
'React\\Cache\\' => array($vendorDir . '/react/cache/src'), 'React\\Cache\\' => array($vendorDir . '/react/cache/src'),
'Ratchet\\RFC6455\\' => array($vendorDir . '/ratchet/rfc6455/src'), 'Ratchet\\RFC6455\\' => array($vendorDir . '/ratchet/rfc6455/src'),
'Ratchet\\Client\\' => array($vendorDir . '/ratchet/pawl/src'), 'Ratchet\\Client\\' => array($vendorDir . '/ratchet/pawl/src'),
'Ratchet\\' => array($vendorDir . '/cboden/ratchet/src/Ratchet'),
'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'), 'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'),
'Ramsey\\Collection\\' => array($vendorDir . '/ramsey/collection/src'), 'Ramsey\\Collection\\' => array($vendorDir . '/ramsey/collection/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
@ -62,7 +60,6 @@ return array(
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'), 'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
'OneSignal\\' => array($vendorDir . '/norkunas/onesignal-php-api/src'), 'OneSignal\\' => array($vendorDir . '/norkunas/onesignal-php-api/src'),
'OTPHP\\' => array($vendorDir . '/spomky-labs/otphp/src'), 'OTPHP\\' => array($vendorDir . '/spomky-labs/otphp/src'),
'Nyholm\\Psr7\\' => array($vendorDir . '/nyholm/psr7/src'),
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'), 'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'),
'Hybridauth\\' => array($vendorDir . '/hybridauth/hybridauth/src'), 'Hybridauth\\' => array($vendorDir . '/hybridauth/hybridauth/src'),

View file

@ -31,18 +31,25 @@ class ComposerAutoloaderInitc3a61dba26daada128f5891f1a57c504
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitc3a61dba26daada128f5891f1a57c504::$files; $includeFiles = \Composer\Autoload\ComposerStaticInitc3a61dba26daada128f5891f1a57c504::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) { foreach ($includeFiles as $fileIdentifier => $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { composerRequirec3a61dba26daada128f5891f1a57c504($fileIdentifier, $file);
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequirec3a61dba26daada128f5891f1a57c504($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}

View file

@ -160,7 +160,6 @@ class ComposerStaticInitc3a61dba26daada128f5891f1a57c504
'Symfony\\Contracts\\EventDispatcher\\' => 34, 'Symfony\\Contracts\\EventDispatcher\\' => 34,
'Symfony\\Component\\Translation\\' => 30, 'Symfony\\Component\\Translation\\' => 30,
'Symfony\\Component\\String\\' => 25, 'Symfony\\Component\\String\\' => 25,
'Symfony\\Component\\Routing\\' => 26,
'Symfony\\Component\\OptionsResolver\\' => 34, 'Symfony\\Component\\OptionsResolver\\' => 34,
'Symfony\\Component\\Mime\\' => 23, 'Symfony\\Component\\Mime\\' => 23,
'Symfony\\Component\\HttpFoundation\\' => 33, 'Symfony\\Component\\HttpFoundation\\' => 33,
@ -181,7 +180,6 @@ class ComposerStaticInitc3a61dba26daada128f5891f1a57c504
'React\\Cache\\' => 12, 'React\\Cache\\' => 12,
'Ratchet\\RFC6455\\' => 16, 'Ratchet\\RFC6455\\' => 16,
'Ratchet\\Client\\' => 15, 'Ratchet\\Client\\' => 15,
'Ratchet\\' => 8,
'Ramsey\\Uuid\\' => 12, 'Ramsey\\Uuid\\' => 12,
'Ramsey\\Collection\\' => 18, 'Ramsey\\Collection\\' => 18,
), ),
@ -206,10 +204,6 @@ class ComposerStaticInitc3a61dba26daada128f5891f1a57c504
'OneSignal\\' => 10, 'OneSignal\\' => 10,
'OTPHP\\' => 6, 'OTPHP\\' => 6,
), ),
'N' =>
array (
'Nyholm\\Psr7\\' => 12,
),
'M' => 'M' =>
array ( array (
'Monolog\\' => 8, 'Monolog\\' => 8,
@ -344,10 +338,6 @@ class ComposerStaticInitc3a61dba26daada128f5891f1a57c504
array ( array (
0 => __DIR__ . '/..' . '/symfony/string', 0 => __DIR__ . '/..' . '/symfony/string',
), ),
'Symfony\\Component\\Routing\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/routing',
),
'Symfony\\Component\\OptionsResolver\\' => 'Symfony\\Component\\OptionsResolver\\' =>
array ( array (
0 => __DIR__ . '/..' . '/symfony/options-resolver', 0 => __DIR__ . '/..' . '/symfony/options-resolver',
@ -417,10 +407,6 @@ class ComposerStaticInitc3a61dba26daada128f5891f1a57c504
array ( array (
0 => __DIR__ . '/..' . '/ratchet/pawl/src', 0 => __DIR__ . '/..' . '/ratchet/pawl/src',
), ),
'Ratchet\\' =>
array (
0 => __DIR__ . '/..' . '/cboden/ratchet/src/Ratchet',
),
'Ramsey\\Uuid\\' => 'Ramsey\\Uuid\\' =>
array ( array (
0 => __DIR__ . '/..' . '/ramsey/uuid/src', 0 => __DIR__ . '/..' . '/ramsey/uuid/src',
@ -490,10 +476,6 @@ class ComposerStaticInitc3a61dba26daada128f5891f1a57c504
array ( array (
0 => __DIR__ . '/..' . '/spomky-labs/otphp/src', 0 => __DIR__ . '/..' . '/spomky-labs/otphp/src',
), ),
'Nyholm\\Psr7\\' =>
array (
0 => __DIR__ . '/..' . '/nyholm/psr7/src',
),
'Monolog\\' => 'Monolog\\' =>
array ( array (
0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog', 0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',

View file

@ -640,72 +640,6 @@
], ],
"install-path": "../carbonphp/carbon-doctrine-types" "install-path": "../carbonphp/carbon-doctrine-types"
}, },
{
"name": "cboden/ratchet",
"version": "v0.4.4",
"version_normalized": "0.4.4.0",
"source": {
"type": "git",
"url": "https://github.com/ratchetphp/Ratchet.git",
"reference": "5012dc954541b40c5599d286fd40653f5716a38f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ratchetphp/Ratchet/zipball/5012dc954541b40c5599d286fd40653f5716a38f",
"reference": "5012dc954541b40c5599d286fd40653f5716a38f",
"shasum": ""
},
"require": {
"guzzlehttp/psr7": "^1.7|^2.0",
"php": ">=5.4.2",
"ratchet/rfc6455": "^0.3.1",
"react/event-loop": ">=0.4",
"react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5",
"symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0",
"symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"time": "2021-12-14T00:20:41+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Ratchet\\": "src/Ratchet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Chris Boden",
"email": "cboden@gmail.com",
"role": "Developer"
},
{
"name": "Matt Bonneau",
"role": "Developer"
}
],
"description": "PHP WebSocket library",
"homepage": "http://socketo.me",
"keywords": [
"Ratchet",
"WebSockets",
"server",
"sockets",
"websocket"
],
"support": {
"chat": "https://gitter.im/reactphp/reactphp",
"issues": "https://github.com/ratchetphp/Ratchet/issues",
"source": "https://github.com/ratchetphp/Ratchet/tree/v0.4.4"
},
"install-path": "../cboden/ratchet"
},
{ {
"name": "chillerlan/php-qrcode", "name": "chillerlan/php-qrcode",
"version": "5.0.3", "version": "5.0.3",
@ -2632,87 +2566,6 @@
}, },
"install-path": "../norkunas/onesignal-php-api" "install-path": "../norkunas/onesignal-php-api"
}, },
{
"name": "nyholm/psr7",
"version": "1.8.2",
"version_normalized": "1.8.2.0",
"source": {
"type": "git",
"url": "https://github.com/Nyholm/psr7.git",
"reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Nyholm/psr7/zipball/a71f2b11690f4b24d099d6b16690a90ae14fc6f3",
"reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3",
"shasum": ""
},
"require": {
"php": ">=7.2",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.1 || ^2.0"
},
"provide": {
"php-http/message-factory-implementation": "1.0",
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"http-interop/http-factory-tests": "^0.9",
"php-http/message-factory": "^1.0",
"php-http/psr7-integration-tests": "^1.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
"symfony/error-handler": "^4.4"
},
"time": "2024-09-09T07:06:30+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Nyholm\\Psr7\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
},
{
"name": "Martijn van der Ven",
"email": "martijn@vanderven.se"
}
],
"description": "A fast PHP7 implementation of PSR-7",
"homepage": "https://tnyholm.se",
"keywords": [
"psr-17",
"psr-7"
],
"support": {
"issues": "https://github.com/Nyholm/psr7/issues",
"source": "https://github.com/Nyholm/psr7/tree/1.8.2"
},
"funding": [
{
"url": "https://github.com/Zegnat",
"type": "github"
},
{
"url": "https://github.com/nyholm",
"type": "github"
}
],
"install-path": "../nyholm/psr7"
},
{ {
"name": "paragonie/constant_time_encoding", "name": "paragonie/constant_time_encoding",
"version": "v2.7.0", "version": "v2.7.0",
@ -4031,28 +3884,30 @@
}, },
{ {
"name": "ratchet/rfc6455", "name": "ratchet/rfc6455",
"version": "v0.3.1", "version": "v0.4.0",
"version_normalized": "0.3.1.0", "version_normalized": "0.4.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/ratchetphp/RFC6455.git", "url": "https://github.com/ratchetphp/RFC6455.git",
"reference": "7c964514e93456a52a99a20fcfa0de242a43ccdb" "reference": "859d95f85dda0912c6d5b936d036d044e3af47ef"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ratchetphp/RFC6455/zipball/7c964514e93456a52a99a20fcfa0de242a43ccdb", "url": "https://api.github.com/repos/ratchetphp/RFC6455/zipball/859d95f85dda0912c6d5b936d036d044e3af47ef",
"reference": "7c964514e93456a52a99a20fcfa0de242a43ccdb", "reference": "859d95f85dda0912c6d5b936d036d044e3af47ef",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"guzzlehttp/psr7": "^2 || ^1.7", "php": ">=7.4",
"php": ">=5.4.2" "psr/http-factory-implementation": "^1.0",
"symfony/polyfill-php80": "^1.15"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^5.7", "guzzlehttp/psr7": "^2.7",
"phpunit/phpunit": "^9.5",
"react/socket": "^1.3" "react/socket": "^1.3"
}, },
"time": "2021-12-09T23:20:49+00:00", "time": "2025-02-24T01:18:22+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -4085,7 +3940,7 @@
"support": { "support": {
"chat": "https://gitter.im/reactphp/reactphp", "chat": "https://gitter.im/reactphp/reactphp",
"issues": "https://github.com/ratchetphp/RFC6455/issues", "issues": "https://github.com/ratchetphp/RFC6455/issues",
"source": "https://github.com/ratchetphp/RFC6455/tree/v0.3.1" "source": "https://github.com/ratchetphp/RFC6455/tree/v0.4.0"
}, },
"install-path": "../ratchet/rfc6455" "install-path": "../ratchet/rfc6455"
}, },
@ -6262,99 +6117,6 @@
], ],
"install-path": "../symfony/polyfill-php81" "install-path": "../symfony/polyfill-php81"
}, },
{
"name": "symfony/routing",
"version": "v5.4.48",
"version_normalized": "5.4.48.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "dd08c19879a9b37ff14fd30dcbdf99a4cf045db1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/dd08c19879a9b37ff14fd30dcbdf99a4cf045db1",
"reference": "dd08c19879a9b37ff14fd30dcbdf99a4cf045db1",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-php80": "^1.16"
},
"conflict": {
"doctrine/annotations": "<1.12",
"symfony/config": "<5.3",
"symfony/dependency-injection": "<4.4",
"symfony/yaml": "<4.4"
},
"require-dev": {
"doctrine/annotations": "^1.12|^2",
"psr/log": "^1|^2|^3",
"symfony/config": "^5.3|^6.0",
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
"symfony/expression-language": "^4.4|^5.0|^6.0",
"symfony/http-foundation": "^4.4|^5.0|^6.0",
"symfony/yaml": "^4.4|^5.0|^6.0"
},
"suggest": {
"symfony/config": "For using the all-in-one router or any loader",
"symfony/expression-language": "For using expression matching",
"symfony/http-foundation": "For using a Symfony Request object",
"symfony/yaml": "For using the YAML loader"
},
"time": "2024-11-12T18:20:21+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\Routing\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Maps an HTTP request to a set of configuration variables",
"homepage": "https://symfony.com",
"keywords": [
"router",
"routing",
"uri",
"url"
],
"support": {
"source": "https://github.com/symfony/routing/tree/v5.4.48"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"install-path": "../symfony/routing"
},
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
"version": "v2.5.4", "version": "v2.5.4",

View file

@ -1,409 +1,391 @@
<?php return array( <?php return array(
'root' => array( 'root' => array(
'name' => 'wwbn/avideo',
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '9c5c75cf9128c6922bf5007c1afab68370fe76da',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '8eb0a49081089de5d625fe07b0f30abb2dacb39e',
'name' => 'wwbn/avideo',
'dev' => true, 'dev' => true,
), ),
'versions' => array( 'versions' => array(
'abraham/twitteroauth' => array( 'abraham/twitteroauth' => array(
'pretty_version' => '7.0.0', 'pretty_version' => '7.0.0',
'version' => '7.0.0.0', 'version' => '7.0.0.0',
'reference' => 'a8622680f954d0c4f54fd80bedebe00c756ed7aa',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../abraham/twitteroauth', 'install_path' => __DIR__ . '/../abraham/twitteroauth',
'aliases' => array(), 'aliases' => array(),
'reference' => 'a8622680f954d0c4f54fd80bedebe00c756ed7aa',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'amphp/amp' => array( 'amphp/amp' => array(
'pretty_version' => 'v2.6.4', 'pretty_version' => 'v2.6.4',
'version' => '2.6.4.0', 'version' => '2.6.4.0',
'reference' => 'ded3d9be08f526089eb7ee8d9f16a9768f9dec2d',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../amphp/amp', 'install_path' => __DIR__ . '/../amphp/amp',
'aliases' => array(), 'aliases' => array(),
'reference' => 'ded3d9be08f526089eb7ee8d9f16a9768f9dec2d',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'ankitpokhrel/tus-php' => array( 'ankitpokhrel/tus-php' => array(
'pretty_version' => 'v2.3.0', 'pretty_version' => 'v2.3.0',
'version' => '2.3.0.0', 'version' => '2.3.0.0',
'reference' => '20671422b433aa45196f89906acf7c4328043ab8',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../ankitpokhrel/tus-php', 'install_path' => __DIR__ . '/../ankitpokhrel/tus-php',
'aliases' => array(), 'aliases' => array(),
'reference' => '20671422b433aa45196f89906acf7c4328043ab8',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'aws/aws-crt-php' => array( 'aws/aws-crt-php' => array(
'pretty_version' => 'v1.2.7', 'pretty_version' => 'v1.2.7',
'version' => '1.2.7.0', 'version' => '1.2.7.0',
'reference' => 'd71d9906c7bb63a28295447ba12e74723bd3730e',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../aws/aws-crt-php', 'install_path' => __DIR__ . '/../aws/aws-crt-php',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd71d9906c7bb63a28295447ba12e74723bd3730e',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'aws/aws-sdk-php' => array( 'aws/aws-sdk-php' => array(
'pretty_version' => '3.337.3', 'pretty_version' => '3.337.3',
'version' => '3.337.3.0', 'version' => '3.337.3.0',
'reference' => '06dfc8f76423b49aaa181debd25bbdc724c346d6',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../aws/aws-sdk-php', 'install_path' => __DIR__ . '/../aws/aws-sdk-php',
'aliases' => array(), 'aliases' => array(),
'reference' => '06dfc8f76423b49aaa181debd25bbdc724c346d6',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'beberlei/assert' => array( 'beberlei/assert' => array(
'pretty_version' => 'v3.3.3', 'pretty_version' => 'v3.3.3',
'version' => '3.3.3.0', 'version' => '3.3.3.0',
'reference' => 'b5fd8eacd8915a1b627b8bfc027803f1939734dd',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../beberlei/assert', 'install_path' => __DIR__ . '/../beberlei/assert',
'aliases' => array(), 'aliases' => array(),
'reference' => 'b5fd8eacd8915a1b627b8bfc027803f1939734dd',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'brick/math' => array( 'brick/math' => array(
'pretty_version' => '0.11.0', 'pretty_version' => '0.11.0',
'version' => '0.11.0.0', 'version' => '0.11.0.0',
'reference' => '0ad82ce168c82ba30d1c01ec86116ab52f589478',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../brick/math', 'install_path' => __DIR__ . '/../brick/math',
'aliases' => array(), 'aliases' => array(),
'reference' => '0ad82ce168c82ba30d1c01ec86116ab52f589478',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'bunnycdn/storage' => array( 'bunnycdn/storage' => array(
'pretty_version' => '3.4.0', 'pretty_version' => '3.4.0',
'version' => '3.4.0.0', 'version' => '3.4.0.0',
'reference' => 'a7709849f6779b85d2871a43a12fcd452b970c25',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../bunnycdn/storage', 'install_path' => __DIR__ . '/../bunnycdn/storage',
'aliases' => array(), 'aliases' => array(),
'reference' => 'a7709849f6779b85d2871a43a12fcd452b970c25',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'carbonphp/carbon-doctrine-types' => array( 'carbonphp/carbon-doctrine-types' => array(
'pretty_version' => '2.1.0', 'pretty_version' => '2.1.0',
'version' => '2.1.0.0', 'version' => '2.1.0.0',
'reference' => '99f76ffa36cce3b70a4a6abce41dba15ca2e84cb',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../carbonphp/carbon-doctrine-types', 'install_path' => __DIR__ . '/../carbonphp/carbon-doctrine-types',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'reference' => '99f76ffa36cce3b70a4a6abce41dba15ca2e84cb',
),
'cboden/ratchet' => array(
'pretty_version' => 'v0.4.4',
'version' => '0.4.4.0',
'reference' => '5012dc954541b40c5599d286fd40653f5716a38f',
'type' => 'library',
'install_path' => __DIR__ . '/../cboden/ratchet',
'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'chillerlan/php-qrcode' => array( 'chillerlan/php-qrcode' => array(
'pretty_version' => '5.0.3', 'pretty_version' => '5.0.3',
'version' => '5.0.3.0', 'version' => '5.0.3.0',
'reference' => '42e215640e9ebdd857570c9e4e52245d1ee51de2',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../chillerlan/php-qrcode', 'install_path' => __DIR__ . '/../chillerlan/php-qrcode',
'aliases' => array(), 'aliases' => array(),
'reference' => '42e215640e9ebdd857570c9e4e52245d1ee51de2',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'chillerlan/php-settings-container' => array( 'chillerlan/php-settings-container' => array(
'pretty_version' => '2.1.6', 'pretty_version' => '2.1.6',
'version' => '2.1.6.0', 'version' => '2.1.6.0',
'reference' => '5553558bd381fce5108c6d0343c12e488cfec6bb',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../chillerlan/php-settings-container', 'install_path' => __DIR__ . '/../chillerlan/php-settings-container',
'aliases' => array(), 'aliases' => array(),
'reference' => '5553558bd381fce5108c6d0343c12e488cfec6bb',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'chrisjean/php-ico' => array( 'chrisjean/php-ico' => array(
'pretty_version' => '1.0.4', 'pretty_version' => '1.0.4',
'version' => '1.0.4.0', 'version' => '1.0.4.0',
'reference' => 'ccd5c0d56554f3ddcd7a823e695be83e0d1e43b6',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../chrisjean/php-ico', 'install_path' => __DIR__ . '/../chrisjean/php-ico',
'aliases' => array(), 'aliases' => array(),
'reference' => 'ccd5c0d56554f3ddcd7a823e695be83e0d1e43b6',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'christian-riesen/base32' => array( 'christian-riesen/base32' => array(
'pretty_version' => '1.6.0', 'pretty_version' => '1.6.0',
'version' => '1.6.0.0', 'version' => '1.6.0.0',
'reference' => '2e82dab3baa008e24a505649b0d583c31d31e894',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../christian-riesen/base32', 'install_path' => __DIR__ . '/../christian-riesen/base32',
'aliases' => array(), 'aliases' => array(),
'reference' => '2e82dab3baa008e24a505649b0d583c31d31e894',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'composer/ca-bundle' => array( 'composer/ca-bundle' => array(
'pretty_version' => '1.5.6', 'pretty_version' => '1.5.6',
'version' => '1.5.6.0', 'version' => '1.5.6.0',
'reference' => 'f65c239c970e7f072f067ab78646e9f0b2935175',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/./ca-bundle', 'install_path' => __DIR__ . '/./ca-bundle',
'aliases' => array(), 'aliases' => array(),
'reference' => 'f65c239c970e7f072f067ab78646e9f0b2935175',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'elephantio/elephant.io' => array( 'elephantio/elephant.io' => array(
'pretty_version' => 'v4.13.0', 'pretty_version' => 'v4.13.0',
'version' => '4.13.0.0', 'version' => '4.13.0.0',
'reference' => 'a176c8acece9627ac9dc094ca61129233a2856e8',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../elephantio/elephant.io', 'install_path' => __DIR__ . '/../elephantio/elephant.io',
'aliases' => array(), 'aliases' => array(),
'reference' => 'a176c8acece9627ac9dc094ca61129233a2856e8',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'emojione/assets' => array( 'emojione/assets' => array(
'pretty_version' => '4.5', 'pretty_version' => '4.5',
'version' => '4.5.0.0', 'version' => '4.5.0.0',
'reference' => '88478c659a64af0176c7b0cd0778f1f9cb8f916f',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../emojione/assets', 'install_path' => __DIR__ . '/../emojione/assets',
'aliases' => array(), 'aliases' => array(),
'reference' => '88478c659a64af0176c7b0cd0778f1f9cb8f916f',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'emojione/emojione' => array( 'emojione/emojione' => array(
'pretty_version' => '4.5.0', 'pretty_version' => '4.5.0',
'version' => '4.5.0.0', 'version' => '4.5.0.0',
'reference' => '79e685356877cbb6128074a71b7f88f435b58412',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../emojione/emojione', 'install_path' => __DIR__ . '/../emojione/emojione',
'aliases' => array(), 'aliases' => array(),
'reference' => '79e685356877cbb6128074a71b7f88f435b58412',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'erusev/parsedown' => array( 'erusev/parsedown' => array(
'pretty_version' => '1.7.4', 'pretty_version' => '1.7.4',
'version' => '1.7.4.0', 'version' => '1.7.4.0',
'reference' => 'cb17b6477dfff935958ba01325f2e8a2bfa6dab3',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../erusev/parsedown', 'install_path' => __DIR__ . '/../erusev/parsedown',
'aliases' => array(), 'aliases' => array(),
'reference' => 'cb17b6477dfff935958ba01325f2e8a2bfa6dab3',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'evenement/evenement' => array( 'evenement/evenement' => array(
'pretty_version' => 'v3.0.2', 'pretty_version' => 'v3.0.2',
'version' => '3.0.2.0', 'version' => '3.0.2.0',
'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../evenement/evenement', 'install_path' => __DIR__ . '/../evenement/evenement',
'aliases' => array(), 'aliases' => array(),
'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'ezyang/htmlpurifier' => array( 'ezyang/htmlpurifier' => array(
'pretty_version' => 'v4.18.0', 'pretty_version' => 'v4.18.0',
'version' => '4.18.0.0', 'version' => '4.18.0.0',
'reference' => 'cb56001e54359df7ae76dc522d08845dc741621b',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../ezyang/htmlpurifier', 'install_path' => __DIR__ . '/../ezyang/htmlpurifier',
'aliases' => array(), 'aliases' => array(),
'reference' => 'cb56001e54359df7ae76dc522d08845dc741621b',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'firebase/php-jwt' => array( 'firebase/php-jwt' => array(
'pretty_version' => 'v6.11.0', 'pretty_version' => 'v6.11.0',
'version' => '6.11.0.0', 'version' => '6.11.0.0',
'reference' => '8f718f4dfc9c5d5f0c994cdfd103921b43592712',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../firebase/php-jwt', 'install_path' => __DIR__ . '/../firebase/php-jwt',
'aliases' => array(), 'aliases' => array(),
'reference' => '8f718f4dfc9c5d5f0c994cdfd103921b43592712',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'gliterd/backblaze-b2' => array( 'gliterd/backblaze-b2' => array(
'pretty_version' => '1.5.4', 'pretty_version' => '1.5.4',
'version' => '1.5.4.0', 'version' => '1.5.4.0',
'reference' => '3abcf1ae5b093199c230d4ad82d64fb16ea4fd1a',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../gliterd/backblaze-b2', 'install_path' => __DIR__ . '/../gliterd/backblaze-b2',
'aliases' => array(), 'aliases' => array(),
'reference' => '3abcf1ae5b093199c230d4ad82d64fb16ea4fd1a',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'google/apiclient' => array( 'google/apiclient' => array(
'pretty_version' => 'v2.18.2', 'pretty_version' => 'v2.18.2',
'version' => '2.18.2.0', 'version' => '2.18.2.0',
'reference' => 'd8d201ba8a189a3cd7fb34e4da569f2ed440eee7',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../google/apiclient', 'install_path' => __DIR__ . '/../google/apiclient',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd8d201ba8a189a3cd7fb34e4da569f2ed440eee7',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'google/apiclient-services' => array( 'google/apiclient-services' => array(
'pretty_version' => 'v0.396.0', 'pretty_version' => 'v0.396.0',
'version' => '0.396.0.0', 'version' => '0.396.0.0',
'reference' => 'ceb2e432e4326c6775d24f62d554395a1a9ad3dd',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../google/apiclient-services', 'install_path' => __DIR__ . '/../google/apiclient-services',
'aliases' => array(), 'aliases' => array(),
'reference' => 'ceb2e432e4326c6775d24f62d554395a1a9ad3dd',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'google/auth' => array( 'google/auth' => array(
'pretty_version' => 'v1.46.0', 'pretty_version' => 'v1.46.0',
'version' => '1.46.0.0', 'version' => '1.46.0.0',
'reference' => '7fafae99a41984cbfb92508174263cf7bf3049b9',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../google/auth', 'install_path' => __DIR__ . '/../google/auth',
'aliases' => array(), 'aliases' => array(),
'reference' => '7fafae99a41984cbfb92508174263cf7bf3049b9',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'guzzlehttp/guzzle' => array( 'guzzlehttp/guzzle' => array(
'pretty_version' => '7.9.2', 'pretty_version' => '7.9.2',
'version' => '7.9.2.0', 'version' => '7.9.2.0',
'reference' => 'd281ed313b989f213357e3be1a179f02196ac99b',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd281ed313b989f213357e3be1a179f02196ac99b',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'guzzlehttp/promises' => array( 'guzzlehttp/promises' => array(
'pretty_version' => '2.0.4', 'pretty_version' => '2.0.4',
'version' => '2.0.4.0', 'version' => '2.0.4.0',
'reference' => 'f9c436286ab2892c7db7be8c8da4ef61ccf7b455',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises', 'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(), 'aliases' => array(),
'reference' => 'f9c436286ab2892c7db7be8c8da4ef61ccf7b455',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'guzzlehttp/psr7' => array( 'guzzlehttp/psr7' => array(
'pretty_version' => '2.7.0', 'pretty_version' => '2.7.0',
'version' => '2.7.0.0', 'version' => '2.7.0.0',
'reference' => 'a70f5c95fb43bc83f07c9c948baa0dc1829bf201',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(), 'aliases' => array(),
'reference' => 'a70f5c95fb43bc83f07c9c948baa0dc1829bf201',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'hybridauth/hybridauth' => array( 'hybridauth/hybridauth' => array(
'pretty_version' => 'v3.11.0', 'pretty_version' => 'v3.11.0',
'version' => '3.11.0.0', 'version' => '3.11.0.0',
'reference' => 'b70b9cbe1c7fa99b5847c5868610a8f024cc7d38',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../hybridauth/hybridauth', 'install_path' => __DIR__ . '/../hybridauth/hybridauth',
'aliases' => array(), 'aliases' => array(),
'reference' => 'b70b9cbe1c7fa99b5847c5868610a8f024cc7d38',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'iamcal/sql-parser' => array( 'iamcal/sql-parser' => array(
'pretty_version' => 'v0.6', 'pretty_version' => 'v0.6',
'version' => '0.6.0.0', 'version' => '0.6.0.0',
'reference' => '947083e2dca211a6f12fb1beb67a01e387de9b62',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../iamcal/sql-parser', 'install_path' => __DIR__ . '/../iamcal/sql-parser',
'aliases' => array(), 'aliases' => array(),
'reference' => '947083e2dca211a6f12fb1beb67a01e387de9b62',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'james-heinrich/getid3' => array( 'james-heinrich/getid3' => array(
'pretty_version' => 'v1.9.23', 'pretty_version' => 'v1.9.23',
'version' => '1.9.23.0', 'version' => '1.9.23.0',
'reference' => '06c7482532ff2b3f9111b011d880ca6699c8542b',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../james-heinrich/getid3', 'install_path' => __DIR__ . '/../james-heinrich/getid3',
'aliases' => array(), 'aliases' => array(),
'reference' => '06c7482532ff2b3f9111b011d880ca6699c8542b',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'mervick/emojionearea' => array( 'mervick/emojionearea' => array(
'pretty_version' => 'v3.4.2', 'pretty_version' => 'v3.4.2',
'version' => '3.4.2.0', 'version' => '3.4.2.0',
'reference' => '99129f789f2e7619ce553c038783a13f47cbc846',
'type' => 'plugin', 'type' => 'plugin',
'install_path' => __DIR__ . '/../mervick/emojionearea', 'install_path' => __DIR__ . '/../mervick/emojionearea',
'aliases' => array(), 'aliases' => array(),
'reference' => '99129f789f2e7619ce553c038783a13f47cbc846',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'monolog/monolog' => array( 'monolog/monolog' => array(
'pretty_version' => '2.10.0', 'pretty_version' => '2.10.0',
'version' => '2.10.0.0', 'version' => '2.10.0.0',
'reference' => '5cf826f2991858b54d5c3809bee745560a1042a7',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../monolog/monolog', 'install_path' => __DIR__ . '/../monolog/monolog',
'aliases' => array(), 'aliases' => array(),
'reference' => '5cf826f2991858b54d5c3809bee745560a1042a7',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'mtdowling/jmespath.php' => array( 'mtdowling/jmespath.php' => array(
'pretty_version' => '2.8.0', 'pretty_version' => '2.8.0',
'version' => '2.8.0.0', 'version' => '2.8.0.0',
'reference' => 'a2a865e05d5f420b50cc2f85bb78d565db12a6bc',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../mtdowling/jmespath.php', 'install_path' => __DIR__ . '/../mtdowling/jmespath.php',
'aliases' => array(), 'aliases' => array(),
'reference' => 'a2a865e05d5f420b50cc2f85bb78d565db12a6bc',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'nesbot/carbon' => array( 'nesbot/carbon' => array(
'pretty_version' => '2.73.0', 'pretty_version' => '2.73.0',
'version' => '2.73.0.0', 'version' => '2.73.0.0',
'reference' => '9228ce90e1035ff2f0db84b40ec2e023ed802075',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../nesbot/carbon', 'install_path' => __DIR__ . '/../nesbot/carbon',
'aliases' => array(), 'aliases' => array(),
'reference' => '9228ce90e1035ff2f0db84b40ec2e023ed802075',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'norkunas/onesignal-php-api' => array( 'norkunas/onesignal-php-api' => array(
'pretty_version' => 'v2.15.0', 'pretty_version' => 'v2.15.0',
'version' => '2.15.0.0', 'version' => '2.15.0.0',
'reference' => '1f6db112bb535d451c9cb78020725a18f826b364',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../norkunas/onesignal-php-api', 'install_path' => __DIR__ . '/../norkunas/onesignal-php-api',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'reference' => '1f6db112bb535d451c9cb78020725a18f826b364',
),
'nyholm/psr7' => array(
'pretty_version' => '1.8.2',
'version' => '1.8.2.0',
'reference' => 'a71f2b11690f4b24d099d6b16690a90ae14fc6f3',
'type' => 'library',
'install_path' => __DIR__ . '/../nyholm/psr7',
'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'paragonie/constant_time_encoding' => array( 'paragonie/constant_time_encoding' => array(
'pretty_version' => 'v2.7.0', 'pretty_version' => 'v2.7.0',
'version' => '2.7.0.0', 'version' => '2.7.0.0',
'reference' => '52a0d99e69f56b9ec27ace92ba56897fe6993105',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/constant_time_encoding', 'install_path' => __DIR__ . '/../paragonie/constant_time_encoding',
'aliases' => array(), 'aliases' => array(),
'reference' => '52a0d99e69f56b9ec27ace92ba56897fe6993105',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'paragonie/random_compat' => array( 'paragonie/random_compat' => array(
'pretty_version' => 'v9.99.100', 'pretty_version' => 'v9.99.100',
'version' => '9.99.100.0', 'version' => '9.99.100.0',
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/random_compat', 'install_path' => __DIR__ . '/../paragonie/random_compat',
'aliases' => array(), 'aliases' => array(),
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'paypal/paypal-checkout-sdk' => array( 'paypal/paypal-checkout-sdk' => array(
'pretty_version' => '1.0.2', 'pretty_version' => '1.0.2',
'version' => '1.0.2.0', 'version' => '1.0.2.0',
'reference' => '19992ce7051ff9e47e643f28abb8cc1b3e5f1812',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../paypal/paypal-checkout-sdk', 'install_path' => __DIR__ . '/../paypal/paypal-checkout-sdk',
'aliases' => array(), 'aliases' => array(),
'reference' => '19992ce7051ff9e47e643f28abb8cc1b3e5f1812',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'paypal/paypal-payouts-sdk' => array( 'paypal/paypal-payouts-sdk' => array(
'pretty_version' => '1.0.1', 'pretty_version' => '1.0.1',
'version' => '1.0.1.0', 'version' => '1.0.1.0',
'reference' => '3bdafe3d79b08bb4c3467f911adc1601300b7149',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../paypal/paypal-payouts-sdk', 'install_path' => __DIR__ . '/../paypal/paypal-payouts-sdk',
'aliases' => array(), 'aliases' => array(),
'reference' => '3bdafe3d79b08bb4c3467f911adc1601300b7149',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'paypal/paypalhttp' => array( 'paypal/paypalhttp' => array(
'pretty_version' => '1.0.1', 'pretty_version' => '1.0.1',
'version' => '1.0.1.0', 'version' => '1.0.1.0',
'reference' => '7b09c89c80828e842c79230e7f156b61fbb68d25',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../paypal/paypalhttp', 'install_path' => __DIR__ . '/../paypal/paypalhttp',
'aliases' => array(), 'aliases' => array(),
'reference' => '7b09c89c80828e842c79230e7f156b61fbb68d25',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'paypal/rest-api-sdk-php' => array( 'paypal/rest-api-sdk-php' => array(
'pretty_version' => 'v1.6.4', 'pretty_version' => 'v1.6.4',
'version' => '1.6.4.0', 'version' => '1.6.4.0',
'reference' => '06837d290c4906578cfd92786412dff330a1429c',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../paypal/rest-api-sdk-php', 'install_path' => __DIR__ . '/../paypal/rest-api-sdk-php',
'aliases' => array(), 'aliases' => array(),
'reference' => '06837d290c4906578cfd92786412dff330a1429c',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'php-http/async-client-implementation' => array( 'php-http/async-client-implementation' => array(
@ -418,55 +400,49 @@
0 => '*', 0 => '*',
), ),
), ),
'php-http/message-factory-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0',
),
),
'phpmailer/phpmailer' => array( 'phpmailer/phpmailer' => array(
'pretty_version' => 'v6.9.3', 'pretty_version' => 'v6.9.3',
'version' => '6.9.3.0', 'version' => '6.9.3.0',
'reference' => '2f5c94fe7493efc213f643c23b1b1c249d40f47e',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../phpmailer/phpmailer', 'install_path' => __DIR__ . '/../phpmailer/phpmailer',
'aliases' => array(), 'aliases' => array(),
'reference' => '2f5c94fe7493efc213f643c23b1b1c249d40f47e',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'phpseclib/phpseclib' => array( 'phpseclib/phpseclib' => array(
'pretty_version' => '3.0.43', 'pretty_version' => '3.0.43',
'version' => '3.0.43.0', 'version' => '3.0.43.0',
'reference' => '709ec107af3cb2f385b9617be72af8cf62441d02',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../phpseclib/phpseclib', 'install_path' => __DIR__ . '/../phpseclib/phpseclib',
'aliases' => array(), 'aliases' => array(),
'reference' => '709ec107af3cb2f385b9617be72af8cf62441d02',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'predis/predis' => array( 'predis/predis' => array(
'pretty_version' => 'v2.3.0', 'pretty_version' => 'v2.3.0',
'version' => '2.3.0.0', 'version' => '2.3.0.0',
'reference' => 'bac46bfdb78cd6e9c7926c697012aae740cb9ec9',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../predis/predis', 'install_path' => __DIR__ . '/../predis/predis',
'aliases' => array(), 'aliases' => array(),
'reference' => 'bac46bfdb78cd6e9c7926c697012aae740cb9ec9',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/cache' => array( 'psr/cache' => array(
'pretty_version' => '3.0.0', 'pretty_version' => '3.0.0',
'version' => '3.0.0.0', 'version' => '3.0.0.0',
'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/cache', 'install_path' => __DIR__ . '/../psr/cache',
'aliases' => array(), 'aliases' => array(),
'reference' => 'aa5030cfa5405eccfdcb1083ce040c2cb8d253bf',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/clock' => array( 'psr/clock' => array(
'pretty_version' => '1.0.0', 'pretty_version' => '1.0.0',
'version' => '1.0.0.0', 'version' => '1.0.0.0',
'reference' => 'e41a24703d4560fd0acb709162f73b8adfc3aa0d',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/clock', 'install_path' => __DIR__ . '/../psr/clock',
'aliases' => array(), 'aliases' => array(),
'reference' => 'e41a24703d4560fd0acb709162f73b8adfc3aa0d',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/clock-implementation' => array( 'psr/clock-implementation' => array(
@ -478,19 +454,19 @@
'psr/container' => array( 'psr/container' => array(
'pretty_version' => '1.1.2', 'pretty_version' => '1.1.2',
'version' => '1.1.2.0', 'version' => '1.1.2.0',
'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/container', 'install_path' => __DIR__ . '/../psr/container',
'aliases' => array(), 'aliases' => array(),
'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/event-dispatcher' => array( 'psr/event-dispatcher' => array(
'pretty_version' => '1.0.0', 'pretty_version' => '1.0.0',
'version' => '1.0.0.0', 'version' => '1.0.0.0',
'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/event-dispatcher', 'install_path' => __DIR__ . '/../psr/event-dispatcher',
'aliases' => array(), 'aliases' => array(),
'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/event-dispatcher-implementation' => array( 'psr/event-dispatcher-implementation' => array(
@ -502,10 +478,10 @@
'psr/http-client' => array( 'psr/http-client' => array(
'pretty_version' => '1.0.3', 'pretty_version' => '1.0.3',
'version' => '1.0.3.0', 'version' => '1.0.3.0',
'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-client', 'install_path' => __DIR__ . '/../psr/http-client',
'aliases' => array(), 'aliases' => array(),
'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/http-client-implementation' => array( 'psr/http-client-implementation' => array(
@ -517,10 +493,10 @@
'psr/http-factory' => array( 'psr/http-factory' => array(
'pretty_version' => '1.1.0', 'pretty_version' => '1.1.0',
'version' => '1.1.0.0', 'version' => '1.1.0.0',
'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-factory', 'install_path' => __DIR__ . '/../psr/http-factory',
'aliases' => array(), 'aliases' => array(),
'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/http-factory-implementation' => array( 'psr/http-factory-implementation' => array(
@ -532,10 +508,10 @@
'psr/http-message' => array( 'psr/http-message' => array(
'pretty_version' => '2.0', 'pretty_version' => '2.0',
'version' => '2.0.0.0', 'version' => '2.0.0.0',
'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message', 'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(), 'aliases' => array(),
'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/http-message-implementation' => array( 'psr/http-message-implementation' => array(
@ -547,10 +523,10 @@
'psr/log' => array( 'psr/log' => array(
'pretty_version' => '3.0.2', 'pretty_version' => '3.0.2',
'version' => '3.0.2.0', 'version' => '3.0.2.0',
'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../psr/log', 'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(), 'aliases' => array(),
'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'psr/log-implementation' => array( 'psr/log-implementation' => array(
@ -563,100 +539,100 @@
'ralouphie/getallheaders' => array( 'ralouphie/getallheaders' => array(
'pretty_version' => '3.0.3', 'pretty_version' => '3.0.3',
'version' => '3.0.3.0', 'version' => '3.0.3.0',
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../ralouphie/getallheaders', 'install_path' => __DIR__ . '/../ralouphie/getallheaders',
'aliases' => array(), 'aliases' => array(),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'ramsey/collection' => array( 'ramsey/collection' => array(
'pretty_version' => '1.3.0', 'pretty_version' => '1.3.0',
'version' => '1.3.0.0', 'version' => '1.3.0.0',
'reference' => 'ad7475d1c9e70b190ecffc58f2d989416af339b4',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../ramsey/collection', 'install_path' => __DIR__ . '/../ramsey/collection',
'aliases' => array(), 'aliases' => array(),
'reference' => 'ad7475d1c9e70b190ecffc58f2d989416af339b4',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'ramsey/uuid' => array( 'ramsey/uuid' => array(
'pretty_version' => '4.7.6', 'pretty_version' => '4.7.6',
'version' => '4.7.6.0', 'version' => '4.7.6.0',
'reference' => '91039bc1faa45ba123c4328958e620d382ec7088',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../ramsey/uuid', 'install_path' => __DIR__ . '/../ramsey/uuid',
'aliases' => array(), 'aliases' => array(),
'reference' => '91039bc1faa45ba123c4328958e620d382ec7088',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'ratchet/pawl' => array( 'ratchet/pawl' => array(
'pretty_version' => 'v0.4.3', 'pretty_version' => 'v0.4.3',
'version' => '0.4.3.0', 'version' => '0.4.3.0',
'reference' => '2c582373c78271de32cb04c755c4c0db7e09c9c0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../ratchet/pawl', 'install_path' => __DIR__ . '/../ratchet/pawl',
'aliases' => array(), 'aliases' => array(),
'reference' => '2c582373c78271de32cb04c755c4c0db7e09c9c0',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'ratchet/rfc6455' => array( 'ratchet/rfc6455' => array(
'pretty_version' => 'v0.3.1', 'pretty_version' => 'v0.4.0',
'version' => '0.3.1.0', 'version' => '0.4.0.0',
'reference' => '7c964514e93456a52a99a20fcfa0de242a43ccdb',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../ratchet/rfc6455', 'install_path' => __DIR__ . '/../ratchet/rfc6455',
'aliases' => array(), 'aliases' => array(),
'reference' => '859d95f85dda0912c6d5b936d036d044e3af47ef',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'react/cache' => array( 'react/cache' => array(
'pretty_version' => 'v1.2.0', 'pretty_version' => 'v1.2.0',
'version' => '1.2.0.0', 'version' => '1.2.0.0',
'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../react/cache', 'install_path' => __DIR__ . '/../react/cache',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'react/dns' => array( 'react/dns' => array(
'pretty_version' => 'v1.13.0', 'pretty_version' => 'v1.13.0',
'version' => '1.13.0.0', 'version' => '1.13.0.0',
'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../react/dns', 'install_path' => __DIR__ . '/../react/dns',
'aliases' => array(), 'aliases' => array(),
'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'react/event-loop' => array( 'react/event-loop' => array(
'pretty_version' => 'v1.5.0', 'pretty_version' => 'v1.5.0',
'version' => '1.5.0.0', 'version' => '1.5.0.0',
'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../react/event-loop', 'install_path' => __DIR__ . '/../react/event-loop',
'aliases' => array(), 'aliases' => array(),
'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'react/promise' => array( 'react/promise' => array(
'pretty_version' => 'v3.2.0', 'pretty_version' => 'v3.2.0',
'version' => '3.2.0.0', 'version' => '3.2.0.0',
'reference' => '8a164643313c71354582dc850b42b33fa12a4b63',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../react/promise', 'install_path' => __DIR__ . '/../react/promise',
'aliases' => array(), 'aliases' => array(),
'reference' => '8a164643313c71354582dc850b42b33fa12a4b63',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'react/socket' => array( 'react/socket' => array(
'pretty_version' => 'v1.16.0', 'pretty_version' => 'v1.16.0',
'version' => '1.16.0.0', 'version' => '1.16.0.0',
'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../react/socket', 'install_path' => __DIR__ . '/../react/socket',
'aliases' => array(), 'aliases' => array(),
'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'react/stream' => array( 'react/stream' => array(
'pretty_version' => 'v1.4.0', 'pretty_version' => 'v1.4.0',
'version' => '1.4.0.0', 'version' => '1.4.0.0',
'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../react/stream', 'install_path' => __DIR__ . '/../react/stream',
'aliases' => array(), 'aliases' => array(),
'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'rhumsaa/uuid' => array( 'rhumsaa/uuid' => array(
@ -668,73 +644,73 @@
'scssphp/scssphp' => array( 'scssphp/scssphp' => array(
'pretty_version' => 'v1.13.0', 'pretty_version' => 'v1.13.0',
'version' => '1.13.0.0', 'version' => '1.13.0.0',
'reference' => '63d1157457e5554edf00b0c1fabab4c1511d2520',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../scssphp/scssphp', 'install_path' => __DIR__ . '/../scssphp/scssphp',
'aliases' => array(), 'aliases' => array(),
'reference' => '63d1157457e5554edf00b0c1fabab4c1511d2520',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'singpolyma/openpgp-php' => array( 'singpolyma/openpgp-php' => array(
'pretty_version' => '0.7.0', 'pretty_version' => '0.7.0',
'version' => '0.7.0.0', 'version' => '0.7.0.0',
'reference' => 'b55996c1942bf676d4531c9b4c0ed226f7fe2b60',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../singpolyma/openpgp-php', 'install_path' => __DIR__ . '/../singpolyma/openpgp-php',
'aliases' => array(), 'aliases' => array(),
'reference' => 'b55996c1942bf676d4531c9b4c0ed226f7fe2b60',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'spomky-labs/otphp' => array( 'spomky-labs/otphp' => array(
'pretty_version' => 'v10.0.3', 'pretty_version' => 'v10.0.3',
'version' => '10.0.3.0', 'version' => '10.0.3.0',
'reference' => '9784d9f7c790eed26e102d6c78f12c754036c366',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../spomky-labs/otphp', 'install_path' => __DIR__ . '/../spomky-labs/otphp',
'aliases' => array(), 'aliases' => array(),
'reference' => '9784d9f7c790eed26e102d6c78f12c754036c366',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'stripe/stripe-php' => array( 'stripe/stripe-php' => array(
'pretty_version' => 'v16.6.0', 'pretty_version' => 'v16.6.0',
'version' => '16.6.0.0', 'version' => '16.6.0.0',
'reference' => 'd6de0a536f00b5c5c74f36b8f4d0d93b035499ff',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../stripe/stripe-php', 'install_path' => __DIR__ . '/../stripe/stripe-php',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd6de0a536f00b5c5c74f36b8f4d0d93b035499ff',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/console' => array( 'symfony/console' => array(
'pretty_version' => 'v5.3.16', 'pretty_version' => 'v5.3.16',
'version' => '5.3.16.0', 'version' => '5.3.16.0',
'reference' => '2e322c76cdccb302af6b275ea2207169c8355328',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/console', 'install_path' => __DIR__ . '/../symfony/console',
'aliases' => array(), 'aliases' => array(),
'reference' => '2e322c76cdccb302af6b275ea2207169c8355328',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/deprecation-contracts' => array( 'symfony/deprecation-contracts' => array(
'pretty_version' => 'v2.5.4', 'pretty_version' => 'v2.5.4',
'version' => '2.5.4.0', 'version' => '2.5.4.0',
'reference' => '605389f2a7e5625f273b53960dc46aeaf9c62918',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(), 'aliases' => array(),
'reference' => '605389f2a7e5625f273b53960dc46aeaf9c62918',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/event-dispatcher' => array( 'symfony/event-dispatcher' => array(
'pretty_version' => 'v5.4.45', 'pretty_version' => 'v5.4.45',
'version' => '5.4.45.0', 'version' => '5.4.45.0',
'reference' => '72982eb416f61003e9bb6e91f8b3213600dcf9e9',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher', 'install_path' => __DIR__ . '/../symfony/event-dispatcher',
'aliases' => array(), 'aliases' => array(),
'reference' => '72982eb416f61003e9bb6e91f8b3213600dcf9e9',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/event-dispatcher-contracts' => array( 'symfony/event-dispatcher-contracts' => array(
'pretty_version' => 'v2.5.4', 'pretty_version' => 'v2.5.4',
'version' => '2.5.4.0', 'version' => '2.5.4.0',
'reference' => 'e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts', 'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts',
'aliases' => array(), 'aliases' => array(),
'reference' => 'e0fe3d79b516eb75126ac6fa4cbf19b79b08c99f',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/event-dispatcher-implementation' => array( 'symfony/event-dispatcher-implementation' => array(
@ -746,19 +722,19 @@
'symfony/http-client' => array( 'symfony/http-client' => array(
'pretty_version' => 'v5.4.49', 'pretty_version' => 'v5.4.49',
'version' => '5.4.49.0', 'version' => '5.4.49.0',
'reference' => 'd77d8e212cde7b5c4a64142bf431522f19487c28',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-client', 'install_path' => __DIR__ . '/../symfony/http-client',
'aliases' => array(), 'aliases' => array(),
'reference' => 'd77d8e212cde7b5c4a64142bf431522f19487c28',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/http-client-contracts' => array( 'symfony/http-client-contracts' => array(
'pretty_version' => 'v2.5.5', 'pretty_version' => 'v2.5.5',
'version' => '2.5.5.0', 'version' => '2.5.5.0',
'reference' => '48ef1d0a082885877b664332b9427662065a360c',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-client-contracts', 'install_path' => __DIR__ . '/../symfony/http-client-contracts',
'aliases' => array(), 'aliases' => array(),
'reference' => '48ef1d0a082885877b664332b9427662065a360c',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/http-client-implementation' => array( 'symfony/http-client-implementation' => array(
@ -770,145 +746,136 @@
'symfony/http-foundation' => array( 'symfony/http-foundation' => array(
'pretty_version' => 'v5.4.48', 'pretty_version' => 'v5.4.48',
'version' => '5.4.48.0', 'version' => '5.4.48.0',
'reference' => '3f38b8af283b830e1363acd79e5bc3412d055341',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-foundation', 'install_path' => __DIR__ . '/../symfony/http-foundation',
'aliases' => array(), 'aliases' => array(),
'reference' => '3f38b8af283b830e1363acd79e5bc3412d055341',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/mime' => array( 'symfony/mime' => array(
'pretty_version' => 'v5.4.45', 'pretty_version' => 'v5.4.45',
'version' => '5.4.45.0', 'version' => '5.4.45.0',
'reference' => '8c1b9b3e5b52981551fc6044539af1d974e39064',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/mime', 'install_path' => __DIR__ . '/../symfony/mime',
'aliases' => array(), 'aliases' => array(),
'reference' => '8c1b9b3e5b52981551fc6044539af1d974e39064',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/options-resolver' => array( 'symfony/options-resolver' => array(
'pretty_version' => 'v5.4.45', 'pretty_version' => 'v5.4.45',
'version' => '5.4.45.0', 'version' => '5.4.45.0',
'reference' => '74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/options-resolver', 'install_path' => __DIR__ . '/../symfony/options-resolver',
'aliases' => array(), 'aliases' => array(),
'reference' => '74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-ctype' => array( 'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.31.0', 'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0', 'version' => '1.31.0.0',
'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype', 'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(), 'aliases' => array(),
'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-intl-grapheme' => array( 'symfony/polyfill-intl-grapheme' => array(
'pretty_version' => 'v1.31.0', 'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0', 'version' => '1.31.0.0',
'reference' => 'b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme', 'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
'aliases' => array(), 'aliases' => array(),
'reference' => 'b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-intl-idn' => array( 'symfony/polyfill-intl-idn' => array(
'pretty_version' => 'v1.31.0', 'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0', 'version' => '1.31.0.0',
'reference' => 'c36586dcf89a12315939e00ec9b4474adcb1d773',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-idn', 'install_path' => __DIR__ . '/../symfony/polyfill-intl-idn',
'aliases' => array(), 'aliases' => array(),
'reference' => 'c36586dcf89a12315939e00ec9b4474adcb1d773',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-intl-normalizer' => array( 'symfony/polyfill-intl-normalizer' => array(
'pretty_version' => 'v1.31.0', 'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0', 'version' => '1.31.0.0',
'reference' => '3833d7255cc303546435cb650316bff708a1c75c',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer', 'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
'aliases' => array(), 'aliases' => array(),
'reference' => '3833d7255cc303546435cb650316bff708a1c75c',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-mbstring' => array( 'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.31.0', 'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0', 'version' => '1.31.0.0',
'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(), 'aliases' => array(),
'reference' => '85181ba99b2345b0ef10ce42ecac37612d9fd341',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-php73' => array( 'symfony/polyfill-php73' => array(
'pretty_version' => 'v1.31.0', 'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0', 'version' => '1.31.0.0',
'reference' => '0f68c03565dcaaf25a890667542e8bd75fe7e5bb',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php73', 'install_path' => __DIR__ . '/../symfony/polyfill-php73',
'aliases' => array(), 'aliases' => array(),
'reference' => '0f68c03565dcaaf25a890667542e8bd75fe7e5bb',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-php80' => array( 'symfony/polyfill-php80' => array(
'pretty_version' => 'v1.31.0', 'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0', 'version' => '1.31.0.0',
'reference' => '60328e362d4c2c802a54fcbf04f9d3fb892b4cf8',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php80', 'install_path' => __DIR__ . '/../symfony/polyfill-php80',
'aliases' => array(), 'aliases' => array(),
'reference' => '60328e362d4c2c802a54fcbf04f9d3fb892b4cf8',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/polyfill-php81' => array( 'symfony/polyfill-php81' => array(
'pretty_version' => 'v1.31.0', 'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0', 'version' => '1.31.0.0',
'reference' => '4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php81', 'install_path' => __DIR__ . '/../symfony/polyfill-php81',
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'reference' => '4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c',
),
'symfony/routing' => array(
'pretty_version' => 'v5.4.48',
'version' => '5.4.48.0',
'reference' => 'dd08c19879a9b37ff14fd30dcbdf99a4cf045db1',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/routing',
'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/service-contracts' => array( 'symfony/service-contracts' => array(
'pretty_version' => 'v2.5.4', 'pretty_version' => 'v2.5.4',
'version' => '2.5.4.0', 'version' => '2.5.4.0',
'reference' => 'f37b419f7aea2e9abf10abd261832cace12e3300',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/service-contracts', 'install_path' => __DIR__ . '/../symfony/service-contracts',
'aliases' => array(), 'aliases' => array(),
'reference' => 'f37b419f7aea2e9abf10abd261832cace12e3300',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/string' => array( 'symfony/string' => array(
'pretty_version' => 'v5.4.47', 'pretty_version' => 'v5.4.47',
'version' => '5.4.47.0', 'version' => '5.4.47.0',
'reference' => '136ca7d72f72b599f2631aca474a4f8e26719799',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/string', 'install_path' => __DIR__ . '/../symfony/string',
'aliases' => array(), 'aliases' => array(),
'reference' => '136ca7d72f72b599f2631aca474a4f8e26719799',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/translation' => array( 'symfony/translation' => array(
'pretty_version' => 'v5.4.45', 'pretty_version' => 'v5.4.45',
'version' => '5.4.45.0', 'version' => '5.4.45.0',
'reference' => '98f26acc99341ca4bab345fb14d7b1d7cb825bed',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/translation', 'install_path' => __DIR__ . '/../symfony/translation',
'aliases' => array(), 'aliases' => array(),
'reference' => '98f26acc99341ca4bab345fb14d7b1d7cb825bed',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/translation-contracts' => array( 'symfony/translation-contracts' => array(
'pretty_version' => 'v2.5.4', 'pretty_version' => 'v2.5.4',
'version' => '2.5.4.0', 'version' => '2.5.4.0',
'reference' => '450d4172653f38818657022252f9d81be89ee9a8',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/translation-contracts', 'install_path' => __DIR__ . '/../symfony/translation-contracts',
'aliases' => array(), 'aliases' => array(),
'reference' => '450d4172653f38818657022252f9d81be89ee9a8',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/translation-implementation' => array( 'symfony/translation-implementation' => array(
@ -920,28 +887,28 @@
'thecodingmachine/safe' => array( 'thecodingmachine/safe' => array(
'pretty_version' => 'v2.5.0', 'pretty_version' => 'v2.5.0',
'version' => '2.5.0.0', 'version' => '2.5.0.0',
'reference' => '3115ecd6b4391662b4931daac4eba6b07a2ac1f0',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../thecodingmachine/safe', 'install_path' => __DIR__ . '/../thecodingmachine/safe',
'aliases' => array(), 'aliases' => array(),
'reference' => '3115ecd6b4391662b4931daac4eba6b07a2ac1f0',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'vimeo/vimeo-api' => array( 'vimeo/vimeo-api' => array(
'pretty_version' => '3.0.10', 'pretty_version' => '3.0.10',
'version' => '3.0.10.0', 'version' => '3.0.10.0',
'reference' => '79885b642594b17f6c356dc949d3e4a58c356c9b',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../vimeo/vimeo-api', 'install_path' => __DIR__ . '/../vimeo/vimeo-api',
'aliases' => array(), 'aliases' => array(),
'reference' => '79885b642594b17f6c356dc949d3e4a58c356c9b',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'wwbn/avideo' => array( 'wwbn/avideo' => array(
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '9c5c75cf9128c6922bf5007c1afab68370fe76da',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '8eb0a49081089de5d625fe07b0f30abb2dacb39e',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
), ),

View file

@ -1,172 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 1.8.2
- Fix deprecation warnings in PHP 8.4
## 1.8.1
- Fix error handling in Stream::getContents()
## 1.8.0
- Deprecate HttplugFactory, use Psr17Factory instead
- Make depencendy on php-http/message-factory optional
## 1.7.0
- Bump to PHP 7.2 minimum
- Allow psr/http-message v2
- Use copy-on-write for streams created from strings
## 1.6.1
- Security fix: CVE-2023-29197
## 1.6.0
### Changed
- Seek to the begining of the string when using Stream::create()
- Populate ServerRequest::getQueryParams() on instantiation
- Encode [reserved characters](https://www.rfc-editor.org/rfc/rfc3986#appendix-A) in userinfo in Uri
- Normalize leading slashes for Uri::getPath()
- Make Stream's constructor public
- Add some missing type checks on arguments
## 1.5.1
### Fixed
- Fixed deprecations on PHP 8.1
## 1.5.0
### Added
- Add explicit `@return mixed`
- Add explicit return types to HttplugFactory
### Fixed
- Improve error handling with streams
## 1.4.1
### Fixed
- `Psr17Factory::createStreamFromFile`, `UploadedFile::moveTo`, and
`UploadedFile::getStream` no longer throw `ValueError` in PHP 8.
## 1.4.0
### Removed
The `final` keyword was replaced by `@final` annotation.
## 1.3.2
### Fixed
- `Stream::read()` must not return boolean.
- Improved exception message when using wrong HTTP status code.
## 1.3.1
### Fixed
- Allow installation on PHP8
## 1.3.0
### Added
- Make Stream::__toString() compatible with throwing exceptions on PHP 7.4.
### Fixed
- Support for UTF-8 hostnames
- Support for numeric header names
## 1.2.1
### Changed
- Added `.github` and `phpstan.neon.dist` to `.gitattributes`.
## 1.2.0
### Changed
- Change minimal port number to 0 (unix socket)
- Updated `Psr17Factory::createResponse` to respect the specification. If second
argument is not used, a standard reason phrase. If an empty string is passed,
then the reason phrase will be empty.
### Fixed
- Check for seekable on the stream resource.
- Fixed the `Response::$reason` should never be null.
## 1.1.0
### Added
- Improved performance
- More tests for `UploadedFile` and `HttplugFactory`
### Removed
- Dead code
## 1.0.1
### Fixed
- Handle `fopen` failing in createStreamFromFile according to PSR-7.
- Reduce execution path to speed up performance.
- Fixed typos.
- Code style.
## 1.0.0
### Added
- Support for final PSR-17 (HTTP factories). (`Psr17Factory`)
- Support for numeric header values.
- Support for empty header values.
- All classes are final
- `HttplugFactory` that implements factory interfaces from HTTPlug.
### Changed
- `ServerRequest` does not extend `Request`.
### Removed
- The HTTPlug discovery strategy was removed since it is included in php-http/discovery 1.4.
- `UploadedFileFactory()` was removed in favor for `Psr17Factory`.
- `ServerRequestFactory()` was removed in favor for `Psr17Factory`.
- `StreamFactory`, `UriFactory`, abd `MessageFactory`. Use `HttplugFactory` instead.
- `ServerRequestFactory::createServerRequestFromArray`, `ServerRequestFactory::createServerRequestFromArrays` and
`ServerRequestFactory::createServerRequestFromGlobals`. Please use the new `nyholm/psr7-server` instead.
## 0.3.0
### Added
- Return types.
- Many `InvalidArgumentException`s are thrown when you use invalid arguments.
- Integration tests for `UploadedFile` and `ServerRequest`.
### Changed
- We dropped PHP7.0 support.
- PSR-17 factories have been marked as internal. They do not fall under our BC promise until PSR-17 is accepted.
- `UploadedFileFactory::createUploadedFile` does not accept a string file path.
## 0.2.3
No changelog before this release

View file

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2016 Tobias Nyholm
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,108 +0,0 @@
# PSR-7 implementation
[![Latest Version](https://img.shields.io/github/release/Nyholm/psr7.svg?style=flat-square)](https://github.com/Nyholm/psr7/releases)
[![Total Downloads](https://poser.pugx.org/nyholm/psr7/downloads)](https://packagist.org/packages/nyholm/psr7)
[![Monthly Downloads](https://poser.pugx.org/nyholm/psr7/d/monthly.png)](https://packagist.org/packages/nyholm/psr7)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
[![Static analysis](https://github.com/Nyholm/psr7/actions/workflows/static.yml/badge.svg?branch=master)](https://github.com/Nyholm/psr7/actions/workflows/static.yml?query=branch%3Amaster)
[![Tests](https://github.com/Nyholm/psr7/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/Nyholm/psr7/actions/workflows/tests.yml?query=branch%3Amaster)
A super lightweight PSR-7 implementation. Very strict and very fast.
| Description | Guzzle | Laminas | Slim | Nyholm |
| ---- | ------ | ---- | ---- | ------ |
| Lines of code | 3.300 | 3.100 | 1.900 | 1.000 |
| PSR-7* | 66% | 100% | 75% | 100% |
| PSR-17 | No | Yes | Yes | Yes |
| HTTPlug | No | No | No | Yes |
| Performance (runs per second)** | 14.553 | 14.703 | 13.416 | 17.734 |
\* Percent of completed tests in https://github.com/php-http/psr7-integration-tests
\** Benchmark with 50.000 runs. See https://github.com/devanych/psr-http-benchmark (higher is better)
## Installation
```bash
composer require nyholm/psr7
```
If you are using Symfony Flex then you get all message factories registered as services.
## Usage
The PSR-7 objects do not contain any other public methods than those defined in
the [PSR-7 specification](https://www.php-fig.org/psr/psr-7/).
### Create objects
Use the PSR-17 factory to create requests, streams, URIs etc.
```php
$psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
$request = $psr17Factory->createRequest('GET', 'http://tnyholm.se');
$stream = $psr17Factory->createStream('foobar');
```
### Sending a request
With [HTTPlug](http://httplug.io/) or any other PSR-18 (HTTP client) you may send
requests like:
```bash
composer require kriswallsmith/buzz
```
```php
$psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
$psr18Client = new \Buzz\Client\Curl($psr17Factory);
$request = $psr17Factory->createRequest('GET', 'http://tnyholm.se');
$response = $psr18Client->sendRequest($request);
```
### Create server requests
The [`nyholm/psr7-server`](https://github.com/Nyholm/psr7-server) package can be used
to create server requests from PHP superglobals.
```bash
composer require nyholm/psr7-server
```
```php
$psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
$creator = new \Nyholm\Psr7Server\ServerRequestCreator(
$psr17Factory, // ServerRequestFactory
$psr17Factory, // UriFactory
$psr17Factory, // UploadedFileFactory
$psr17Factory // StreamFactory
);
$serverRequest = $creator->fromGlobals();
```
### Emitting a response
```bash
composer require laminas/laminas-httphandlerrunner
```
```php
$psr17Factory = new \Nyholm\Psr7\Factory\Psr17Factory();
$responseBody = $psr17Factory->createStream('Hello world');
$response = $psr17Factory->createResponse(200)->withBody($responseBody);
(new \Laminas\HttpHandlerRunner\Emitter\SapiEmitter())->emit($response);
```
## Our goal
This package is currently maintained by [Tobias Nyholm](http://nyholm.se) and
[Martijn van der Ven](https://vanderven.se/martijn/). They have decided that the
goal of this library should be to provide a super strict implementation of
[PSR-7](https://www.php-fig.org/psr/psr-7/) that is blazing fast.
The package will never include any extra features nor helper methods. All our classes
and functions exist because they are required to fulfill the PSR-7 specification.

View file

@ -1,49 +0,0 @@
{
"name": "nyholm/psr7",
"description": "A fast PHP7 implementation of PSR-7",
"license": "MIT",
"keywords": ["psr-7", "psr-17"],
"homepage": "https://tnyholm.se",
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
},
{
"name": "Martijn van der Ven",
"email": "martijn@vanderven.se"
}
],
"require": {
"php": ">=7.2",
"psr/http-message": "^1.1 || ^2.0",
"psr/http-factory": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
"php-http/message-factory": "^1.0",
"php-http/psr7-integration-tests": "^1.0",
"http-interop/http-factory-tests": "^0.9",
"symfony/error-handler": "^4.4"
},
"provide": {
"php-http/message-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0",
"psr/http-factory-implementation": "1.0"
},
"autoload": {
"psr-4": {
"Nyholm\\Psr7\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Nyholm\\Psr7\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
}
}

View file

@ -1,53 +0,0 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7\Factory;
use Http\Message\{MessageFactory, StreamFactory, UriFactory};
use Nyholm\Psr7\{Request, Response, Stream, Uri};
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriInterface;
if (!\interface_exists(MessageFactory::class)) {
throw new \LogicException('You cannot use "Nyholm\Psr7\Factory\HttplugFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead');
}
@\trigger_error('Class "Nyholm\Psr7\Factory\HttplugFactory" is deprecated since version 1.8, use "Nyholm\Psr7\Factory\Psr17Factory" instead.', \E_USER_DEPRECATED);
/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*
* @deprecated since version 1.8, use Psr17Factory instead
*/
class HttplugFactory implements MessageFactory, StreamFactory, UriFactory
{
public function createRequest($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1'): RequestInterface
{
return new Request($method, $uri, $headers, $body, $protocolVersion);
}
public function createResponse($statusCode = 200, $reasonPhrase = null, array $headers = [], $body = null, $version = '1.1'): ResponseInterface
{
return new Response((int) $statusCode, $headers, $body, $version, $reasonPhrase);
}
public function createStream($body = null): StreamInterface
{
return Stream::create($body ?? '');
}
public function createUri($uri = ''): UriInterface
{
if ($uri instanceof UriInterface) {
return $uri;
}
return new Uri($uri);
}
}

View file

@ -1,78 +0,0 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7\Factory;
use Nyholm\Psr7\{Request, Response, ServerRequest, Stream, UploadedFile, Uri};
use Psr\Http\Message\{RequestFactoryInterface, RequestInterface, ResponseFactoryInterface, ResponseInterface, ServerRequestFactoryInterface, ServerRequestInterface, StreamFactoryInterface, StreamInterface, UploadedFileFactoryInterface, UploadedFileInterface, UriFactoryInterface, UriInterface};
/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class Psr17Factory implements RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface, UriFactoryInterface
{
public function createRequest(string $method, $uri): RequestInterface
{
return new Request($method, $uri);
}
public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
{
if (2 > \func_num_args()) {
// This will make the Response class to use a custom reasonPhrase
$reasonPhrase = null;
}
return new Response($code, [], null, '1.1', $reasonPhrase);
}
public function createStream(string $content = ''): StreamInterface
{
return Stream::create($content);
}
public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
{
if ('' === $filename) {
throw new \RuntimeException('Path cannot be empty');
}
if (false === $resource = @\fopen($filename, $mode)) {
if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) {
throw new \InvalidArgumentException(\sprintf('The mode "%s" is invalid.', $mode));
}
throw new \RuntimeException(\sprintf('The file "%s" cannot be opened: %s', $filename, \error_get_last()['message'] ?? ''));
}
return Stream::create($resource);
}
public function createStreamFromResource($resource): StreamInterface
{
return Stream::create($resource);
}
public function createUploadedFile(StreamInterface $stream, ?int $size = null, int $error = \UPLOAD_ERR_OK, ?string $clientFilename = null, ?string $clientMediaType = null): UploadedFileInterface
{
if (null === $size) {
$size = $stream->getSize();
}
return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
}
public function createUri(string $uri = ''): UriInterface
{
return new Uri($uri);
}
public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
{
return new ServerRequest($method, $uri, [], null, '1.1', $serverParams);
}
}

View file

@ -1,235 +0,0 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\StreamInterface;
/**
* Trait implementing functionality common to requests and responses.
*
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @internal should not be used outside of Nyholm/Psr7 as it does not fall under our BC promise
*/
trait MessageTrait
{
/** @var array Map of all registered headers, as original name => array of values */
private $headers = [];
/** @var array Map of lowercase header name => original name at registration */
private $headerNames = [];
/** @var string */
private $protocol = '1.1';
/** @var StreamInterface|null */
private $stream;
public function getProtocolVersion(): string
{
return $this->protocol;
}
/**
* @return static
*/
public function withProtocolVersion($version): MessageInterface
{
if (!\is_scalar($version)) {
throw new \InvalidArgumentException('Protocol version must be a string');
}
if ($this->protocol === $version) {
return $this;
}
$new = clone $this;
$new->protocol = (string) $version;
return $new;
}
public function getHeaders(): array
{
return $this->headers;
}
public function hasHeader($header): bool
{
return isset($this->headerNames[\strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]);
}
public function getHeader($header): array
{
if (!\is_string($header)) {
throw new \InvalidArgumentException('Header name must be an RFC 7230 compatible string');
}
$header = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
if (!isset($this->headerNames[$header])) {
return [];
}
$header = $this->headerNames[$header];
return $this->headers[$header];
}
public function getHeaderLine($header): string
{
return \implode(', ', $this->getHeader($header));
}
/**
* @return static
*/
public function withHeader($header, $value): MessageInterface
{
$value = $this->validateAndTrimHeader($header, $value);
$normalized = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
$new = clone $this;
if (isset($new->headerNames[$normalized])) {
unset($new->headers[$new->headerNames[$normalized]]);
}
$new->headerNames[$normalized] = $header;
$new->headers[$header] = $value;
return $new;
}
/**
* @return static
*/
public function withAddedHeader($header, $value): MessageInterface
{
if (!\is_string($header) || '' === $header) {
throw new \InvalidArgumentException('Header name must be an RFC 7230 compatible string');
}
$new = clone $this;
$new->setHeaders([$header => $value]);
return $new;
}
/**
* @return static
*/
public function withoutHeader($header): MessageInterface
{
if (!\is_string($header)) {
throw new \InvalidArgumentException('Header name must be an RFC 7230 compatible string');
}
$normalized = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
if (!isset($this->headerNames[$normalized])) {
return $this;
}
$header = $this->headerNames[$normalized];
$new = clone $this;
unset($new->headers[$header], $new->headerNames[$normalized]);
return $new;
}
public function getBody(): StreamInterface
{
if (null === $this->stream) {
$this->stream = Stream::create('');
}
return $this->stream;
}
/**
* @return static
*/
public function withBody(StreamInterface $body): MessageInterface
{
if ($body === $this->stream) {
return $this;
}
$new = clone $this;
$new->stream = $body;
return $new;
}
private function setHeaders(array $headers): void
{
foreach ($headers as $header => $value) {
if (\is_int($header)) {
// If a header name was set to a numeric string, PHP will cast the key to an int.
// We must cast it back to a string in order to comply with validation.
$header = (string) $header;
}
$value = $this->validateAndTrimHeader($header, $value);
$normalized = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
if (isset($this->headerNames[$normalized])) {
$header = $this->headerNames[$normalized];
$this->headers[$header] = \array_merge($this->headers[$header], $value);
} else {
$this->headerNames[$normalized] = $header;
$this->headers[$header] = $value;
}
}
}
/**
* Make sure the header complies with RFC 7230.
*
* Header names must be a non-empty string consisting of token characters.
*
* Header values must be strings consisting of visible characters with all optional
* leading and trailing whitespace stripped. This method will always strip such
* optional whitespace. Note that the method does not allow folding whitespace within
* the values as this was deprecated for almost all instances by the RFC.
*
* header-field = field-name ":" OWS field-value OWS
* field-name = 1*( "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^"
* / "_" / "`" / "|" / "~" / %x30-39 / ( %x41-5A / %x61-7A ) )
* OWS = *( SP / HTAB )
* field-value = *( ( %x21-7E / %x80-FF ) [ 1*( SP / HTAB ) ( %x21-7E / %x80-FF ) ] )
*
* @see https://tools.ietf.org/html/rfc7230#section-3.2.4
*/
private function validateAndTrimHeader($header, $values): array
{
if (!\is_string($header) || 1 !== \preg_match("@^[!#$%&'*+.^_`|~0-9A-Za-z-]+$@D", $header)) {
throw new \InvalidArgumentException('Header name must be an RFC 7230 compatible string');
}
if (!\is_array($values)) {
// This is simple, just one value.
if ((!\is_numeric($values) && !\is_string($values)) || 1 !== \preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $values)) {
throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings');
}
return [\trim((string) $values, " \t")];
}
if (empty($values)) {
throw new \InvalidArgumentException('Header values must be a string or an array of strings, empty array given');
}
// Assert Non empty array
$returnValues = [];
foreach ($values as $v) {
if ((!\is_numeric($v) && !\is_string($v)) || 1 !== \preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@D", (string) $v)) {
throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings');
}
$returnValues[] = \trim((string) $v, " \t");
}
return $returnValues;
}
}

View file

@ -1,47 +0,0 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\{RequestInterface, StreamInterface, UriInterface};
/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class Request implements RequestInterface
{
use MessageTrait;
use RequestTrait;
/**
* @param string $method HTTP method
* @param string|UriInterface $uri URI
* @param array $headers Request headers
* @param string|resource|StreamInterface|null $body Request body
* @param string $version Protocol version
*/
public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1')
{
if (!($uri instanceof UriInterface)) {
$uri = new Uri($uri);
}
$this->method = $method;
$this->uri = $uri;
$this->setHeaders($headers);
$this->protocol = $version;
if (!$this->hasHeader('Host')) {
$this->updateHostFromUri();
}
// If we got no body, defer initialization of the stream until Request::getBody()
if ('' !== $body && null !== $body) {
$this->stream = Stream::create($body);
}
}
}

View file

@ -1,127 +0,0 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\UriInterface;
/**
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @internal should not be used outside of Nyholm/Psr7 as it does not fall under our BC promise
*/
trait RequestTrait
{
/** @var string */
private $method;
/** @var string|null */
private $requestTarget;
/** @var UriInterface|null */
private $uri;
public function getRequestTarget(): string
{
if (null !== $this->requestTarget) {
return $this->requestTarget;
}
if ('' === $target = $this->uri->getPath()) {
$target = '/';
}
if ('' !== $this->uri->getQuery()) {
$target .= '?' . $this->uri->getQuery();
}
return $target;
}
/**
* @return static
*/
public function withRequestTarget($requestTarget): RequestInterface
{
if (!\is_string($requestTarget)) {
throw new \InvalidArgumentException('Request target must be a string');
}
if (\preg_match('#\s#', $requestTarget)) {
throw new \InvalidArgumentException('Invalid request target provided; cannot contain whitespace');
}
$new = clone $this;
$new->requestTarget = $requestTarget;
return $new;
}
public function getMethod(): string
{
return $this->method;
}
/**
* @return static
*/
public function withMethod($method): RequestInterface
{
if (!\is_string($method)) {
throw new \InvalidArgumentException('Method must be a string');
}
$new = clone $this;
$new->method = $method;
return $new;
}
public function getUri(): UriInterface
{
return $this->uri;
}
/**
* @return static
*/
public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface
{
if ($uri === $this->uri) {
return $this;
}
$new = clone $this;
$new->uri = $uri;
if (!$preserveHost || !$this->hasHeader('Host')) {
$new->updateHostFromUri();
}
return $new;
}
private function updateHostFromUri(): void
{
if ('' === $host = $this->uri->getHost()) {
return;
}
if (null !== ($port = $this->uri->getPort())) {
$host .= ':' . $port;
}
if (isset($this->headerNames['host'])) {
$header = $this->headerNames['host'];
} else {
$this->headerNames['host'] = $header = 'Host';
}
// Ensure Host is the first header.
// See: http://tools.ietf.org/html/rfc7230#section-5.4
$this->headers = [$header => [$host]] + $this->headers;
}
}

View file

@ -1,93 +0,0 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\{ResponseInterface, StreamInterface};
/**
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class Response implements ResponseInterface
{
use MessageTrait;
/** @var array Map of standard HTTP status code/reason phrases */
private const PHRASES = [
100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing',
200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported',
300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect',
400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons',
500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 511 => 'Network Authentication Required',
];
/** @var string */
private $reasonPhrase = '';
/** @var int */
private $statusCode;
/**
* @param int $status Status code
* @param array $headers Response headers
* @param string|resource|StreamInterface|null $body Response body
* @param string $version Protocol version
* @param string|null $reason Reason phrase (when empty a default will be used based on the status code)
*/
public function __construct(int $status = 200, array $headers = [], $body = null, string $version = '1.1', ?string $reason = null)
{
// If we got no body, defer initialization of the stream until Response::getBody()
if ('' !== $body && null !== $body) {
$this->stream = Stream::create($body);
}
$this->statusCode = $status;
$this->setHeaders($headers);
if (null === $reason && isset(self::PHRASES[$this->statusCode])) {
$this->reasonPhrase = self::PHRASES[$status];
} else {
$this->reasonPhrase = $reason ?? '';
}
$this->protocol = $version;
}
public function getStatusCode(): int
{
return $this->statusCode;
}
public function getReasonPhrase(): string
{
return $this->reasonPhrase;
}
/**
* @return static
*/
public function withStatus($code, $reasonPhrase = ''): ResponseInterface
{
if (!\is_int($code) && !\is_string($code)) {
throw new \InvalidArgumentException('Status code has to be an integer');
}
$code = (int) $code;
if ($code < 100 || $code > 599) {
throw new \InvalidArgumentException(\sprintf('Status code has to be an integer between 100 and 599. A status code of %d was given', $code));
}
$new = clone $this;
$new->statusCode = $code;
if ((null === $reasonPhrase || '' === $reasonPhrase) && isset(self::PHRASES[$new->statusCode])) {
$reasonPhrase = self::PHRASES[$new->statusCode];
}
$new->reasonPhrase = $reasonPhrase;
return $new;
}
}

View file

@ -1,201 +0,0 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\{ServerRequestInterface, StreamInterface, UploadedFileInterface, UriInterface};
/**
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class ServerRequest implements ServerRequestInterface
{
use MessageTrait;
use RequestTrait;
/** @var array */
private $attributes = [];
/** @var array */
private $cookieParams = [];
/** @var array|object|null */
private $parsedBody;
/** @var array */
private $queryParams = [];
/** @var array */
private $serverParams;
/** @var UploadedFileInterface[] */
private $uploadedFiles = [];
/**
* @param string $method HTTP method
* @param string|UriInterface $uri URI
* @param array $headers Request headers
* @param string|resource|StreamInterface|null $body Request body
* @param string $version Protocol version
* @param array $serverParams Typically the $_SERVER superglobal
*/
public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1', array $serverParams = [])
{
$this->serverParams = $serverParams;
if (!($uri instanceof UriInterface)) {
$uri = new Uri($uri);
}
$this->method = $method;
$this->uri = $uri;
$this->setHeaders($headers);
$this->protocol = $version;
\parse_str($uri->getQuery(), $this->queryParams);
if (!$this->hasHeader('Host')) {
$this->updateHostFromUri();
}
// If we got no body, defer initialization of the stream until ServerRequest::getBody()
if ('' !== $body && null !== $body) {
$this->stream = Stream::create($body);
}
}
public function getServerParams(): array
{
return $this->serverParams;
}
public function getUploadedFiles(): array
{
return $this->uploadedFiles;
}
/**
* @return static
*/
public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface
{
$new = clone $this;
$new->uploadedFiles = $uploadedFiles;
return $new;
}
public function getCookieParams(): array
{
return $this->cookieParams;
}
/**
* @return static
*/
public function withCookieParams(array $cookies): ServerRequestInterface
{
$new = clone $this;
$new->cookieParams = $cookies;
return $new;
}
public function getQueryParams(): array
{
return $this->queryParams;
}
/**
* @return static
*/
public function withQueryParams(array $query): ServerRequestInterface
{
$new = clone $this;
$new->queryParams = $query;
return $new;
}
/**
* @return array|object|null
*/
public function getParsedBody()
{
return $this->parsedBody;
}
/**
* @return static
*/
public function withParsedBody($data): ServerRequestInterface
{
if (!\is_array($data) && !\is_object($data) && null !== $data) {
throw new \InvalidArgumentException('First parameter to withParsedBody MUST be object, array or null');
}
$new = clone $this;
$new->parsedBody = $data;
return $new;
}
public function getAttributes(): array
{
return $this->attributes;
}
/**
* @return mixed
*/
public function getAttribute($attribute, $default = null)
{
if (!\is_string($attribute)) {
throw new \InvalidArgumentException('Attribute name must be a string');
}
if (false === \array_key_exists($attribute, $this->attributes)) {
return $default;
}
return $this->attributes[$attribute];
}
/**
* @return static
*/
public function withAttribute($attribute, $value): ServerRequestInterface
{
if (!\is_string($attribute)) {
throw new \InvalidArgumentException('Attribute name must be a string');
}
$new = clone $this;
$new->attributes[$attribute] = $value;
return $new;
}
/**
* @return static
*/
public function withoutAttribute($attribute): ServerRequestInterface
{
if (!\is_string($attribute)) {
throw new \InvalidArgumentException('Attribute name must be a string');
}
if (false === \array_key_exists($attribute, $this->attributes)) {
return $this;
}
$new = clone $this;
unset($new->attributes[$attribute]);
return $new;
}
}

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