js/payone/core/klarna.js   A
last analyzed

Complexity

Total Complexity 6
Complexity/F 6

Size

Lines of Code 21
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
dl 0
loc 21
rs 10
cc 0
nc 1
mnd 1
bc 3
fnc 1
bpm 3
cpm 6
noi 3
1
/**
2
 *
3
 * NOTICE OF LICENSE
4
 *
5
 * This source file is subject to the GNU General Public License (GPL 3)
6
 * that is bundled with this package in the file LICENSE.txt
7
 *
8
 * DISCLAIMER
9
 *
10
 * Do not edit or add to this file if you wish to upgrade Payone_Core to newer
11
 * versions in the future. If you wish to customize Payone_Core for your
12
 * needs please refer to http://www.payone.de for more information.
13
 *
14
 * @category        Payone
15
 * @package         js
16
 * @subpackage      payone
17
 * @copyright       Copyright (c) 2013 <[email protected]> - www.noovias.com
18
 * @author          Alexander Dite <[email protected]>
19
 * @license         <http://www.gnu.org/licenses/> GNU General Public License (GPL 3)
20
 * @link            http://www.noovias.com
21
 */
22
23
function payoneKlarnaCustomerDobInput(output_element)
24
{
25
    var daySelect = $('payone_klarna_additional_fields_customer_dob_day');
26
    var monthSelect = $('payone_klarna_additional_fields_customer_dob_month');
27
    var yearSelect = $('payone_klarna_additional_fields_customer_dob_year');
28
    if(output_element == 'payone_financing_klarna_additional_fields_customer_dob_full') {
29
        var daySelect = $('payone_financing_klarna_additional_fields_customer_dob_day');
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable daySelect already seems to be declared on line 25. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
30
        var monthSelect = $('payone_financing_klarna_additional_fields_customer_dob_month');
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable monthSelect already seems to be declared on line 26. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
31
        var yearSelect = $('payone_financing_klarna_additional_fields_customer_dob_year');
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable yearSelect already seems to be declared on line 27. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
32
    }
33
34
    var hiddenDobFull = $(output_element);
35
36
    if (daySelect == undefined || monthSelect == undefined || yearSelect == undefined
37
        || hiddenDobFull == undefined)  {
38
        return;
39
    }
40
41
    hiddenDobFull.value = yearSelect.value + "-" + monthSelect.value + "-" + daySelect.value
42
        + " 00:00:00";
43
}