Completed
Pull Request — develop (#235)
by ANTHONIUS
08:47
created

SearchFormFieldset   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 52
Duplicated Lines 88.46 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 1
dl 46
loc 52
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B init() 46 46 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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\Form;
11
12
use Core\Form\TextSearchFormFieldset;
13
14
class SearchFormFieldset extends TextSearchFormFieldset
15
{
16
17
    protected $locationEngineType = 'photon';
18
19 View Code Duplication
    public function init()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        $this->addTextElement(
22
            'Search',
23
            /*@translate*/
24
            'Search for Applicant Name'
25
        );
26
27
        $this->add(
28
            array(
29
                'name' => 'l',
30
                'type' => 'Location',
31
                'options' => array(
32
                    'label' => /*@translate*/
33
                        'Location',
34
                    'engine_type' => $this->locationEngineType,
35
                ),
36
            )
37
        );
38
39
        $this->add(
40
            array(
41
                'name' => 'd',
42
                'type' => 'Zend\Form\Element\Select',
43
                'options' => array(
44
                    'label' => /*@translate*/
45
                        'Distance',
46
                    'value_options' => [
47
                        '5' => '5 km',
48
                        '10' => '10 km',
49
                        '20' => '20 km',
50
                        '50' => '50 km',
51
                        '100' => '100 km'
52
                    ],
53
54
                ),
55
                'attributes' => [
56
                    'value' => '10', // default distance
57
                    'data-searchbox' => -1,  // hide the search box
58
                    'data-allowclear' => 'false', // allow to clear a selected value
59
                    'data-placeholder' => /*@translate*/
60
                        'Distance',
61
                ]
62
            )
63
        );
64
    }
65
}