[COMPOSER] Added predis/predis and updated packages

This commit is contained in:
Miguel Dantas
2019-08-13 01:31:05 +01:00
committed by Diogo Cordeiro
parent 0bb35d7e7f
commit 630a578e1d
641 changed files with 58448 additions and 83 deletions

View 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;
}
}

View 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);
}
}

View 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;
}
}