Passed
Push — master ( 1156a5...423021 )
by guilherme
01:25
created

Delete::getResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Usuario
5
 * Date: 05/02/2020
6
 * Time: 21:44
7
 */
8
9
namespace database;
10
11
12
class Delete
13
{
14
15
    private $table;
16
    private $terms;
17
    private $delete;
18
    private $statements;
19
    private $result;
20
    private $error;
21
22
23
    public function __construct()
24
    {
25
    }
26
27
    /**
28
     * @return mixed
29
     */
30
    public function getResult()
31
    {
32
        return $this->result;
33
    }
34
35
36
37
    public function delete(string $table, string $terms, string $parseString)
38
    {
39
        $this->table = $table;
40
        $this->terms = $terms;
41
42
        parse_str($parseString, $this->statements);
43
44
        $this->delete = "DELETE FROM {$this->table} {$this->terms}";
45
46
        try{
47
            $this->result = DB::connect()->prepare($this->delete);
48
            $this->result->execute($this->statements);
49
            $this->error = true;
50
51
        }catch (\PDOException $e){
52
            echo $e->getMessage();
53
54
        }
55
56
    }
57
58
}