DataCreditCardHelper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 32
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A set_number() 0 2 1
A set_security_code() 0 2 1
A set_expiration_date() 0 2 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\Ingenico;
4
5
use DateTime;
6
7
/**
8
 * Title: Ingenico data default helper class
9
 * Description:
10
 * Copyright: 2005-2021 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.0
15
 * @since   1.0.0
16
 */
17
class DataCreditCardHelper extends DataHelper {
18
	/**
19
	 * Set credit card number.
20
	 *
21
	 * @param int $number Credit card number.
22
	 *
23
	 * @return DataCreditCardHelper
24
	 */
25 1
	public function set_number( $number ) {
26 1
		return $this->set_field( 'CARDNO', $number );
27
	}
28
29
	/**
30
	 * Set expiration date.
31
	 *
32
	 * @param DateTime $date Expiration date.
33
	 *
34
	 * @return DataCreditCardHelper
35
	 */
36 1
	public function set_expiration_date( DateTime $date ) {
37 1
		return $this->set_field( 'ED', $date->format( Ingenico::EXPIRATION_DATE_FORMAT ) );
38
	}
39
40
	/**
41
	 * Set security code.
42
	 *
43
	 * @param string $security_code Security code.
44
	 *
45
	 * @return DataCreditCardHelper
46
	 */
47 1
	public function set_security_code( $security_code ) {
48 1
		return $this->set_field( 'CVC', $security_code );
49
	}
50
}
51