Passed
Pull Request — master (#25)
by Stephen
03:16
created

DefaultOptions::setPortrait()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 5
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
    /**
40
     * Set the paper orientation to 'landscape'.
41
     *
42
     * @return $this
43
     */
44
    public function setLandscape(): self
45
    {
46
        $this->setDefaultPaperOrientation('landscape');
47
48
        return $this;
49
    }
50
51
    /**
52
     * Set the paper orientation to 'portrait'.
53
     *
54
     * @return $this
55
     */
56
    public function setPortrait(): self
57
    {
58
        $this->setDefaultPaperOrientation('portrait');
59
60
        return $this;
61
    }
62
}
63