Passed
Push — master ( ddc32f...d4c573 )
by Ron
02:10
created

MySQLTemporaryTable   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
c 1
b 0
f 0
dl 0
loc 27
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 2 1
A release() 0 4 1
A __construct() 0 4 1
A __toString() 0 2 1
1
<?php
2
3
namespace Kir\MySQL\Databases\MySQL;
4
5
use Kir\MySQL\Builder\RunnableTemporaryTable;
6
use Kir\MySQL\Database;
7
8
class MySQLTemporaryTable implements RunnableTemporaryTable {
9
	public function __construct(
10
		private Database $db,
11
		private string $name
12
	) {}
13
14
	/**
15
	 * @return string
16
	 */
17
	public function getName(): string {
18
		return $this->name;
19
	}
20
21
	/**
22
	 * @return $this
23
	 */
24
	public function release() {
25
		$this->db->exec("DROP TEMPORARY TABLE IF EXISTS {$this->name}");
26
27
		return $this;
28
	}
29
30
	/**
31
	 * @return string
32
	 */
33
	public function __toString(): string {
34
		return $this->name;
35
	}
36
}
37