PdfOptimizerJobData::make()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 7
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Mostafaznv\PdfOptimizer\DTOs;
4
5
use Illuminate\Support\Str;
6
use Mostafaznv\PdfOptimizer\Laravel\Concerns\Disk;
7
use Mostafaznv\PdfOptimizer\Laravel\Concerns\File;
8
use Psr\Log\LoggerInterface;
9
10
11
readonly class PdfOptimizerJobData
12
{
13
    public function __construct(
14
        public string           $id,
15
        public array            $commands,
16
        public string           $input,
17
        public string           $output,
18
        public ?File            $file = null,
19
        public ?Disk            $disk = null,
20
        public ?LoggerInterface $logger = null,
21
        public int              $timeout = 900
22
    ) {}
23
24
    public static function make(array $commands, string $input, string $output, File $file, ?Disk $disk = null, ?LoggerInterface $logger = null, int $timeout = 900): self
25
    {
26
        $id = Str::orderedUuid()->toString();
27
28
        return new self($id, $commands, $input, $output, $file, $disk, $logger, $timeout);
29
    }
30
}
31