Completed
Push — master ( cdcbf9...7e5724 )
by Julien
05:30
created

MarkdownRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 9
dl 0
loc 35
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFormFiles() 0 7 2
A getPostURL() 0 3 1
1
<?php
2
3
namespace TheCodingMachine\Gotenberg;
4
5
final class MarkdownRequest extends HTMLRequest
6
{
7
    /** @var Document[] */
8
    private $markdowns;
9
10
    /**
11
     * MarkdownRequest constructor.
12
     * @param Document $index
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
22
    /**
23
     * @return string
24
     */
25
    public function getPostURL(): string
26
    {
27
        return '/convert/markdown';
28
    }
29
30
    /**
31
     * @return array<string,Document>
32
     */
33
    public function getFormFiles(): array
34
    {
35
        $files = parent::getFormFiles();
36
        foreach ($this->markdowns as $markdown) {
37
            $files[$markdown->getFileName()] = $markdown;
38
        }
39
        return $files;
40
    }
41
}
42