Completed
Push — develop ( e649e8...88dc2a )
by
unknown
15:53 queued 08:30
created

SettingsFieldset::init()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 85
Code Lines 52

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 85
rs 8.6875
cc 1
eloc 52
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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 Applications\Form;
11
12
use Settings\Entity\Hydrator\SettingsEntityHydrator;
13
use Zend\Form\Fieldset;
14
15
//use Zend\InputFilter\InputFilterProviderInterface;
16
17
class SettingsFieldset extends Fieldset
18
{
19
    
20
    public function getHydrator()
21
    {
22
        if (!$this->hydrator) {
23
            $this->setHydrator(new SettingsEntityHydrator());
24
        }
25
        return $this->hydrator;
26
    }
27
28
    public function setObject($object)
29
    {
30
        parent::setObject($object);
31
        /* @var $applyFormSettings \Settings\Form\DisableElementsCapableFormSettingsFieldset */
32
        $applyFormSettings = $this->get('applyFormSettings');
33
        $applyFormSettings->setObject($object->applyFormSettings);
34
        return $this;
35
    }
36
37
    /**
38
     * initialize settings form
39
     */
40
    public function init()
41
    {
42
        $this->setName('emails')
43
             ->setLabel(/* @translate */ 'E-Mail Notifications');
44
45
        $this->add(
46
            array('type' => 'Zend\Form\Element\Checkbox',
47
                'name' => 'mailAccess',
48
                'options' => array('label' => /* @translate */ 'receive E-Mail alert',
49
                                   'long_label' => /* @translate */ 'if checked, you\'ll be informed by mail about new applications.'),
50
                )
51
        );
52
        $this->add(
53
            array('type' => 'Zend\Form\Element\Textarea',
54
                'name' => 'mailAccessText',
55
                'options' => array('label' => /* @translate */ 'Mailtext',
56
                                            'description' => /* @translate */ 'default text of the notification mail about new applications. The following variables can be used:<ul><li>##name## = your name</li><li>##title## = title of the job</li></ul>'))
57
        );
58
        
59
        $this->add(
60
            array('type' => 'Zend\Form\Element\Checkbox',
61
                'name' => 'autoConfirmMail',
62
                'options' => array('label' => /* @translate */ 'confirm application immidiatly after submit',
63
                                   'long_label' => /* @translate */ 'if checked, an application is immediatly confirmed. If unchecked confirmation is the duty of the recruiter.'),
64
                )
65
        );
66
        $this->add(
67
            array('type' => 'Zend\Form\Element\Textarea',
68
                        'name' => 'mailConfirmationText',
69
                         'options' => array('label' => /* @translate */ 'Confirmation mail text',
70
                                            'description' => /* @translate */ 'default text of the acknowledgment of receipt mail to the applicant. The following variables can be used:<br><ul><li>##anrede_formell## = salutation. Includes gender, firstname and lastname.<li>##anrede_informell## = salutation. Includes fistname and lastname.</li><li>##job_title## = title of the jobs</li><li>##name## = name of the applicant.</li><li>##date## = date of recipt of the application.</li></ul>' ))
71
        );
72
        
73
        $this->add(
74
            array('type' => 'Zend\Form\Element\Textarea',
75
                'name' => 'mailInvitationText',
76
                'options' => array('label' => /* @translate */ 'Invitation mail text',
77
                                    'description'=> /* @translate */ 'default text of the invitation mail to the applicant. You can use all variables of the acknowledgment of receipt mail. '
78
                                    ))
79
        );
80
81
        $this->add(
82
            [
83
                'type' => 'Zend\Form\Element\Textarea',
84
                'name' => 'mailAcceptedText',
85
                'options' => [
86
                    'label' => /* @translate */ 'Accept mail text',
87
                    'description'=> /* @translate */ 'default text, when accepting an applicant. This mail is send to by a domain admin to the recruiter, who is responsible for the job posting.'
88
                ]
89
            ]
90
        );
91
        
92
        $this->add(
93
            [
94
                'type' => 'Zend\Form\Element\Textarea',
95
                'name' => 'mailRejectionText',
96
                'options' => [
97
                    'label' => /* @translate */ 'Rejection mail text',
98
                    'description' => /* @translate */ 'default text of the refusal of an application to the applicant. You can use all variables of the acknowledgment of receipt mail.'
99
                ]
100
            ]
101
        );
102
        
103
        $this->add(
104
            [
105
                'type' => 'Zend\Form\Element\Checkbox',
106
                'name' => 'mailBCC',
107
                'options' => [
108
                    'label' => /* @translate */ 'get blind carbon copy of all own mails',
109
                    'long_label' => /* @translate */ 'if checked, you\'ll get a copy of all mails you send.',
110
                    'value_options' => [0, 1, true, false]
111
                ]
112
            ]
113
        );
114
115
        $this->add(
116
            array(
117
            'type' => 'Settings/DisableElementsCapableFormSettingsFieldset',
118
            'name' => 'applyFormSettings',
119
            'options' => array(
120
121
            )
122
            )
123
        );
124
    }
125
}
126