CoreFiles by mySites.guru
StreamFactory.php43 lines, 904 bytes, from Joomla_5.0.2-Stable-Full_Package.zip
Raw History Compare with 5.0.1
md5
4f071c2b1dc30de1e0cbad3909aeb7ef
sha1
ce70645b37de79a2eb0b0368b1987e7b3b23405a
sha256
d91a10089719fe50f9dd07e45946dba4560a50d5d41f63ac12c1b5570eb2dfa5
<?php

declare(strict_types=1);

namespace Laminas\Diactoros;

use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\StreamInterface;

use function fopen;
use function fwrite;
use function rewind;

class StreamFactory implements StreamFactoryInterface
{
    /**
     * {@inheritDoc}
     */
    public function createStream(string $content = ''): StreamInterface
    {
        $resource = fopen('php://temp', 'r+');
        fwrite($resource, $content);
        rewind($resource);

        return $this->createStreamFromResource($resource);
    }

    /**
     * {@inheritDoc}
     */
    public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface
    {
        return new Stream($file, $mode);
    }

    /**
     * {@inheritDoc}
     */
    public function createStreamFromResource($resource): StreamInterface
    {
        return new Stream($resource);
    }
}

The same content is in 109 releases, Joomla 5.0.0-alpha1 to 6.0.0-alpha3. See them all, or every version of this file.