updated mailgun librarie
This commit is contained in:
236
sites/all/libraries/mailgun/vendor/php-http/discovery/CHANGELOG.md
vendored
Normal file
236
sites/all/libraries/mailgun/vendor/php-http/discovery/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
# Change Log
|
||||
|
||||
## 1.6.1 - 2019-02-23
|
||||
|
||||
### Fixed
|
||||
|
||||
- MockClientStrategy also provides the mock client when requesting an async client
|
||||
|
||||
## 1.6.0 - 2019-01-23
|
||||
|
||||
### Added
|
||||
|
||||
- Support for PSR-17 factories
|
||||
- Support for PSR-18 clients
|
||||
|
||||
## 1.5.2 - 2018-12-31
|
||||
|
||||
Corrected mistakes in 1.5.1. The different between 1.5.2 and 1.5.0 is that
|
||||
we removed some PHP 7 code.
|
||||
|
||||
https://github.com/php-http/discovery/compare/1.5.0...1.5.2
|
||||
|
||||
## 1.5.1 - 2018-12-31
|
||||
|
||||
This version added new features by mistake. These are reverted in 1.5.2.
|
||||
|
||||
Do not use 1.5.1.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Removed PHP 7 code
|
||||
|
||||
## 1.5.0 - 2018-12-30
|
||||
|
||||
### Added
|
||||
|
||||
- Support for `nyholm/psr7` version 1.0.
|
||||
- `ClassDiscovery::safeClassExists` which will help Magento users.
|
||||
- Support for HTTPlug 2.0
|
||||
- Support for Buzz 1.0
|
||||
- Better error message when nothing found by introducing a new exception: `NoCandidateFoundException`.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed condition evaluation, it should stop after first invalid condition.
|
||||
|
||||
## 1.4.0 - 2018-02-06
|
||||
|
||||
### Added
|
||||
|
||||
- Discovery support for nyholm/psr7
|
||||
|
||||
## 1.3.0 - 2017-08-03
|
||||
|
||||
### Added
|
||||
|
||||
- Discovery support for CakePHP adapter
|
||||
- Discovery support for Zend adapter
|
||||
- Discovery support for Artax adapter
|
||||
|
||||
## 1.2.1 - 2017-03-02
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed minor issue with `MockClientStrategy`, also added more tests.
|
||||
|
||||
## 1.2.0 - 2017-02-12
|
||||
|
||||
### Added
|
||||
|
||||
- MockClientStrategy class.
|
||||
|
||||
## 1.1.1 - 2016-11-27
|
||||
|
||||
### Changed
|
||||
|
||||
- Made exception messages clearer. `StrategyUnavailableException` is no longer the previous exception to `DiscoveryFailedException`.
|
||||
- `CommonClassesStrategy` is using `self` instead of `static`. Using `static` makes no sense when `CommonClassesStrategy` is final.
|
||||
|
||||
## 1.1.0 - 2016-10-20
|
||||
|
||||
### Added
|
||||
|
||||
- Discovery support for Slim Framework factories
|
||||
|
||||
## 1.0.0 - 2016-07-18
|
||||
|
||||
### Added
|
||||
|
||||
- Added back `Http\Discovery\NotFoundException` to preserve BC with 0.8 version. You may upgrade from 0.8.x and 0.9.x to 1.0.0 without any BC breaks.
|
||||
- Added interface `Http\Discovery\Exception` which is implemented by all our exceptions
|
||||
|
||||
### Changed
|
||||
|
||||
- Puli strategy renamed to Puli Beta strategy to prevent incompatibility with a future Puli stable
|
||||
|
||||
### Deprecated
|
||||
|
||||
- For BC reasons, the old `Http\Discovery\NotFoundException` (extending the new exception) will be thrown until version 2.0
|
||||
|
||||
|
||||
## 0.9.1 - 2016-06-28
|
||||
|
||||
### Changed
|
||||
|
||||
- Dropping PHP 5.4 support because we use the ::class constant.
|
||||
|
||||
|
||||
## 0.9.0 - 2016-06-25
|
||||
|
||||
### Added
|
||||
|
||||
- Discovery strategies to find classes
|
||||
|
||||
### Changed
|
||||
|
||||
- [Puli](http://puli.io) made optional
|
||||
- Improved exceptions
|
||||
- **[BC] `NotFoundException` moved to `Http\Discovery\Exception\NotFoundException`**
|
||||
|
||||
|
||||
## 0.8.0 - 2016-02-11
|
||||
|
||||
### Changed
|
||||
|
||||
- Puli composer plugin must be installed separately
|
||||
|
||||
|
||||
## 0.7.0 - 2016-01-15
|
||||
|
||||
### Added
|
||||
|
||||
- Temporary puli.phar (Beta 10) executable
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated HTTPlug dependencies
|
||||
- Updated Puli dependencies
|
||||
- Local configuration to make tests passing
|
||||
|
||||
### Removed
|
||||
|
||||
- Puli CLI dependency
|
||||
|
||||
|
||||
## 0.6.4 - 2016-01-07
|
||||
|
||||
### Fixed
|
||||
|
||||
- Puli [not working](https://twitter.com/PuliPHP/status/685132540588507137) with the latest json-schema
|
||||
|
||||
|
||||
## 0.6.3 - 2016-01-04
|
||||
|
||||
### Changed
|
||||
|
||||
- Adjust Puli dependencies
|
||||
|
||||
|
||||
## 0.6.2 - 2016-01-04
|
||||
|
||||
### Changed
|
||||
|
||||
- Make Puli CLI a requirement
|
||||
|
||||
|
||||
## 0.6.1 - 2016-01-03
|
||||
|
||||
### Changed
|
||||
|
||||
- More flexible Puli requirement
|
||||
|
||||
|
||||
## 0.6.0 - 2015-12-30
|
||||
|
||||
### Changed
|
||||
|
||||
- Use [Puli](http://puli.io) for discovery
|
||||
- Improved exception messages
|
||||
|
||||
|
||||
## 0.5.0 - 2015-12-25
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated message factory dependency (php-http/message)
|
||||
|
||||
|
||||
## 0.4.0 - 2015-12-17
|
||||
|
||||
### Added
|
||||
|
||||
- Array condition evaluation in the Class Discovery
|
||||
|
||||
### Removed
|
||||
|
||||
- Message factories (moved to php-http/utils)
|
||||
|
||||
|
||||
## 0.3.0 - 2015-11-18
|
||||
|
||||
### Added
|
||||
|
||||
- HTTP Async Client Discovery
|
||||
- Stream factories
|
||||
|
||||
### Changed
|
||||
|
||||
- Discoveries and Factories are final
|
||||
- Message and Uri factories have the type in their names
|
||||
- Diactoros Message factory uses Stream factory internally
|
||||
|
||||
### Fixed
|
||||
|
||||
- Improved docblocks for API documentation generation
|
||||
|
||||
|
||||
## 0.2.0 - 2015-10-31
|
||||
|
||||
### Changed
|
||||
|
||||
- Renamed AdapterDiscovery to ClientDiscovery
|
||||
|
||||
|
||||
## 0.1.1 - 2015-06-13
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bad HTTP Adapter class name for Guzzle 5
|
||||
|
||||
|
||||
## 0.1.0 - 2015-06-12
|
||||
|
||||
### Added
|
||||
|
||||
- Initial release
|
19
sites/all/libraries/mailgun/vendor/php-http/discovery/LICENSE
vendored
Normal file
19
sites/all/libraries/mailgun/vendor/php-http/discovery/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015-2016 PHP HTTP Team <team@php-http.org>
|
||||
|
||||
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.
|
46
sites/all/libraries/mailgun/vendor/php-http/discovery/README.md
vendored
Normal file
46
sites/all/libraries/mailgun/vendor/php-http/discovery/README.md
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# HTTPlug Discovery
|
||||
|
||||
[](https://github.com/php-http/discovery/releases)
|
||||
[](LICENSE)
|
||||
[](https://travis-ci.org/php-http/discovery)
|
||||
[](https://scrutinizer-ci.com/g/php-http/discovery)
|
||||
[](https://scrutinizer-ci.com/g/php-http/discovery)
|
||||
[](https://packagist.org/packages/php-http/discovery)
|
||||
|
||||
**Finds installed HTTPlug implementations and PSR-7 message factories.**
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
Via Composer
|
||||
|
||||
``` bash
|
||||
$ composer require php-http/discovery
|
||||
```
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
Please see the [official documentation](http://php-http.readthedocs.org/en/latest/discovery.html).
|
||||
|
||||
|
||||
## Testing
|
||||
|
||||
``` bash
|
||||
$ composer test
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT). Please see [License File](LICENSE) for more information.
|
50
sites/all/libraries/mailgun/vendor/php-http/discovery/composer.json
vendored
Normal file
50
sites/all/libraries/mailgun/vendor/php-http/discovery/composer.json
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "php-http/discovery",
|
||||
"description": "Finds installed HTTPlug implementations and PSR-7 message factories",
|
||||
"license": "MIT",
|
||||
"keywords": ["http", "discovery", "client", "adapter", "message", "factory", "psr7"],
|
||||
"homepage": "http://php-http.org",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^5.5 || ^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-http/httplug": "^1.0 || ^2.0",
|
||||
"php-http/message-factory": "^1.0",
|
||||
"puli/composer-plugin": "1.0.0-beta10",
|
||||
"phpspec/phpspec": "^2.4"
|
||||
},
|
||||
"suggest": {
|
||||
"puli/composer-plugin": "Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details.",
|
||||
"php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Http\\Discovery\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"spec\\Http\\Discovery\\": "spec/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vendor/bin/phpspec run",
|
||||
"test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.5-dev"
|
||||
}
|
||||
},
|
||||
"conflict": {
|
||||
"nyholm/psr7": "<1.0"
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"minimum-stability": "beta"
|
||||
}
|
236
sites/all/libraries/mailgun/vendor/php-http/discovery/src/ClassDiscovery.php
vendored
Normal file
236
sites/all/libraries/mailgun/vendor/php-http/discovery/src/ClassDiscovery.php
vendored
Normal file
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
use Http\Discovery\Exception\ClassInstantiationFailedException;
|
||||
use Http\Discovery\Exception\DiscoveryFailedException;
|
||||
use Http\Discovery\Exception\NoCandidateFoundException;
|
||||
use Http\Discovery\Exception\StrategyUnavailableException;
|
||||
|
||||
/**
|
||||
* Registry that based find results on class existence.
|
||||
*
|
||||
* @author David de Boer <david@ddeboer.nl>
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
abstract class ClassDiscovery
|
||||
{
|
||||
/**
|
||||
* A list of strategies to find classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $strategies = [
|
||||
Strategy\PuliBetaStrategy::class,
|
||||
Strategy\CommonClassesStrategy::class,
|
||||
Strategy\CommonPsr17ClassesStrategy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Discovery cache to make the second time we use discovery faster.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $cache = [];
|
||||
|
||||
/**
|
||||
* Finds a class.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return string|\Closure
|
||||
*
|
||||
* @throws DiscoveryFailedException
|
||||
*/
|
||||
protected static function findOneByType($type)
|
||||
{
|
||||
// Look in the cache
|
||||
if (null !== ($class = self::getFromCache($type))) {
|
||||
return $class;
|
||||
}
|
||||
|
||||
$exceptions = [];
|
||||
foreach (self::$strategies as $strategy) {
|
||||
try {
|
||||
$candidates = call_user_func($strategy.'::getCandidates', $type);
|
||||
} catch (StrategyUnavailableException $e) {
|
||||
$exceptions[] = $e;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($candidates as $candidate) {
|
||||
if (isset($candidate['condition'])) {
|
||||
if (!self::evaluateCondition($candidate['condition'])) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// save the result for later use
|
||||
self::storeInCache($type, $candidate);
|
||||
|
||||
return $candidate['class'];
|
||||
}
|
||||
|
||||
$exceptions[] = new NoCandidateFoundException($strategy, $candidates);
|
||||
}
|
||||
|
||||
throw DiscoveryFailedException::create($exceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from cache.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private static function getFromCache($type)
|
||||
{
|
||||
if (!isset(self::$cache[$type])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$candidate = self::$cache[$type];
|
||||
if (isset($candidate['condition'])) {
|
||||
if (!self::evaluateCondition($candidate['condition'])) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return $candidate['class'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a value in cache.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $class
|
||||
*/
|
||||
private static function storeInCache($type, $class)
|
||||
{
|
||||
self::$cache[$type] = $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new strategies and clear the cache.
|
||||
*
|
||||
* @param array $strategies string array of fully qualified class name to a DiscoveryStrategy
|
||||
*/
|
||||
public static function setStrategies(array $strategies)
|
||||
{
|
||||
self::$strategies = $strategies;
|
||||
self::clearCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a strategy at the end of the strategy queue.
|
||||
*
|
||||
* @param string $strategy Fully qualified class name to a DiscoveryStrategy
|
||||
*/
|
||||
public static function appendStrategy($strategy)
|
||||
{
|
||||
self::$strategies[] = $strategy;
|
||||
self::clearCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepend a strategy at the beginning of the strategy queue.
|
||||
*
|
||||
* @param string $strategy Fully qualified class name to a DiscoveryStrategy
|
||||
*/
|
||||
public static function prependStrategy($strategy)
|
||||
{
|
||||
array_unshift(self::$strategies, $strategy);
|
||||
self::clearCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cache.
|
||||
*/
|
||||
public static function clearCache()
|
||||
{
|
||||
self::$cache = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates conditions to boolean.
|
||||
*
|
||||
* @param mixed $condition
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected static function evaluateCondition($condition)
|
||||
{
|
||||
if (is_string($condition)) {
|
||||
// Should be extended for functions, extensions???
|
||||
return self::safeClassExists($condition);
|
||||
}
|
||||
if (is_callable($condition)) {
|
||||
return (bool) $condition();
|
||||
}
|
||||
if (is_bool($condition)) {
|
||||
return $condition;
|
||||
}
|
||||
if (is_array($condition)) {
|
||||
foreach ($condition as $c) {
|
||||
if (false === static::evaluateCondition($c)) {
|
||||
// Immediately stop execution if the condition is false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of the $class.
|
||||
*
|
||||
* @param string|\Closure $class A FQCN of a class or a closure that instantiate the class.
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @throws ClassInstantiationFailedException
|
||||
*/
|
||||
protected static function instantiateClass($class)
|
||||
{
|
||||
try {
|
||||
if (is_string($class)) {
|
||||
return new $class();
|
||||
}
|
||||
|
||||
if (is_callable($class)) {
|
||||
return $class();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new ClassInstantiationFailedException('Unexpected exception when instantiating class.', 0, $e);
|
||||
}
|
||||
|
||||
throw new ClassInstantiationFailedException('Could not instantiate class because parameter is neither a callable nor a string');
|
||||
}
|
||||
|
||||
/**
|
||||
* We want to do a "safe" version of PHP's "class_exists" because Magento has a bug
|
||||
* (or they call it a "feature"). Magento is throwing an exception if you do class_exists()
|
||||
* on a class that ends with "Factory" and if that file does not exits.
|
||||
*
|
||||
* This function will catch all potential exceptions and make sure it returns a boolean.
|
||||
*
|
||||
* @param string $class
|
||||
* @param bool $autoload
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function safeClassExists($class)
|
||||
{
|
||||
try {
|
||||
return class_exists($class);
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
12
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Exception.php
vendored
Normal file
12
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Exception.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
/**
|
||||
* An interface implemented by all discovery related exceptions.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
interface Exception
|
||||
{
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Exception;
|
||||
|
||||
use Http\Discovery\Exception;
|
||||
|
||||
/**
|
||||
* Thrown when a class fails to instantiate.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
final class ClassInstantiationFailedException extends \RuntimeException implements Exception
|
||||
{
|
||||
}
|
51
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php
vendored
Normal file
51
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Exception/DiscoveryFailedException.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Exception;
|
||||
|
||||
use Http\Discovery\Exception;
|
||||
|
||||
/**
|
||||
* Thrown when all discovery strategies fails to find a resource.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
final class DiscoveryFailedException extends \Exception implements Exception
|
||||
{
|
||||
/**
|
||||
* @var \Exception[]
|
||||
*/
|
||||
private $exceptions;
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param \Exception[] $exceptions
|
||||
*/
|
||||
public function __construct($message, array $exceptions = [])
|
||||
{
|
||||
$this->exceptions = $exceptions;
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Exception[] $exceptions
|
||||
*/
|
||||
public static function create($exceptions)
|
||||
{
|
||||
$message = 'Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors';
|
||||
foreach ($exceptions as $e) {
|
||||
$message .= "\n - ".$e->getMessage();
|
||||
}
|
||||
$message .= "\n\n";
|
||||
|
||||
return new self($message, $exceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Exception[]
|
||||
*/
|
||||
public function getExceptions()
|
||||
{
|
||||
return $this->exceptions;
|
||||
}
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Exception;
|
||||
|
||||
use Http\Discovery\Exception;
|
||||
|
||||
/**
|
||||
* When we have used a strategy but no candidates provided by that strategy could be used.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
final class NoCandidateFoundException extends \Exception implements Exception
|
||||
{
|
||||
/**
|
||||
* @param string $strategy
|
||||
* @param array $candidates
|
||||
*/
|
||||
public function __construct($strategy, array $candidates)
|
||||
{
|
||||
$classes = array_map(
|
||||
function ($a) {
|
||||
return $a['class'];
|
||||
},
|
||||
$candidates
|
||||
);
|
||||
|
||||
$message = sprintf(
|
||||
'No valid candidate found using strategy "%s". We tested the following candidates: %s.',
|
||||
$strategy,
|
||||
implode(', ', array_map([$this, 'stringify'], $classes))
|
||||
);
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
|
||||
private function stringify($mixed)
|
||||
{
|
||||
if (is_string($mixed)) {
|
||||
return $mixed;
|
||||
}
|
||||
|
||||
if (is_array($mixed) && 2 === count($mixed)) {
|
||||
return sprintf('%s::%s', $this->stringify($mixed[0]), $mixed[1]);
|
||||
}
|
||||
|
||||
return is_object($mixed) ? get_class($mixed) : gettype($mixed);
|
||||
}
|
||||
}
|
16
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Exception/NotFoundException.php
vendored
Normal file
16
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Exception/NotFoundException.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Exception;
|
||||
|
||||
use Http\Discovery\Exception;
|
||||
|
||||
/**
|
||||
* Thrown when a discovery does not find any matches.
|
||||
*
|
||||
* @final do NOT extend this class, not final for BC reasons
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
/*final */class NotFoundException extends \RuntimeException implements Exception
|
||||
{
|
||||
}
|
12
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php
vendored
Normal file
12
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Exception/PuliUnavailableException.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Exception;
|
||||
|
||||
/**
|
||||
* Thrown when we can't use Puli for discovery.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
final class PuliUnavailableException extends StrategyUnavailableException
|
||||
{
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Exception;
|
||||
|
||||
use Http\Discovery\Exception;
|
||||
|
||||
/**
|
||||
* This exception is thrown when we cannot use a discovery strategy. This is *not* thrown when
|
||||
* the discovery fails to find a class.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
class StrategyUnavailableException extends \RuntimeException implements Exception
|
||||
{
|
||||
}
|
36
sites/all/libraries/mailgun/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php
vendored
Normal file
36
sites/all/libraries/mailgun/vendor/php-http/discovery/src/HttpAsyncClientDiscovery.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
use Http\Client\HttpAsyncClient;
|
||||
use Http\Discovery\Exception\DiscoveryFailedException;
|
||||
|
||||
/**
|
||||
* Finds an HTTP Asynchronous Client.
|
||||
*
|
||||
* @author Joel Wurtz <joel.wurtz@gmail.com>
|
||||
*/
|
||||
final class HttpAsyncClientDiscovery extends ClassDiscovery
|
||||
{
|
||||
/**
|
||||
* Finds an HTTP Async Client.
|
||||
*
|
||||
* @return HttpAsyncClient
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function find()
|
||||
{
|
||||
try {
|
||||
$asyncClient = static::findOneByType(HttpAsyncClient::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw new NotFoundException(
|
||||
'No HTTPlug async clients found. Make sure to install a package providing "php-http/async-client-implementation". Example: "php-http/guzzle6-adapter".',
|
||||
0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
return static::instantiateClass($asyncClient);
|
||||
}
|
||||
}
|
36
sites/all/libraries/mailgun/vendor/php-http/discovery/src/HttpClientDiscovery.php
vendored
Normal file
36
sites/all/libraries/mailgun/vendor/php-http/discovery/src/HttpClientDiscovery.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
use Http\Client\HttpClient;
|
||||
use Http\Discovery\Exception\DiscoveryFailedException;
|
||||
|
||||
/**
|
||||
* Finds an HTTP Client.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
final class HttpClientDiscovery extends ClassDiscovery
|
||||
{
|
||||
/**
|
||||
* Finds an HTTP Client.
|
||||
*
|
||||
* @return HttpClient
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function find()
|
||||
{
|
||||
try {
|
||||
$client = static::findOneByType(HttpClient::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw new NotFoundException(
|
||||
'No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation". Example: "php-http/guzzle6-adapter".',
|
||||
0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
return static::instantiateClass($client);
|
||||
}
|
||||
}
|
38
sites/all/libraries/mailgun/vendor/php-http/discovery/src/MessageFactoryDiscovery.php
vendored
Normal file
38
sites/all/libraries/mailgun/vendor/php-http/discovery/src/MessageFactoryDiscovery.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
use Http\Discovery\Exception\DiscoveryFailedException;
|
||||
use Http\Message\MessageFactory;
|
||||
|
||||
/**
|
||||
* Finds a Message Factory.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*
|
||||
* @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery.
|
||||
*/
|
||||
final class MessageFactoryDiscovery extends ClassDiscovery
|
||||
{
|
||||
/**
|
||||
* Finds a Message Factory.
|
||||
*
|
||||
* @return MessageFactory
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function find()
|
||||
{
|
||||
try {
|
||||
$messageFactory = static::findOneByType(MessageFactory::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw new NotFoundException(
|
||||
'No message factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.',
|
||||
0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
return static::instantiateClass($messageFactory);
|
||||
}
|
||||
}
|
14
sites/all/libraries/mailgun/vendor/php-http/discovery/src/NotFoundException.php
vendored
Normal file
14
sites/all/libraries/mailgun/vendor/php-http/discovery/src/NotFoundException.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
/**
|
||||
* Thrown when a discovery does not find any matches.
|
||||
*
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*
|
||||
* @deprecated since since version 1.0, and will be removed in 2.0. Use {@link \Http\Discovery\Exception\NotFoundException} instead.
|
||||
*/
|
||||
final class NotFoundException extends \Http\Discovery\Exception\NotFoundException
|
||||
{
|
||||
}
|
124
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Psr17FactoryDiscovery.php
vendored
Normal file
124
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Psr17FactoryDiscovery.php
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
use Http\Discovery\Exception\DiscoveryFailedException;
|
||||
use Psr\Http\Message\RequestFactoryInterface;
|
||||
use Psr\Http\Message\ResponseFactoryInterface;
|
||||
use Psr\Http\Message\ServerRequestFactoryInterface;
|
||||
use Psr\Http\Message\StreamFactoryInterface;
|
||||
use Psr\Http\Message\UploadedFileFactoryInterface;
|
||||
use Psr\Http\Message\UriFactoryInterface;
|
||||
|
||||
/**
|
||||
* Finds PSR-17 factories.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
final class Psr17FactoryDiscovery extends ClassDiscovery
|
||||
{
|
||||
private static function createException($type, Exception $e)
|
||||
{
|
||||
return new \Http\Discovery\Exception\NotFoundException(
|
||||
'No PSR-17 '.$type.' found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation',
|
||||
0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RequestFactoryInterface
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function findRequestFactory()
|
||||
{
|
||||
try {
|
||||
$messageFactory = static::findOneByType(RequestFactoryInterface::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw self::createException('request factory', $e);
|
||||
}
|
||||
|
||||
return static::instantiateClass($messageFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResponseFactoryInterface
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function findResponseFactory()
|
||||
{
|
||||
try {
|
||||
$messageFactory = static::findOneByType(ResponseFactoryInterface::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw self::createException('response factory', $e);
|
||||
}
|
||||
|
||||
return static::instantiateClass($messageFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ServerRequestFactoryInterface
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function findServerRequestFactory()
|
||||
{
|
||||
try {
|
||||
$messageFactory = static::findOneByType(ServerRequestFactoryInterface::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw self::createException('server request factory', $e);
|
||||
}
|
||||
|
||||
return static::instantiateClass($messageFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return StreamFactoryInterface
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function findStreamFactory()
|
||||
{
|
||||
try {
|
||||
$messageFactory = static::findOneByType(StreamFactoryInterface::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw self::createException('stream factory', $e);
|
||||
}
|
||||
|
||||
return static::instantiateClass($messageFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UploadedFileFactoryInterface
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function findUploadedFileFactory()
|
||||
{
|
||||
try {
|
||||
$messageFactory = static::findOneByType(UploadedFileFactoryInterface::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw self::createException('uploaded file factory', $e);
|
||||
}
|
||||
|
||||
return static::instantiateClass($messageFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UriFactoryInterface
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function findUrlFactory()
|
||||
{
|
||||
try {
|
||||
$messageFactory = static::findOneByType(UriFactoryInterface::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw self::createException('url factory', $e);
|
||||
}
|
||||
|
||||
return static::instantiateClass($messageFactory);
|
||||
}
|
||||
}
|
36
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Psr18ClientDiscovery.php
vendored
Normal file
36
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Psr18ClientDiscovery.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
use Http\Discovery\Exception\DiscoveryFailedException;
|
||||
use Psr\Http\Client\ClientInterface;
|
||||
|
||||
/**
|
||||
* Finds a PSR-18 HTTP Client.
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
final class Psr18ClientDiscovery extends ClassDiscovery
|
||||
{
|
||||
/**
|
||||
* Finds a PSR-18 HTTP Client.
|
||||
*
|
||||
* @return ClientInterface
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function find()
|
||||
{
|
||||
try {
|
||||
$client = static::findOneByType(ClientInterface::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw new \Http\Discovery\Exception\NotFoundException(
|
||||
'No PSR-18 clients found. Make sure to install a package providing "psr/http-client-implementation". Example: "php-http/guzzle6-adapter".',
|
||||
0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
return static::instantiateClass($client);
|
||||
}
|
||||
}
|
121
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php
vendored
Normal file
121
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Strategy/CommonClassesStrategy.php
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Strategy;
|
||||
|
||||
use GuzzleHttp\Psr7\Request as GuzzleRequest;
|
||||
use Http\Client\HttpAsyncClient;
|
||||
use Http\Client\HttpClient;
|
||||
use Http\Discovery\MessageFactoryDiscovery;
|
||||
use Http\Message\MessageFactory;
|
||||
use Http\Message\MessageFactory\GuzzleMessageFactory;
|
||||
use Http\Message\StreamFactory;
|
||||
use Http\Message\StreamFactory\GuzzleStreamFactory;
|
||||
use Http\Message\UriFactory;
|
||||
use Http\Message\UriFactory\GuzzleUriFactory;
|
||||
use Http\Message\MessageFactory\DiactorosMessageFactory;
|
||||
use Http\Message\StreamFactory\DiactorosStreamFactory;
|
||||
use Http\Message\UriFactory\DiactorosUriFactory;
|
||||
use Psr\Http\Client\ClientInterface as Psr18Client;
|
||||
use Zend\Diactoros\Request as DiactorosRequest;
|
||||
use Http\Message\MessageFactory\SlimMessageFactory;
|
||||
use Http\Message\StreamFactory\SlimStreamFactory;
|
||||
use Http\Message\UriFactory\SlimUriFactory;
|
||||
use Slim\Http\Request as SlimRequest;
|
||||
use Http\Adapter\Guzzle6\Client as Guzzle6;
|
||||
use Http\Adapter\Guzzle5\Client as Guzzle5;
|
||||
use Http\Client\Curl\Client as Curl;
|
||||
use Http\Client\Socket\Client as Socket;
|
||||
use Http\Adapter\React\Client as React;
|
||||
use Http\Adapter\Buzz\Client as Buzz;
|
||||
use Http\Adapter\Cake\Client as Cake;
|
||||
use Http\Adapter\Zend\Client as Zend;
|
||||
use Http\Adapter\Artax\Client as Artax;
|
||||
use Nyholm\Psr7\Factory\HttplugFactory as NyholmHttplugFactory;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
final class CommonClassesStrategy implements DiscoveryStrategy
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $classes = [
|
||||
MessageFactory::class => [
|
||||
['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]],
|
||||
['class' => GuzzleMessageFactory::class, 'condition' => [GuzzleRequest::class, GuzzleMessageFactory::class]],
|
||||
['class' => DiactorosMessageFactory::class, 'condition' => [DiactorosRequest::class, DiactorosMessageFactory::class]],
|
||||
['class' => SlimMessageFactory::class, 'condition' => [SlimRequest::class, SlimMessageFactory::class]],
|
||||
],
|
||||
StreamFactory::class => [
|
||||
['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]],
|
||||
['class' => GuzzleStreamFactory::class, 'condition' => [GuzzleRequest::class, GuzzleStreamFactory::class]],
|
||||
['class' => DiactorosStreamFactory::class, 'condition' => [DiactorosRequest::class, DiactorosStreamFactory::class]],
|
||||
['class' => SlimStreamFactory::class, 'condition' => [SlimRequest::class, SlimStreamFactory::class]],
|
||||
],
|
||||
UriFactory::class => [
|
||||
['class' => NyholmHttplugFactory::class, 'condition' => [NyholmHttplugFactory::class]],
|
||||
['class' => GuzzleUriFactory::class, 'condition' => [GuzzleRequest::class, GuzzleUriFactory::class]],
|
||||
['class' => DiactorosUriFactory::class, 'condition' => [DiactorosRequest::class, DiactorosUriFactory::class]],
|
||||
['class' => SlimUriFactory::class, 'condition' => [SlimRequest::class, SlimUriFactory::class]],
|
||||
],
|
||||
HttpAsyncClient::class => [
|
||||
['class' => Guzzle6::class, 'condition' => Guzzle6::class],
|
||||
['class' => Curl::class, 'condition' => Curl::class],
|
||||
['class' => React::class, 'condition' => React::class],
|
||||
],
|
||||
HttpClient::class => [
|
||||
['class' => Guzzle6::class, 'condition' => Guzzle6::class],
|
||||
['class' => Guzzle5::class, 'condition' => Guzzle5::class],
|
||||
['class' => Curl::class, 'condition' => Curl::class],
|
||||
['class' => Socket::class, 'condition' => Socket::class],
|
||||
['class' => Buzz::class, 'condition' => Buzz::class],
|
||||
['class' => React::class, 'condition' => React::class],
|
||||
['class' => Cake::class, 'condition' => Cake::class],
|
||||
['class' => Zend::class, 'condition' => Zend::class],
|
||||
['class' => Artax::class, 'condition' => Artax::class],
|
||||
[
|
||||
'class' => [self::class, 'buzzInstantiate'],
|
||||
'condition' => [\Buzz\Client\FileGetContents::class, \Buzz\Message\ResponseBuilder::class],
|
||||
],
|
||||
],
|
||||
Psr18Client::class => [
|
||||
[
|
||||
'class' => [self::class, 'buzzInstantiate'],
|
||||
'condition' => [\Buzz\Client\FileGetContents::class, \Buzz\Message\ResponseBuilder::class],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getCandidates($type)
|
||||
{
|
||||
if (Psr18Client::class === $type) {
|
||||
$candidates = self::$classes[PSR18Client::class];
|
||||
|
||||
// HTTPlug 2.0 clients implements PSR18Client too.
|
||||
foreach (self::$classes[HttpClient::class] as $c) {
|
||||
if (is_subclass_of($c['class'], Psr18Client::class)) {
|
||||
$candidates[] = $c;
|
||||
}
|
||||
}
|
||||
|
||||
return $candidates;
|
||||
}
|
||||
|
||||
if (isset(self::$classes[$type])) {
|
||||
return self::$classes[$type];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function buzzInstantiate()
|
||||
{
|
||||
return new \Buzz\Client\FileGetContents(MessageFactoryDiscovery::find());
|
||||
}
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Strategy;
|
||||
|
||||
use Psr\Http\Message\RequestFactoryInterface;
|
||||
use Psr\Http\Message\ResponseFactoryInterface;
|
||||
use Psr\Http\Message\ServerRequestFactoryInterface;
|
||||
use Psr\Http\Message\StreamFactoryInterface;
|
||||
use Psr\Http\Message\UploadedFileFactoryInterface;
|
||||
use Psr\Http\Message\UriFactoryInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
final class CommonPsr17ClassesStrategy implements DiscoveryStrategy
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $classes = [
|
||||
RequestFactoryInterface::class => [
|
||||
'Nyholm\Psr7\Factory\Psr17Factory',
|
||||
'Zend\Diactoros\RequestFactory',
|
||||
'Http\Factory\Diactoros\RequestFactory',
|
||||
'Http\Factory\Guzzle\RequestFactory',
|
||||
'Http\Factory\Slim\RequestFactory',
|
||||
],
|
||||
ResponseFactoryInterface::class => [
|
||||
'Nyholm\Psr7\Factory\Psr17Factory',
|
||||
'Zend\Diactoros\ResponseFactory',
|
||||
'Http\Factory\Diactoros\ResponseFactory',
|
||||
'Http\Factory\Guzzle\ResponseFactory',
|
||||
'Http\Factory\Slim\ResponseFactory',
|
||||
],
|
||||
ServerRequestFactoryInterface::class => [
|
||||
'Nyholm\Psr7\Factory\Psr17Factory',
|
||||
'Zend\Diactoros\ServerRequestFactory',
|
||||
'Http\Factory\Diactoros\ServerRequestFactory',
|
||||
'Http\Factory\Guzzle\ServerRequestFactory',
|
||||
'Http\Factory\Slim\ServerRequestFactory',
|
||||
],
|
||||
StreamFactoryInterface::class => [
|
||||
'Nyholm\Psr7\Factory\Psr17Factory',
|
||||
'Zend\Diactoros\StreamFactory',
|
||||
'Http\Factory\Diactoros\StreamFactory',
|
||||
'Http\Factory\Guzzle\StreamFactory',
|
||||
'Http\Factory\Slim\StreamFactory',
|
||||
],
|
||||
UploadedFileFactoryInterface::class => [
|
||||
'Nyholm\Psr7\Factory\Psr17Factory',
|
||||
'Zend\Diactoros\UploadedFileFactory',
|
||||
'Http\Factory\Diactoros\UploadedFileFactory',
|
||||
'Http\Factory\Guzzle\UploadedFileFactory',
|
||||
'Http\Factory\Slim\UploadedFileFactory',
|
||||
],
|
||||
UriFactoryInterface::class => [
|
||||
'Nyholm\Psr7\Factory\Psr17Factory',
|
||||
'Zend\Diactoros\UriFactory',
|
||||
'Http\Factory\Diactoros\UriFactory',
|
||||
'Http\Factory\Guzzle\UriFactory',
|
||||
'Http\Factory\Slim\UriFactory',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getCandidates($type)
|
||||
{
|
||||
$candidates = [];
|
||||
if (isset(self::$classes[$type])) {
|
||||
foreach (self::$classes[$type] as $class) {
|
||||
$candidates[] = ['class' => $class, 'condition' => [$class]];
|
||||
}
|
||||
}
|
||||
|
||||
return $candidates;
|
||||
}
|
||||
}
|
23
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php
vendored
Normal file
23
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Strategy/DiscoveryStrategy.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Strategy;
|
||||
|
||||
use Http\Discovery\Exception\StrategyUnavailableException;
|
||||
|
||||
/**
|
||||
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
|
||||
*/
|
||||
interface DiscoveryStrategy
|
||||
{
|
||||
/**
|
||||
* Find a resource of a specific type.
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return array The return value is always an array with zero or more elements. Each
|
||||
* element is an array with two keys ['class' => string, 'condition' => mixed].
|
||||
*
|
||||
* @throws StrategyUnavailableException if we cannot use this strategy.
|
||||
*/
|
||||
public static function getCandidates($type);
|
||||
}
|
29
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php
vendored
Normal file
29
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Strategy/MockClientStrategy.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Strategy;
|
||||
|
||||
use Http\Client\HttpAsyncClient;
|
||||
use Http\Client\HttpClient;
|
||||
use Http\Mock\Client as Mock;
|
||||
|
||||
/**
|
||||
* Find the Mock client.
|
||||
*
|
||||
* @author Sam Rapaport <me@samrapdev.com>
|
||||
*/
|
||||
final class MockClientStrategy implements DiscoveryStrategy
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getCandidates($type)
|
||||
{
|
||||
switch ($type) {
|
||||
case HttpClient::class:
|
||||
case HttpAsyncClient::class:
|
||||
return [['class' => Mock::class, 'condition' => Mock::class]];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
92
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php
vendored
Normal file
92
sites/all/libraries/mailgun/vendor/php-http/discovery/src/Strategy/PuliBetaStrategy.php
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery\Strategy;
|
||||
|
||||
use Http\Discovery\ClassDiscovery;
|
||||
use Http\Discovery\Exception\PuliUnavailableException;
|
||||
use Puli\Discovery\Api\Discovery;
|
||||
use Puli\GeneratedPuliFactory;
|
||||
|
||||
/**
|
||||
* Find candidates using Puli.
|
||||
*
|
||||
* @internal
|
||||
* @final
|
||||
*
|
||||
* @author David de Boer <david@ddeboer.nl>
|
||||
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
|
||||
*/
|
||||
class PuliBetaStrategy implements DiscoveryStrategy
|
||||
{
|
||||
/**
|
||||
* @var GeneratedPuliFactory
|
||||
*/
|
||||
protected static $puliFactory;
|
||||
|
||||
/**
|
||||
* @var Discovery
|
||||
*/
|
||||
protected static $puliDiscovery;
|
||||
|
||||
/**
|
||||
* @return GeneratedPuliFactory
|
||||
*
|
||||
* @throws PuliUnavailableException
|
||||
*/
|
||||
private static function getPuliFactory()
|
||||
{
|
||||
if (null === self::$puliFactory) {
|
||||
if (!defined('PULI_FACTORY_CLASS')) {
|
||||
throw new PuliUnavailableException('Puli Factory is not available');
|
||||
}
|
||||
|
||||
$puliFactoryClass = PULI_FACTORY_CLASS;
|
||||
|
||||
if (!ClassDiscovery::safeClassExists($puliFactoryClass)) {
|
||||
throw new PuliUnavailableException('Puli Factory class does not exist');
|
||||
}
|
||||
|
||||
self::$puliFactory = new $puliFactoryClass();
|
||||
}
|
||||
|
||||
return self::$puliFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Puli discovery layer.
|
||||
*
|
||||
* @return Discovery
|
||||
*
|
||||
* @throws PuliUnavailableException
|
||||
*/
|
||||
private static function getPuliDiscovery()
|
||||
{
|
||||
if (!isset(self::$puliDiscovery)) {
|
||||
$factory = self::getPuliFactory();
|
||||
$repository = $factory->createRepository();
|
||||
|
||||
self::$puliDiscovery = $factory->createDiscovery($repository);
|
||||
}
|
||||
|
||||
return self::$puliDiscovery;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getCandidates($type)
|
||||
{
|
||||
$returnData = [];
|
||||
$bindings = self::getPuliDiscovery()->findBindings($type);
|
||||
|
||||
foreach ($bindings as $binding) {
|
||||
$condition = true;
|
||||
if ($binding->hasParameterValue('depends')) {
|
||||
$condition = $binding->getParameterValue('depends');
|
||||
}
|
||||
$returnData[] = ['class' => $binding->getClassName(), 'condition' => $condition];
|
||||
}
|
||||
|
||||
return $returnData;
|
||||
}
|
||||
}
|
38
sites/all/libraries/mailgun/vendor/php-http/discovery/src/StreamFactoryDiscovery.php
vendored
Normal file
38
sites/all/libraries/mailgun/vendor/php-http/discovery/src/StreamFactoryDiscovery.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
use Http\Discovery\Exception\DiscoveryFailedException;
|
||||
use Http\Message\StreamFactory;
|
||||
|
||||
/**
|
||||
* Finds a Stream Factory.
|
||||
*
|
||||
* @author Михаил Красильников <m.krasilnikov@yandex.ru>
|
||||
*
|
||||
* @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery.
|
||||
*/
|
||||
final class StreamFactoryDiscovery extends ClassDiscovery
|
||||
{
|
||||
/**
|
||||
* Finds a Stream Factory.
|
||||
*
|
||||
* @return StreamFactory
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function find()
|
||||
{
|
||||
try {
|
||||
$streamFactory = static::findOneByType(StreamFactory::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw new NotFoundException(
|
||||
'No stream factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.',
|
||||
0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
return static::instantiateClass($streamFactory);
|
||||
}
|
||||
}
|
38
sites/all/libraries/mailgun/vendor/php-http/discovery/src/UriFactoryDiscovery.php
vendored
Normal file
38
sites/all/libraries/mailgun/vendor/php-http/discovery/src/UriFactoryDiscovery.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Discovery;
|
||||
|
||||
use Http\Discovery\Exception\DiscoveryFailedException;
|
||||
use Http\Message\UriFactory;
|
||||
|
||||
/**
|
||||
* Finds a URI Factory.
|
||||
*
|
||||
* @author David de Boer <david@ddeboer.nl>
|
||||
*
|
||||
* @deprecated This will be removed in 2.0. Consider using Psr17FactoryDiscovery.
|
||||
*/
|
||||
final class UriFactoryDiscovery extends ClassDiscovery
|
||||
{
|
||||
/**
|
||||
* Finds a URI Factory.
|
||||
*
|
||||
* @return UriFactory
|
||||
*
|
||||
* @throws Exception\NotFoundException
|
||||
*/
|
||||
public static function find()
|
||||
{
|
||||
try {
|
||||
$uriFactory = static::findOneByType(UriFactory::class);
|
||||
} catch (DiscoveryFailedException $e) {
|
||||
throw new NotFoundException(
|
||||
'No uri factories found. To use Guzzle, Diactoros or Slim Framework factories install php-http/message and the chosen message implementation.',
|
||||
0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
return static::instantiateClass($uriFactory);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user