Completed
Push — develop ( 34a49a...d51da1 )
by
unknown
47s
created

ModuleOptions::setContactImageMimeType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @author cbleek
8
 * @author Miroslav Fedeleš <[email protected]>
9
 * @license   MIT
10
 */
11
12
namespace Applications\Options;
13
14
use Zend\Stdlib\AbstractOptions;
15
16
/**
17
 * Class ModuleOptions
18
 *
19
 * Default options of the Applications Module
20
 *
21
 * @package Applications\Options
22
 */
23
class ModuleOptions extends AbstractOptions
24
{
25
26
    /**
27
     * maximum size in bytes of an attachment. Default 5MB
28
     *
29
     * @var int $attachmentsMaxSize
30
     */
31
    protected $attachmentsMaxSize = 5000000;
32
33
    /**
34
     * valid Mime-Types of attachments
35
     *
36
     * @var array $attachmentsMimeType
37
     */
38
    protected $attachmentsMimeType = array('image','applications/pdf',
39
        'application/x-pdf',
40
        'application/acrobat',
41
        'applications/vnd.pdf',
42
        'text/pdf',
43
        'text/x-pdf');
44
45
    /**
46
     * maximum number of attachments. Default 3
47
     *
48
     * @var int $attachmentsCount
49
     */
50
    protected $attachmentsCount = 3;
51
52
    /**
53
     * maximum size of an user image. Default 200 kB
54
     *
55
     * @var int $contactImageMaxSize
56
     */
57
    protected $contactImageMaxSize = 200000;
58
59
    /**
60
     * allowed Mime-Type of a user image
61
     *
62
     * @var array $contactImageMimeType
63
     */
64
    protected $contactImageMimeType = array('image');
65
66
    /**
67
     * Generally allowed Mime Types
68
     *
69
     * @var array $allowedMimeTypes
70
     */
71
    protected $allowedMimeTypes = array('image',
72
                                        'applications/pdf',
73
                                        'application/x-pdf',
74
                                        'application/acrobat',
75
                                        'applications/vnd.pdf',
76
                                        'text/pdf',
77
                                        'text/x-pdf',
78
                                        'text');
79
80
81
    protected $workflow = [
82
83
      'recruiter',
84
    ];
85
    
86
    /**
87
     * Flag indicating whether subsequent attachment uploads are allowed
88
     *
89
     * @var bool
90
     */
91
    protected $allowSubsequentAttachmentUpload = false;
92
93
    /**
94
     * Gets the maximum size of attachments in bytes
95
     *
96
     * @return int
97
     */
98
    public function getAttachmentsMaxSize()
99
    {
100
        return $this->attachmentsMaxSize;
101
    }
102
    /**
103
     * Sets the maximum size of attachments in bytes
104
     *
105
     * @param int $size
106
     * @return ModuleOptions
107
     */
108
    public function setAttachmentsMaxSize($size)
109
    {
110
        $this->attachmentsMaxSize = $size;
111
        return $this;
112
    }
113
114
    /**
115
     * Gets the the allowed Mime-Types for attachments
116
     *
117
     * @return array
118
     */
119
    public function getAttachmentsMimeType()
120
    {
121
        return $this->attachmentsMimeType;
122
    }
123
    /**
124
     * Sets the maximum size of attachments in bytes
125
     *
126
     * @param array $mime
127
     * @return ModuleOptions
128
     */
129
    public function setAttachmentsMimeType(array $mime)
130
    {
131
        $this->attachmentsMimeType = $mime;
132
        return $this;
133
    }
134
135
    /**
136
     * Gets the the maximum number of allowed attachments
137
     *
138
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be integer?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
139
     */
140
    public function getAttachmentsCount()
141
    {
142
        return $this->attachmentsCount;
143
    }
144
    /**
145
     * Sets the maximum number of allowed attachments
146
     *
147
     * @param string $number
148
     * @return ModuleOptions
149
     */
150
    public function setAttachmentsCount($number)
151
    {
152
        $this->attachmentsCount = $number;
0 ignored issues
show
Documentation Bug introduced by
The property $attachmentsCount was declared of type integer, but $number is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
153
        return $this;
154
    }
155
156
    /**
157
     * Gets the the maximum size of contact images in bytes
158
     *
159
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be integer?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
160
     */
161
    public function getContactImageMaxSize()
162
    {
163
        return $this->contactImageMaxSize;
164
    }
165
    /**
166
     * Sets the maximum size of contact images in bytes
167
     *
168
     * @param string $size
169
     * @return ModuleOptions
170
     */
171
    public function setContactImageMaxSize($size)
172
    {
173
        $this->contactImageMaxSize = $size;
0 ignored issues
show
Documentation Bug introduced by
The property $contactImageMaxSize was declared of type integer, but $size is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
174
        return $this;
175
    }
176
177
    /**
178
     * Gets the allowed Mime-Types for contact images
179
     *
180
     * @return array
181
     */
182
    public function getContactImageMimeType()
183
    {
184
        return $this->contactImageMimeType;
185
    }
186
    /**
187
     * Sets the allowed Mime-Types for contact images
188
     *
189
     * @param array $mime
190
     * @return ModuleOptions
191
     */
192
    public function setContactImageMimeType($mime)
193
    {
194
        $this->contactImageMimeType = $mime;
195
        return $this;
196
    }
197
198
    /**
199
     * Gets the allowed Mime-Types for contact images
200
     *
201
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be array?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
202
     */
203
    public function getAllowedMimeTypes()
204
    {
205
        return $this->allowedMimeTypes;
206
    }
207
208
    /**
209
     * Sets the allowed Mime-Types
210
     *
211
     * @param array $array
212
     * @return ModuleOptions
213
     */
214
    public function setAllowedMimeTypes($array)
215
    {
216
        $this->allowedMimeTypes = $array;
217
        return $this;
218
    }
219
    
220
    /**
221
	 * @return boolean
222
	 * @since 0.27
223
	 */
224
	public function getAllowSubsequentAttachmentUpload()
0 ignored issues
show
Coding Style introduced by
function getAllowSubsequentAttachmentUpload() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
225
	{
226
		return $this->allowSubsequentAttachmentUpload;
227
	}
228
229
    /**
230
     * @param boolean $allowSubsequentAttachmentUpload
231
     * @return ModuleOptions
232
     * @since 0.27
233
     */
234
    public function setAllowSubsequentAttachmentUpload($allowSubsequentAttachmentUpload)
235
    {
236
        $this->allowSubsequentAttachmentUpload = (bool)$allowSubsequentAttachmentUpload;
237
        
238
        return $this;
239
    }
240
241
}