composer update

This commit is contained in:
Oliver Davies 2019-01-24 08:00:03 +00:00
parent f6abc3dce2
commit 71dfaca858
1753 changed files with 45274 additions and 14619 deletions

View file

@ -0,0 +1,5 @@
.idea
.DS_store
/vendor/
composer.phar
composer.lock

View file

@ -0,0 +1,18 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
before_script:
- composer install
script:
- mkdir -p build/logs
- php vendor/bin/phpunit -c phpunit.xml
after_script:
- php vendor/bin/coveralls -v

21
vendor/ralouphie/getallheaders/LICENSE vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Ralph Khattar
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,19 @@
getallheaders
=============
PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3.
[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders)
[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master)
[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders)
[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders)
[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders)
This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php).
## Install
```
composer require ralouphie/getallheaders
```

View file

@ -0,0 +1,21 @@
{
"name": "ralouphie/getallheaders",
"description": "A polyfill for getallheaders.",
"license": "MIT",
"authors": [
{
"name": "Ralph Khattar",
"email": "ralph.khattar@gmail.com"
}
],
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "~3.7.0",
"satooshi/php-coveralls": ">=1.0"
},
"autoload": {
"files": ["src/getallheaders.php"]
}
}

View file

@ -0,0 +1,22 @@
<phpunit
bootstrap="vendor/autoload.php"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
strict="true">
<testsuite>
<directory>./tests</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>

View file

@ -0,0 +1,46 @@
<?php
if (!function_exists('getallheaders')) {
/**
* Get all HTTP header key/values as an associative array for the current request.
*
* @return string[string] The HTTP header key/value pairs.
*/
function getallheaders()
{
$headers = array();
$copy_server = array(
'CONTENT_TYPE' => 'Content-Type',
'CONTENT_LENGTH' => 'Content-Length',
'CONTENT_MD5' => 'Content-Md5',
);
foreach ($_SERVER as $key => $value) {
if (substr($key, 0, 5) === 'HTTP_') {
$key = substr($key, 5);
if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) {
$key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key))));
$headers[$key] = $value;
}
} elseif (isset($copy_server[$key])) {
$headers[$copy_server[$key]] = $value;
}
}
if (!isset($headers['Authorization'])) {
if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
$headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
} elseif (isset($_SERVER['PHP_AUTH_USER'])) {
$basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
$headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass);
} elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) {
$headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST'];
}
}
return $headers;
}
}

View file

@ -0,0 +1,121 @@
<?php
class GetAllHeadersTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider testWorksData
*/
public function testWorks($test_type, $expected, $server)
{
foreach ($server as $key => $val) {
$_SERVER[$key] = $val;
}
$result = getallheaders();
$this->assertEquals($expected, $result, "Error testing $test_type works.");
}
public function testWorksData()
{
return array(
array(
'normal case',
array(
'Key-One' => 'foo',
'Key-Two' => 'bar',
'Another-Key-For-Testing' => 'baz'
),
array(
'HTTP_KEY_ONE' => 'foo',
'HTTP_KEY_TWO' => 'bar',
'HTTP_ANOTHER_KEY_FOR_TESTING' => 'baz'
)
),
array(
'Content-Type',
array(
'Content-Type' => 'two'
),
array(
'HTTP_CONTENT_TYPE' => 'one',
'CONTENT_TYPE' => 'two'
)
),
array(
'Content-Length',
array(
'Content-Length' => '222'
),
array(
'CONTENT_LENGTH' => '222',
'HTTP_CONTENT_LENGTH' => '111'
)
),
array(
'Content-Length (HTTP_CONTENT_LENGTH only)',
array(
'Content-Length' => '111'
),
array(
'HTTP_CONTENT_LENGTH' => '111'
)
),
array(
'Content-MD5',
array(
'Content-Md5' => 'aef123'
),
array(
'CONTENT_MD5' => 'aef123',
'HTTP_CONTENT_MD5' => 'fea321'
)
),
array(
'Content-MD5 (HTTP_CONTENT_MD5 only)',
array(
'Content-Md5' => 'f123'
),
array(
'HTTP_CONTENT_MD5' => 'f123'
)
),
array(
'Authorization (normal)',
array(
'Authorization' => 'testing'
),
array(
'HTTP_AUTHORIZATION' => 'testing',
)
),
array(
'Authorization (redirect)',
array(
'Authorization' => 'testing redirect'
),
array(
'REDIRECT_HTTP_AUTHORIZATION' => 'testing redirect',
)
),
array(
'Authorization (PHP_AUTH_USER + PHP_AUTH_PW)',
array(
'Authorization' => 'Basic ' . base64_encode('foo:bar')
),
array(
'PHP_AUTH_USER' => 'foo',
'PHP_AUTH_PW' => 'bar'
)
),
array(
'Authorization (PHP_AUTH_DIGEST)',
array(
'Authorization' => 'example-digest'
),
array(
'PHP_AUTH_DIGEST' => 'example-digest'
)
)
);
}
}