Passed
Push — main ( 092ab8...bd6443 )
by Yaroslav
02:32
created

HasTemplate::sourceTemplateDisk()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 6
rs 10
1
<?php
2
3
namespace LPDFBuilder\Generation;
4
5
use Illuminate\Support\Facades\Storage;
6
7
trait HasTemplate
8
{
9
    protected ?string $sourceTemplateDisk = null;
10
    protected ?string $sourceTemplateName = null;
11
12
    /**
13
     * Get template storage disk.
14
     *
15
     * @return string|null
16
     */
17
    protected function sourceTemplateDisk(): ?string
18
    {
19
        return $this->sourceTemplateDisk?:config('pdf-builder.templates-storage');
20
    }
21
22
    /**
23
     * Get path to file template.
24
     *
25
     * @return string|null
26
     */
27 4
    protected function sourceFileTemplatePath(): ?string
28
    {
29 4
        return $this->sourceTemplateName?Storage::disk($this->sourceTemplateDisk)->path($this->sourceTemplateName):null;
30
    }
31
}
32