StructCollection example

'extensions' => [
                    'myExtension' => null,
                ],
                'apiAlias' => 'test-struct',
            ],
            $encoded
        );
    }

    public function testCollectionEncoding(): void
    {
        $collection = new StructCollection();
        $collection->add(new MyTestStruct(1, 1));
        $collection->add(new MyTestStruct(2, 2));
        $collection->add(new MyTestStruct(3, 3));

        $foo = new MyTestStruct('foo', $collection);

        $fields = new ResponseFields([
            'test-struct' => ['foo', 'bar'],
        ]);

        $encoded = $this->encoder->encode($foo$fields);

        
Home | Imprint | This part of the site doesn't use cookies.