| 1 |
<?php |
| 2 |
|
| 3 |
namespace Http\Discovery; |
| 4 |
|
| 5 |
use Http\Discovery\Exception\DiscoveryFailedException; |
| 6 |
use Http\Message\MessageFactory; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
om> |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
final class MessageFactoryDiscovery extends ClassDiscovery |
| 16 |
{ |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
public static function find() |
| 25 |
{ |
| 26 |
try { |
| 27 |
$messageFactory = static::findOneByType(MessageFactory::class); |
| 28 |
} catch (DiscoveryFailedException $e) { |
| 29 |
throw new NotFoundException('No php-http message factories found. Note that the php-http message factories are deprecated in favor of the PSR-17 message factories. To use the legacy Guzzle, Diactoros or Slim Framework factories of php-http, install php-http/message and php-http/message-factory and the chosen message implementation.', 0, $e); |
| 30 |
} |
| 31 |
|
| 32 |
return static::instantiateClass($messageFactory); |
| 33 |
} |
| 34 |
} |