Skip to content
This repository was archived by the owner on May 13, 2023. It is now read-only.

Commit 41600f3

Browse files
committed
Adds Stream Factory
1 parent 07806c8 commit 41600f3

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

src/StreamFactory.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Http Message Factory package.
5+
*
6+
* (c) PHP HTTP Team
7+
*
8+
* For the full copyright and license information, please read the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Http\Message;
13+
14+
use Psr\Http\Message\StreamInterface;
15+
16+
/**
17+
* @author Márk Sági-Kazár <[email protected]>
18+
*/
19+
interface StreamFactory
20+
{
21+
/**
22+
* Creates a stream
23+
*
24+
* @param string|resource|StreamInterface|null $body
25+
*
26+
* @return StreamInterface
27+
*
28+
* @throws \InvalidArgumentException If the stream body is invalid
29+
*/
30+
public function createStream($body = null);
31+
}

src/StreamFactoryAware.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Http Message Factory package.
5+
*
6+
* (c) PHP HTTP Team
7+
*
8+
* For the full copyright and license information, please read the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Http\Message;
13+
14+
/**
15+
* @author Márk Sági-Kazár <[email protected]>
16+
*/
17+
interface StreamFactoryAware
18+
{
19+
/**
20+
* @return StreamFactory
21+
*/
22+
public function getStreamFactory();
23+
24+
/**
25+
* @param StreamFactory $streamFactory
26+
*/
27+
public function setStreamFactory(StreamFactory $streamFactory);
28+
}

src/StreamFactoryHelper.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Http Message Factory package.
5+
*
6+
* (c) PHP HTTP Team
7+
*
8+
* For the full copyright and license information, please read the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Http\Message;
13+
14+
/**
15+
* @author Márk Sági-Kazár <[email protected]>
16+
*/
17+
interface StreamFactoryHelper
18+
{
19+
/**
20+
* @var StreamFactory
21+
*/
22+
protected $streamFactory;
23+
24+
/**
25+
* {@inheritdoc}
26+
*/
27+
public function getStreamFactory()
28+
{
29+
return $this->streamFactory;
30+
}
31+
32+
/**
33+
* {@inheritdoc}
34+
*/
35+
public function setStreamFactory(StreamFactory $streamFactory)
36+
{
37+
$this->streamFactory = $streamFactory;
38+
}
39+
}

0 commit comments

Comments
 (0)