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

MergeRequest::getFormValues()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
c 0
b 0
f 0
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace TheCodingMachine\Gotenberg;
4
5
final class MergeRequest extends Request implements GotenbergRequestInterface
6
{
7
    /** @var Document[] */
8
    private $files;
9
10
    /**
11
     * OfficeRequest constructor.
12
     * @param Document[] $files
13
     */
14
    public function __construct(array $files)
15
    {
16
        $this->files = $files;
17
    }
18
19
20
    /**
21
     * @return string
22
     */
23
    public function getPostURL(): string
24
    {
25
        return '/merge';
26
    }
27
28
    /**
29
     * @return array<string,mixed>
30
     */
31
    public function getFormValues(): array
32
    {
33
        $values = [];
34
        if (!empty($this->webhookURL)) {
35
            $values[self::WEBHOOK_URL] = $this->webhookURL;
36
        }
37
        return $values;
38
    }
39
40
    /**
41
     * @return array<string,Document>
42
     */
43
    public function getFormFiles(): array
44
    {
45
        $files = [];
46
        foreach ($this->files as $file) {
47
            $files[$file->getFileName()] = $file;
48
        }
49
        return $files;
50
    }
51
}
52