CoreFiles by mySites.guru
StreamFactory.php43 lines, 912 bytes, from Joomla_6.0.2-Stable-Full_Package.zip
Raw History Compare with 6.0.1
md5
8f22cc52a8739f3b95f2535d5d346562
sha1
dae84753da3f6e4a071a0c3fe43605da5f9eb85c
sha256
1cab0cd1499e1e01adfef7219536544d6947c447b3581da52912d08e96c472f3
<?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 $filename, string $mode = 'r'): StreamInterface
    {
        return new Stream($filename, $mode);
    }

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

The same content is in 17 releases, Joomla 6.0.0-beta1 to 6.1.0-alpha1. See them all, or every version of this file.