Completed
Push — master ( ffbb02...68e5b2 )
by smiley
02:42
created

CreateDatabaseAbstract::charset()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
rs 9.6666
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
/**
3
 * Class CreateDatabaseAbstract
4
 *
5
 * @filesource   CreateDatabaseAbstract.php
6
 * @created      12.06.2017
7
 * @package      chillerlan\Database\Query
8
 * @author       Smiley <[email protected]>
9
 * @copyright    2017 Smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\Database\Query;
14
15
class CreateDatabaseAbstract extends StatementAbstract implements CreateDatabaseInterface{
16
17
	protected $name;
18
	protected $ifNotExists = false;
19
	protected $collate = 'utf8';
20
21
	public function ifNotExists():CreateDatabaseInterface{
22
		$this->ifNotExists = true;
23
24
		return $this;
25
	}
26
27
	public function name(string $dbname = null):CreateDatabaseInterface{
28
		$name = trim($dbname);
29
30
		if(!empty($name)){
31
			$this->name = $name;
32
		}
33
34
		return $this;
35
	}
36
37
	public function charset(string $collation):CreateDatabaseInterface{
38
		$collation = trim($collation);
39
40
		if(!empty($collation)){
41
			$this->collate = $collation;
42
		}
43
44
		return $this;
45
	}
46
47
}
48