Passed
Push — master ( e2a0dd...677674 )
by Julien
01:40
created

MergeRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 33
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPostURL() 0 3 1
A __construct() 0 3 1
A getFormFiles() 0 7 2
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 '/convert/merge';
26
    }
27
28
    /**
29
     * @return array<string,Document>
30
     */
31
    public function getFormFiles(): array
32
    {
33
        $files = [];
34
        foreach ($this->files as $file) {
35
            $files[$file->getFileName()] = $file;
36
        }
37
        return $files;
38
    }
39
}
40