Driver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 26
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFullPath() 0 7 2
1
<?php
2
3
namespace Traincase\HtmlToPdfTinker\Drivers;
4
5
use League\Flysystem\Filesystem;
6
use Traincase\HtmlToPdfTinker\DTO\PdfToGenerateDTO;
7
use Traincase\HtmlToPdfTinker\Exceptions\UnsupportedOutputTypeException;
8
9
abstract class Driver
10
{
11
    /**
12
     * Create the PDF and return it in string format.
13
     *
14
     * @param Filesystem $filesystem Filesystem used for storing the PDF
15
     * @param PdfToGenerateDTO $dto Data needed to generate the PDF file
16
     * @return string Filepath to the generated PDF file
17
     * @throws UnsupportedOutputTypeException
18
     */
19
    abstract public function storeOnFilesystem(Filesystem $filesystem, PdfToGenerateDTO $dto): string;
20
21
    /**
22
     * Get the full path to a file based on a path and a filename;
23
     *
24
     * @param string $path
25
     * @param string $filename
26
     * @return string
27
     */
28 4
    public function getFullPath(string $path, string $filename): string
29
    {
30 4
        if ($path !== '/') {
31 4
            $path = rtrim($path, '/');
32
        }
33
34 4
        return "{$path}/{$filename}";
35
    }
36
}
37