Completed
Push — develop ( ce465f...dc3813 )
by David
02:29 queued 11s
created

Abstract_Autocomplete_Service   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A filter() 0 12 1
1
<?php
2
3
namespace Wordlift\Autocomplete;
4
5
abstract class Abstract_Autocomplete_Service implements Autocomplete_Service {
6
7
	protected function filter( $results, $excludes ) {
8
9
		$excludes_array = (array) $excludes;
10
11
		return array_filter( $results, function ( $item ) use ( $excludes_array ) {
12
13
			return 0 === count( array_intersect(
14
					array_merge( (array) $item['id'], $item['sameAss'] ),
15
					$excludes_array
16
				) );
17
		} );
18
	}
19
20
}