Completed
Push — develop ( a3bac5...6cab8d )
by
unknown
07:34
created

ModuleOptions::isAutoAccept()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @author cbleek
8
 * @license   MIT
9
 */
10
11
namespace Applications\Options;
12
13
use Zend\Stdlib\AbstractOptions;
14
15
/**
16
 * Class ModuleOptions
17
 *
18
 * Default options of the Applications Module
19
 *
20
 * @package Applications\Options
21
 */
22
class ModuleOptions extends AbstractOptions
23
{
24
25
    /**
26
     * maximum size in bytes of an attachment. Default 5MB
27
     *
28
     * @var int $attachmentsMaxSize
29
     */
30
    protected $attachmentsMaxSize = 5000000;
31
32
    /**
33
     * valid Mime-Types of attachments
34
     *
35
     * @var array $attachmentsMimeType
36
     */
37
    protected $attachmentsMimeType = array('image','applications/pdf',
38
        'application/x-pdf',
39
        'application/acrobat',
40
        'applications/vnd.pdf',
41
        'text/pdf',
42
        'text/x-pdf');
43
44
    /**
45
     * maximum number of attachments. Default 3
46
     *
47
     * @var int $attachmentsCount
48
     */
49
    protected $attachmentsCount = 3;
50
51
    /**
52
     * maximum size of an user image. Default 200 kB
53
     *
54
     * @var int $contactImageMaxSize
55
     */
56
    protected $contactImageMaxSize = 200000;
57
58
    /**
59
     * allowed Mime-Type of a user image
60
     *
61
     * @var array $contactImageMimeType
62
     */
63
    protected $contactImageMimeType = array('image');
64
65
    /**
66
     * Generally allowed Mime Types
67
     *
68
     * @var array $allowedMimeTypes
69
     */
70
    protected $allowedMimeTypes = array('image',
71
                                        'applications/pdf',
72
                                        'application/x-pdf',
73
                                        'application/acrobat',
74
                                        'applications/vnd.pdf',
75
                                        'text/pdf',
76
                                        'text/x-pdf',
77
                                        'text');
78
79
    /**
80
     * Automatically accept Applications. If true, incoming Applications are
81
     * automatically forwarded to the recruiter.
82
     *
83
     * @var bool $autoAccept
84
     */
85
    protected $autoAccept = true;
86
87
    /**
88
     * Gets the autoAccept flag
89
     *
90
     * @return bool
91
     */
92
    public function isAutoAccept()
93
    {
94
        return $this->autoAccept;
95
    }
96
    /**
97
     * Sets the the autoAccept Flag.
98
     *
99
     * @param bool $autoAccept
100
     * @return ModuleOptions
101
     */
102
    public function setAutoAccept($autoAccept)
103
    {
104
        $this->autoAccept = $autoAccept;
105
        return $this;
106
    }
107
108
109
    /**
110
     * Gets the maximum size of attachments in bytes
111
     *
112
     * @return int
113
     */
114
    public function getAttachmentsMaxSize()
115
    {
116
        return $this->attachmentsMaxSize;
117
    }
118
    /**
119
     * Sets the maximum size of attachments in bytes
120
     *
121
     * @param int $size
122
     * @return ModuleOptions
123
     */
124
    public function setAttachmentsMaxSize($size)
125
    {
126
        $this->attachmentsMaxSize = $size;
127
        return $this;
128
    }
129
130
    /**
131
     * Gets the the allowed Mime-Types for attachments
132
     *
133
     * @return array
134
     */
135
    public function getAttachmentsMimeType()
136
    {
137
        return $this->attachmentsMimeType;
138
    }
139
    /**
140
     * Sets the maximum size of attachments in bytes
141
     *
142
     * @param array $mime
143
     * @return ModuleOptions
144
     */
145
    public function setAttachmentsMimeType(array $mime)
146
    {
147
        $this->attachmentsMimeType = $mime;
148
        return $this;
149
    }
150
151
    /**
152
     * Gets the the maximum number of allowed attachments
153
     *
154
     * @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...
155
     */
156
    public function getAttachmentsCount()
157
    {
158
        return $this->attachmentsCount;
159
    }
160
    /**
161
     * Sets the maximum number of allowed attachments
162
     *
163
     * @param string $number
164
     * @return ModuleOptions
165
     */
166
    public function setAttachmentsCount($number)
167
    {
168
        $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...
169
        return $this;
170
    }
171
172
    /**
173
     * Gets the the maximum size of contact images in bytes
174
     *
175
     * @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...
176
     */
177
    public function getContactImageMaxSize()
178
    {
179
        return $this->contactImageMaxSize;
180
    }
181
    /**
182
     * Sets the maximum size of contact images in bytes
183
     *
184
     * @param string $size
185
     * @return ModuleOptions
186
     */
187
    public function setContactImageMaxSize($size)
188
    {
189
        $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...
190
        return $this;
191
    }
192
193
    /**
194
     * Gets the allowed Mime-Types for contact images
195
     *
196
     * @return array
197
     */
198
    public function getContactImageMimeType()
199
    {
200
        return $this->contactImageMimeType;
201
    }
202
    /**
203
     * Sets the allowed Mime-Types for contact images
204
     *
205
     * @param array $mime
206
     * @return ModuleOptions
207
     */
208
    public function setContactImageMimeType($mime)
209
    {
210
        $this->contactImageMimeType = $mime;
211
        return $this;
212
    }
213
214
    /**
215
     * Gets the allowed Mime-Types for contact images
216
     *
217
     * @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...
218
     */
219
    public function getAllowedMimeTypes()
220
    {
221
        return $this->allowedMimeTypes;
222
    }
223
224
    /**
225
     * Sets the allowed Mime-Types
226
     *
227
     * @param array $array
228
     * @return ModuleOptions
229
     */
230
    public function setAllowedMimeTypes($array)
231
    {
232
        $this->allowedMimeTypes = $array;
233
        return $this;
234
    }
235
}
236