Completed
Push — master ( 70d730...bda182 )
by Jeroen De
09:35
created

functions.php ➔ iterable_to_array()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
/**
6
 * @license GNU GPL v2+
7
 * @author Jeroen De Dauw < [email protected] >
8
 */
9
10
function iterable_to_array( iterable $iterable ): array {
11
	if ( is_array( $iterable ) ) {
12
		return $iterable;
13
	}
14
15
	return iterator_to_array( $iterable );
16
}
17