forked from GNUsocial/gnu-social
[COMPOSER] Added predis/predis and updated packages
This commit is contained in:
committed by
Diogo Cordeiro
parent
0bb35d7e7f
commit
630a578e1d
36
vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php
vendored
Normal file
36
vendor/php-http/message/src/StreamFactory/DiactorosStreamFactory.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Message\StreamFactory;
|
||||
|
||||
use Http\Message\StreamFactory;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
use Zend\Diactoros\Stream;
|
||||
|
||||
/**
|
||||
* Creates Diactoros streams.
|
||||
*
|
||||
* @author Михаил Красильников <m.krasilnikov@yandex.ru>
|
||||
*/
|
||||
final class DiactorosStreamFactory implements StreamFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createStream($body = null)
|
||||
{
|
||||
if ($body instanceof StreamInterface) {
|
||||
return $body;
|
||||
}
|
||||
|
||||
if (is_resource($body)) {
|
||||
return new Stream($body);
|
||||
}
|
||||
|
||||
$stream = new Stream('php://memory', 'rw');
|
||||
if (null !== $body && '' !== $body) {
|
||||
$stream->write((string) $body);
|
||||
}
|
||||
|
||||
return $stream;
|
||||
}
|
||||
}
|
21
vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php
vendored
Normal file
21
vendor/php-http/message/src/StreamFactory/GuzzleStreamFactory.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Message\StreamFactory;
|
||||
|
||||
use Http\Message\StreamFactory;
|
||||
|
||||
/**
|
||||
* Creates Guzzle streams.
|
||||
*
|
||||
* @author Михаил Красильников <m.krasilnikov@yandex.ru>
|
||||
*/
|
||||
final class GuzzleStreamFactory implements StreamFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createStream($body = null)
|
||||
{
|
||||
return \GuzzleHttp\Psr7\stream_for($body);
|
||||
}
|
||||
}
|
37
vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php
vendored
Normal file
37
vendor/php-http/message/src/StreamFactory/SlimStreamFactory.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Http\Message\StreamFactory;
|
||||
|
||||
use Http\Message\StreamFactory;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
use Slim\Http\Stream;
|
||||
|
||||
/**
|
||||
* Creates Slim 3 streams.
|
||||
*
|
||||
* @author Mika Tuupola <tuupola@appelsiini.net>
|
||||
*/
|
||||
final class SlimStreamFactory implements StreamFactory
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createStream($body = null)
|
||||
{
|
||||
if ($body instanceof StreamInterface) {
|
||||
return $body;
|
||||
}
|
||||
|
||||
if (is_resource($body)) {
|
||||
return new Stream($body);
|
||||
}
|
||||
|
||||
$resource = fopen('php://memory', 'r+');
|
||||
$stream = new Stream($resource);
|
||||
if (null !== $body && '' !== $body) {
|
||||
$stream->write((string) $body);
|
||||
}
|
||||
|
||||
return $stream;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user