1 | <?php |
||
10 | class StreamFactory |
||
11 | { |
||
12 | protected static $factory; |
||
13 | |||
14 | /** |
||
15 | * Create a Stream. |
||
16 | * |
||
17 | * @throws \RuntimeException if no factory is set |
||
18 | * |
||
19 | * @return StreamInterface |
||
20 | */ |
||
21 | public function __invoke() |
||
25 | |||
26 | /** |
||
27 | * Set the stream factory. |
||
28 | * |
||
29 | * @param callable $factory the new stream factory |
||
30 | * |
||
31 | * @return callable |
||
32 | */ |
||
33 | public static function set(callable $factory) |
||
37 | |||
38 | /** |
||
39 | * Get a stream factory. |
||
40 | * |
||
41 | * @throws \RuntimeException if no factory is set |
||
42 | * |
||
43 | * @return callable |
||
44 | */ |
||
45 | public static function get() |
||
53 | |||
54 | /** |
||
55 | * Create a Stream. |
||
56 | * |
||
57 | * @throws \RuntimeException if no factory is set |
||
58 | * |
||
59 | * @return StreamInterface |
||
60 | */ |
||
61 | public static function create() |
||
65 | |||
66 | /** |
||
67 | * Get a \Slim\Http\Stream factory. |
||
68 | * |
||
69 | * @return StreamInterface |
||
70 | */ |
||
71 | public static function createSlimHttpStream() |
||
75 | |||
76 | /** |
||
77 | * Get \Zend\Diactoros\Stream factory. |
||
78 | * |
||
79 | * @return StreamInterface |
||
80 | */ |
||
81 | public static function createZendDiactorosStream() |
||
85 | |||
86 | /** |
||
87 | * Try to autodetect a stream factory. |
||
88 | * |
||
89 | * @throws \RuntimeException if no factory is found |
||
90 | * |
||
91 | * @return StreamInterface |
||
92 | */ |
||
93 | protected static function autodetectFactory() |
||
107 | } |
||
108 |