Completed
Push — master ( 635aa4...d2c914 )
by Tomáš
02:02
created

Base::setName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace TournamentGenerator;
4
5
/**
6
 *
7
 */
8
class Base
9
{
10
11
	private $name = '';
12
	private $id = 'null';
13
14 24
	public function __toString() {
15 24
		return $this->name;
16
	}
17
18 107
	public function setName(string $name) {
19 107
		$this->name = $name;
20 107
	}
21 13
	public function getName() {
22 13
		return $this->name;
23
	}
24 107
	public function setId($id) {
25 107
		if (!is_string($id) && !is_int($id)) {
26 3
			$this->id = uniqid();
27 3
			throw new \Exception('Unsupported id type ('.gettype($id).') - expected type of string or int');
28
		}
29 107
		$this->id = $id;
30 107
	}
31 83
	public function getId() {
32 83
		return $this->id;
33
	}
34
35
}
36