MergeRequest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 9
c 1
b 0
f 0
dl 0
loc 30
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getPostURL() 0 3 1
A getFormFiles() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TheCodingMachine\Gotenberg;
6
7
final class MergeRequest extends Request implements GotenbergRequestInterface
8
{
9
    /** @var Document[] */
10
    private $files;
11
12
    /**
13
     * @param Document[] $files
14
     */
15
    public function __construct(array $files)
16
    {
17
        parent::__construct();
18
        $this->files = $files;
19
    }
20
21
    public function getPostURL(): string
22
    {
23
        return '/merge';
24
    }
25
26
    /**
27
     * @return array<string,Document>
28
     */
29
    public function getFormFiles(): array
30
    {
31
        $files = [];
32
        foreach ($this->files as $file) {
33
            $files[$file->getFileName()] = $file;
34
        }
35
36
        return $files;
37
    }
38
}
39