|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace Cv\Options; |
|
11
|
|
|
|
|
12
|
|
|
use Zend\Stdlib\AbstractOptions; |
|
13
|
|
|
use Zend\ServiceManager\ServiceManager; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Default options of the CV Module |
|
17
|
|
|
* |
|
18
|
|
|
* @author fedys |
|
19
|
|
|
* @since 0.26 |
|
20
|
|
|
*/ |
|
21
|
|
|
class ModuleOptions extends AbstractOptions |
|
22
|
|
|
{ |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* maximum size in bytes of an attachment. Default 5MB |
|
26
|
|
|
* |
|
27
|
|
|
* @var int $attachmentsMaxSize |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $attachmentsMaxSize = 5000000; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* valid Mime-Types of attachments |
|
33
|
|
|
* |
|
34
|
|
|
* @var array $attachmentsMimeType |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $attachmentsMimeType = array('image','applications/pdf', |
|
37
|
|
|
'application/x-pdf', |
|
38
|
|
|
'application/acrobat', |
|
39
|
|
|
'applications/vnd.pdf', |
|
40
|
|
|
'text/pdf', |
|
41
|
|
|
'text/x-pdf'); |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* maximum number of attachments. Default 3 |
|
45
|
|
|
* |
|
46
|
|
|
* @var int $attachmentsCount |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $attachmentsCount = 3; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Gets the maximum size of attachments in bytes |
|
52
|
|
|
* |
|
53
|
|
|
* @return int |
|
54
|
|
|
*/ |
|
55
|
|
|
public function getAttachmentsMaxSize() |
|
56
|
|
|
{ |
|
57
|
|
|
return $this->attachmentsMaxSize; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Sets the maximum size of attachments in bytes |
|
62
|
|
|
* |
|
63
|
|
|
* @param int $size |
|
64
|
|
|
* @return ModuleOptions |
|
65
|
|
|
*/ |
|
66
|
|
|
public function setAttachmentsMaxSize($size) |
|
67
|
|
|
{ |
|
68
|
|
|
$this->attachmentsMaxSize = $size; |
|
69
|
|
|
return $this; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Gets the the allowed Mime-Types for attachments |
|
74
|
|
|
* |
|
75
|
|
|
* @return array |
|
76
|
|
|
*/ |
|
77
|
|
|
public function getAttachmentsMimeType() |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->attachmentsMimeType; |
|
80
|
|
|
} |
|
81
|
|
|
/** |
|
82
|
|
|
* Sets the maximum size of attachments in bytes |
|
83
|
|
|
* |
|
84
|
|
|
* @param array $mime |
|
85
|
|
|
* @return ModuleOptions |
|
86
|
|
|
*/ |
|
87
|
|
|
public function setAttachmentsMimeType(array $mime) |
|
88
|
|
|
{ |
|
89
|
|
|
$this->attachmentsMimeType = $mime; |
|
90
|
|
|
return $this; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Gets the the maximum number of allowed attachments |
|
95
|
|
|
* |
|
96
|
|
|
* @return string |
|
|
|
|
|
|
97
|
|
|
*/ |
|
98
|
|
|
public function getAttachmentsCount() |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->attachmentsCount; |
|
101
|
|
|
} |
|
102
|
|
|
/** |
|
103
|
|
|
* Sets the maximum number of allowed attachments |
|
104
|
|
|
* |
|
105
|
|
|
* @param string $number |
|
106
|
|
|
* @return ModuleOptions |
|
107
|
|
|
*/ |
|
108
|
|
|
public function setAttachmentsCount($number) |
|
109
|
|
|
{ |
|
110
|
|
|
$this->attachmentsCount = $number; |
|
|
|
|
|
|
111
|
|
|
return $this; |
|
112
|
|
|
} |
|
113
|
|
|
} |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.