Skip to content

Commit addf891

Browse files
committed
add current param to InsertDocumentParameters
1 parent 0178d70 commit addf891

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/Parameters/InsertDocumentParameters.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,20 @@
2727
*/
2828
final class InsertDocumentParameters extends MetaParameters
2929
{
30-
/** @var array<string,array{filename: string, downloadable: bool|null, removable: bool|null}> */
30+
/** @var array<string,array{filename: string, downloadable: bool|null, removable: bool|null, current: bool|null}> */
3131
private array $presentations = [];
3232

3333
public function __construct(protected string $meetingID)
3434
{
3535
}
3636

37-
public function addPresentation(string $url, string $filename, ?bool $downloadable = null, ?bool $removable = null): self
37+
public function addPresentation(string $url, string $filename, ?bool $downloadable = null, ?bool $removable = null, ?bool $current = null): self
3838
{
3939
$this->presentations[$url] = [
4040
'filename' => $filename,
4141
'downloadable' => $downloadable,
4242
'removable' => $removable,
43+
'current' => $current,
4344
];
4445

4546
return $this;
@@ -73,6 +74,10 @@ public function getPresentationsAsXML(): string|false
7374
if (\is_bool($content['removable'])) {
7475
$presentation->addAttribute('removable', $content['removable'] ? 'true' : 'false');
7576
}
77+
78+
if (\is_bool($content['current'])) {
79+
$presentation->addAttribute('current', $content['current'] ? 'true' : 'false');
80+
}
7681
}
7782
$result = $xml->asXML();
7883
}

tests/fixtures/insert_document_presentations.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
<document url="http://localhost/foobar.png" filename="Foobar.png"/>
55
<document url="http://localhost/foobar.pdf" filename="Foobar.pdf" downloadable="true"/>
66
<document url="http://localhost/foobar.svg" filename="Foobar.svg" downloadable="true" removable="false"/>
7+
<document url="http://localhost/foobar.jpg" filename="Foobar.jpg" downloadable="true" removable="true" current="true"/>
78
</module>
89
</modules>

tests/unit/Parameters/InsertDocumentParametersTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function testInsertingDocuments(): void
3535
$params->addPresentation('http://localhost/foobar.png', 'Foobar.png');
3636
$params->addPresentation('http://localhost/foobar.pdf', 'Foobar.pdf', true);
3737
$params->addPresentation('http://localhost/foobar.svg', 'Foobar.svg', true, false);
38+
$params->addPresentation('http://localhost/foobar.jpg', 'Foobar.jpg', true, true, true);
3839
$params->addPresentation('http://localhost/demo.pdf', 'Demo.pdf', true);
3940

4041
// Removing presentation

0 commit comments

Comments
 (0)