DataHelper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 56
ccs 2
cts 6
cp 0.3333
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A filter_n() 0 2 1
A filter_an() 0 2 1
A filter_a() 0 2 1
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\OmniKassa;
4
5
use Pronamic\WordPress\Pay\Core\DataHelper as Core_DataHelper;
6
7
/**
8
 * Title: OmniKassa data helper class
9
 * Description:
10
 * Copyright: 2005-2020 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.3
15
 */
16
class DataHelper {
17
	/**
18
	 * N - Indicates that a numerical value [0-9] is accepted
19
	 *
20
	 * @var array
21
	 */
22
	private static $characters_n = array( '0-9' );
23
24
	/**
25
	 * A - Indicates that an alphabetical value [aA-zZ] is accepted
26
	 *
27
	 * @var array
28
	 */
29
	private static $characters_a = array( 'A-Z', 'a-z' );
30
31
	/**
32
	 * A + N
33
	 *
34
	 * @var array
35
	 */
36
	private static $characters_an = array( 'A-Z', 'a-z', '0-9' );
37
38
	/**
39
	 * Filter N characters
40
	 *
41
	 * @param string $string
42
	 * @param string $max
43
	 *
44
	 * @return string
45
	 */
46
	public static function filter_n( $string, $max = null ) {
47
		return Core_DataHelper::filter( self::$characters_n, $string, $max );
0 ignored issues
show
Bug introduced by
It seems like $max can also be of type string; however, parameter $max of Pronamic\WordPress\Pay\Core\DataHelper::filter() does only seem to accept integer|null, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

47
		return Core_DataHelper::filter( self::$characters_n, $string, /** @scrutinizer ignore-type */ $max );
Loading history...
48
	}
49
50
	/**
51
	 * Filter A characters
52
	 *
53
	 * @param string $string
54
	 * @param string $max
55
	 *
56
	 * @return string
57
	 */
58
	public static function filter_a( $string, $max = null ) {
59
		return Core_DataHelper::filter( self::$characters_a, $string, $max );
0 ignored issues
show
Bug introduced by
It seems like $max can also be of type string; however, parameter $max of Pronamic\WordPress\Pay\Core\DataHelper::filter() does only seem to accept integer|null, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

59
		return Core_DataHelper::filter( self::$characters_a, $string, /** @scrutinizer ignore-type */ $max );
Loading history...
60
	}
61
62
	/**
63
	 * Filter A + N characters
64
	 *
65
	 * @param string $string
66
	 * @param string $max
67
	 *
68
	 * @return string
69
	 */
70 2
	public static function filter_an( $string, $max = null ) {
71 2
		return Core_DataHelper::filter( self::$characters_an, $string, $max );
0 ignored issues
show
Bug introduced by
It seems like $max can also be of type string; however, parameter $max of Pronamic\WordPress\Pay\Core\DataHelper::filter() does only seem to accept integer|null, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

71
		return Core_DataHelper::filter( self::$characters_an, $string, /** @scrutinizer ignore-type */ $max );
Loading history...
72
	}
73
}
74