Completed
Branch FET-10896-improvements-to-floa... (000e49)
by
unknown
163:03 queued 150:10
created

EE_Float_Input   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 33
loc 33
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 25 25 5

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
defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed.');
3
4
/**
5
 * EE_Float_Input
6
 *
7
 * @package               Event Espresso
8
 * @subpackage
9
 * @author                Mike Nelson
10
 */
11 View Code Duplication
class EE_Float_Input extends EE_Form_Input_Base
12
{
13
14
    /**
15
     * @param array $input_settings
16
     * @throws InvalidArgumentException
17
     */
18
    public function __construct($input_settings = array())
19
    {
20
        $this->_set_display_strategy(
21
            new EE_Number_Input_Display_Strategy(
22
                isset($input_settings['min_value'])
23
                    ? $input_settings['min_value']
24
                    : null,
25
                isset($input_settings['max_value'])
26
                    ? $input_settings['max_value']
27
                    : null,
28
                isset($input_settings['step_value'])
29
                    ? $input_settings['step_value']
30
                    : null
31
            )
32
        );
33
        $this->_set_normalization_strategy(new EE_Float_Normalization());
34
        $this->_add_validation_strategy(
35
            new EE_Float_Validation_Strategy(
36
                isset($input_settings['validation_error_message'])
37
                    ? $input_settings['validation_error_message']
38
                    : null
39
            )
40
        );
41
        parent::__construct($input_settings);
42
    }
43
}
44