📈 Install Sentry

Signed-off-by: Luke Tainton <luke@tainton.uk>
This commit is contained in:
2020-08-05 18:45:39 +01:00
parent bbba704df3
commit 75f1dde336
541 changed files with 73830 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
composer.phar
composer.lock
phpunit.xml
build/
vendor/

View File

@@ -0,0 +1,32 @@
language: php
php:
- 7.0
- 7.1
- 7.2
sudo: false
cache:
directories:
- $HOME/.composer/cache
- vendor
git:
depth: 1
matrix:
include:
- php: 7.0
env:
- COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
before_script:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
script:
- vendor/bin/phpunit
after_script:
- bash -c '[[ -f "build/logs/clover.xml" ]] && wget https://scrutinizer-ci.com/ocular.phar'
- bash -c '[[ -f "build/logs/clover.xml" ]] && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml'

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Woody Gilk
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

@@ -0,0 +1,3 @@
# HTTP Factory for Guzzle
HTTP factory implemented for [Guzzle](https://github.com/guzzle/psr7).

View File

@@ -0,0 +1,33 @@
{
"name": "http-interop/http-factory-guzzle",
"description": "An HTTP Factory using Guzzle PSR7",
"keywords": [
"psr-7",
"psr-17",
"http",
"factory"
],
"license": "MIT",
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"provide": {
"psr/http-factory-implementation": "^1.0"
},
"require": {
"psr/http-factory": "^1.0",
"guzzlehttp/psr7": "^1.4.2"
},
"require-dev": {
"http-interop/http-factory-tests": "^0.5",
"phpunit/phpunit": "^6.5"
},
"autoload": {
"psr-4": {
"Http\\Factory\\Guzzle\\": "src/"
}
}
}

View File

@@ -0,0 +1,25 @@
<phpunit backupGlobals="true" bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Integration tests">
<directory>vendor/http-interop/http-factory-tests/test</directory>
</testsuite>
</testsuites>
<php>
<const name="REQUEST_FACTORY" value="Http\Factory\Guzzle\RequestFactory"/>
<const name="RESPONSE_FACTORY" value="Http\Factory\Guzzle\ResponseFactory"/>
<const name="SERVER_REQUEST_FACTORY" value="Http\Factory\Guzzle\ServerRequestFactory"/>
<const name="STREAM_FACTORY" value="Http\Factory\Guzzle\StreamFactory"/>
<const name="UPLOADED_FILE_FACTORY" value="Http\Factory\Guzzle\UploadedFileFactory"/>
<const name="URI_FACTORY" value="Http\Factory\Guzzle\UriFactory"/>
</php>
<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-text" target="php://stdout"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>

View File

@@ -0,0 +1,15 @@
<?php
namespace Http\Factory\Guzzle;
use GuzzleHttp\Psr7\Request;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\RequestInterface;
class RequestFactory implements RequestFactoryInterface
{
public function createRequest(string $method, $uri): RequestInterface
{
return new Request($method, $uri);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace Http\Factory\Guzzle;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
class ResponseFactory implements ResponseFactoryInterface
{
public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
{
return new Response($code, [], null, '1.1', $reasonPhrase);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Http\Factory\Guzzle;
use GuzzleHttp\Psr7\ServerRequest;
use Psr\Http\Message\ServerRequestFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;
class ServerRequestFactory implements ServerRequestFactoryInterface
{
public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
{
if (empty($method)) {
if (!empty($serverParams['REQUEST_METHOD'])) {
$method = $serverParams['REQUEST_METHOD'];
} else {
throw new \InvalidArgumentException('Cannot determine HTTP method');
}
}
return new ServerRequest($method, $uri, [], null, '1.1', $serverParams);
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Http\Factory\Guzzle;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\StreamInterface;
class StreamFactory implements StreamFactoryInterface
{
public function createStream(string $content = ''): StreamInterface
{
return \GuzzleHttp\Psr7\stream_for($content);
}
public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface
{
$resource = \GuzzleHttp\Psr7\try_fopen($file, $mode);
return \GuzzleHttp\Psr7\stream_for($resource);
}
public function createStreamFromResource($resource): StreamInterface
{
return \GuzzleHttp\Psr7\stream_for($resource);
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Http\Factory\Guzzle;
use GuzzleHttp\Psr7\UploadedFile;
use Psr\Http\Message\UploadedFileFactoryInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UploadedFileInterface;
class UploadedFileFactory implements UploadedFileFactoryInterface
{
public function createUploadedFile(
StreamInterface $stream,
int $size = null,
int $error = \UPLOAD_ERR_OK,
string $clientFilename = null,
string $clientMediaType = null
): UploadedFileInterface {
if ($size === null) {
$size = $stream->getSize();
}
return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace Http\Factory\Guzzle;
use GuzzleHttp\Psr7\Uri;
use Psr\Http\Message\UriFactoryInterface;
use Psr\Http\Message\UriInterface;
class UriFactory implements UriFactoryInterface
{
public function createUri(string $uri = ''): UriInterface
{
return new Uri($uri);
}
}