Passed
Push — master ( 0e4a87...bf2039 )
by Tomáš
01:54
created

isPowerOf2()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TournamentGenerator;
4
5
define('DUMMY_TEAM', 'dummyRozlosTeam');
6
define('groupTypes', [
7
	'R_R' => 'Robin-Robin',
8
	'TWO_TWO' => 'team plays only once',
9
	'COND_SPLIT' => 'dependent on condition'
10
]);
11
define('orderingTypes', [
12
	'POINTS' => 'order based on points aqquired',
13
	'SCORE' => 'order based on total score'
14
]);
15
foreach (groupTypes as $key => $value) {
16
	define($key, $value);
17
}
18
foreach (orderingTypes as $key => $value) {
19
	define($key, $value);
20
}
21
22
// IF NUMBER IS POWER OF 2
23
function isPowerOf2(int $x) {
24
	return ($x !== 0) && ($x&($x-1)) === 0;
25
}
26