MarkdownRequest::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TheCodingMachine\Gotenberg;
6
7
final class MarkdownRequest extends HTMLRequest implements GotenbergRequestInterface
8
{
9
    /** @var Document[] */
10
    private $markdowns;
11
12
    /**
13
     * @param Document[] $markdowns
14
     */
15
    public function __construct(Document $index, array $markdowns)
16
    {
17
        parent::__construct($index);
18
        $this->markdowns = $markdowns;
19
    }
20
21
    public function getPostURL(): string
22
    {
23
        return '/convert/markdown';
24
    }
25
26
    /**
27
     * @return array<string,Document>
28
     */
29
    public function getFormFiles(): array
30
    {
31
        $files = parent::getFormFiles();
32
        foreach ($this->markdowns as $markdown) {
33
            $files[$markdown->getFileName()] = $markdown;
34
        }
35
36
        return $files;
37
    }
38
}
39