Completed
Push — master ( 1a4c19...c1db7b )
by Ben
02:15
created

EncryptionOptions   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 53
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 3
A getUserPassword() 0 4 1
A getOwnerPassword() 0 4 1
A getUserPermissions() 0 4 1
1
<?php
2
/**
3
 * BaconPdf
4
 *
5
 * @link      http://github.com/Bacon/BaconPdf For the canonical source repository
6
 * @copyright 2015 Ben Scholzen (DASPRiD)
7
 * @license   http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
8
 */
9
10
namespace Bacon\Pdf\Options;
11
12
use Bacon\Pdf\Encryption\Permissions;
13
14
final class EncryptionOptions
15
{
16
    /**
17
     * @var string
18
     */
19
    private $userPassword;
20
21
    /**
22
     * @var string
23
     */
24
    private $ownerPassword;
25
26
    /**
27
     * @var Permissions
28
     */
29
    private $userPermissions;
30
31
    /**
32
     * @param string           $userPassword
33
     * @param string|null      $ownerPassword
34
     * @param Permissions|null $userPermissions
35
     */
36
    public function __construct($userPassword, $ownerPassword = null, Permissions $userPermissions = null)
37
    {
38
        $this->userPassword = $userPassword;
39
        $this->ownerPassword = (null !== $ownerPassword ? $ownerPassword : $userPassword);
40
        $this->userPermissions = (null !== $userPermissions ? $userPermissions : Permissions::allowEverything());
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getUserPassword()
47
    {
48
        return $this->userPassword;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getOwnerPassword()
55
    {
56
        return $this->ownerPassword;
57
    }
58
59
    /**
60
     * @return Permissions
61
     */
62
    public function getUserPermissions()
63
    {
64
        return $this->userPermissions;
65
    }
66
}
67