Completed
Push — master ( 996d66...c95bf7 )
by Jeroen De
58:45
created

TrackingDataSelector   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFirstNonEmptyValue() 0 4 2
A concatTrackingFromVarTuple() 0 7 2
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\Infrastructure;
6
7
/**
8
 * @license GNU GPL v2+
9
 * @author Gabriel Birke < [email protected] >
10
 * @author Kai Nissen < [email protected] >
11
 */
12
class TrackingDataSelector {
13
14 149
	public static function getFirstNonEmptyValue( array $values ): string {
15 149
		$nonEmptyValues = array_filter( $values );
16 149
		return count( $nonEmptyValues ) > 0 ? array_shift( $nonEmptyValues ) : '';
17
	}
18
19 145
	public static function concatTrackingFromVarTuple( string $campaign, string $keyword ): string {
20 145
		if ( $campaign !== '' ) {
21 14
			return strtolower( implode( '/', array_filter( [ $campaign, $keyword ] ) ) );
22
		}
23
24 133
		return '';
25
	}
26
}