File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99class Blob implements IteratorAggregate, Value {
1010 private $ parts ;
1111 private $ iterator = null ;
12+ public $ meta = [];
1213
1314 /**
1415 * Creates a new blob from parts
1516 *
1617 * @param iterable|string|util.Bytes|io.streams.InputStream $parts
18+ * @param [:var] $meta
1719 * @throws lang.IllegalArgumentException
1820 */
19- public function __construct ($ parts = []) {
21+ public function __construct ($ parts = [], array $ meta = [] ) {
2022 if ($ parts instanceof InputStream) {
2123 $ this ->iterator = function () {
2224 static $ started = false ;
@@ -44,6 +46,7 @@ public function __construct($parts= []) {
4446 }
4547
4648 $ this ->parts = $ parts ;
49+ $ this ->meta = $ meta ;
4750 }
4851
4952 /** @return iterable */
Original file line number Diff line number Diff line change @@ -32,6 +32,17 @@ public function not_from_null() {
3232 new Blob (null );
3333 }
3434
35+ #[Test]
36+ public function meta_empty_by_default () {
37+ Assert::equals ([], (new Blob ('Test ' ))->meta );
38+ }
39+
40+ #[Test]
41+ public function meta () {
42+ $ meta = ['type ' => 'text/plain ' ];
43+ Assert::equals ($ meta , (new Blob ('Test ' , $ meta ))->meta );
44+ }
45+
3546 #[Test, Values(from: 'cases ' )]
3647 public function iteration ($ fixture , $ expected ) {
3748 Assert::equals ($ expected , iterator_to_array ($ fixture ));
You can’t perform that action at this time.
0 commit comments