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

Base   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 25
ccs 15
cts 15
cp 1
rs 10
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setId() 0 6 3
A __toString() 0 2 1
A getName() 0 2 1
A setName() 0 2 1
A getId() 0 2 1
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