Completed
Push — develop ( 728aa6...c30dd4 )
by
unknown
17:43 queued 10:24
created

ModuleOptions::setAttachmentsMaxSize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
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
 * @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
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...
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;
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...
111
        return $this;
112
    }
113
}