MySQLTemporaryTable::release()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
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