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

DefaultOptions::setDefaults()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 11
rs 10
cc 1
nc 1
nop 0
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