WithSkipSetters::setSkip()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
4
namespace TournamentGenerator\Traits;
5
6
7
use TournamentGenerator\Interfaces\WithSkipSetters as WithSkipSettersInterface;
8
9
/**
10
 * Trait WithSkipSetters
11
 *
12
 * @package TournamentGenerator\Traits
13
 * @author  Tomáš Vojík <[email protected]>
14
 * @since   0.4
15
 */
16
trait WithSkipSetters
17
{
18
19
	/** @var bool If the number of teams is less than $this->inGame, then skip playing this round */
20
	private bool $allowSkip = false;
21
22
23
	/**
24
	 * Allows round skipping
25
	 *
26
	 * @return $this
27
	 */
28 32
	public function allowSkip() : WithSkipSettersInterface {
29 32
		$this->allowSkip = true;
30 32
		return $this;
31
	}
32
33
	/**
34
	 * Disallow round skipping
35
	 *
36
	 * @return $this
37
	 */
38 4
	public function disallowSkip() : WithSkipSettersInterface {
39 4
		$this->allowSkip = false;
40 4
		return $this;
41
	}
42
43
	/**
44
	 * Set round skipping
45
	 *
46
	 * @param bool $skip
47
	 *
48
	 * @return $this
49
	 */
50 191
	public function setSkip(bool $skip) : WithSkipSettersInterface {
51 191
		$this->allowSkip = $skip;
52 191
		return $this;
53
	}
54
55
	/**
56
	 * Getter for round skipping
57
	 *
58
	 * @return bool
59
	 */
60 154
	public function getSkip() : bool {
61 154
		return $this->allowSkip;
62
	}
63
}