Passed
Pull Request — master (#23)
by Stephen
02:22 queued 10s
created

DefaultOptions   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setDefaults() 0 11 1
A __construct() 0 5 1
1
<?php
2
3
namespace Sfneal\ViewExport\Pdf\Utils;
4
5
use Dompdf\Options;
6
7
class DefaultOptions extends Options
8
{
9
    /**
10
     * DefaultOptions constructor.
11
     *
12
     * @param array|null $attributes
13
     */
14
    public function __construct(array $attributes = null)
15
    {
16
        parent::__construct($attributes);
17
18
        $this->setDefaults();
19
    }
20
21
    /**
22
     * Set the default Dompdf Options.
23
     *
24
     * @return $this
25
     */
26
    private function setDefaults(): self
27
    {
28
        $this->setIsPhpEnabled(config('view-export.php_enabled'));
29
        $this->setIsJavascriptEnabled(config('view-export.javascript_enabled'));
30
        $this->setIsHtml5ParserEnabled(config('view-export.html5_parsable'));
31
        $this->setIsRemoteEnabled(config('view-export.remote_enabled'));
32
33
        // Set file permissions
34
        $this->setChroot(config('view-export.chroot'));
35
36
        return $this;
37
    }
38
}
39