Completed
Push — 2.0 ( bddf1c )
by Vermeulen
02:18
created

SqlDelete   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A assembleRequest() 0 8 1
1
<?php
2
3
namespace BfwSql;
4
5
/**
6
 * Class to write DELETE queries
7
 * 
8
 * @package bfw-sql
9
 * @author Vermeulen Maxime <[email protected]>
10
 * @version 2.0
11
 */
12
class SqlDelete extends SqlActions
13
{
14
    /**
15
     * Constructor
16
     * 
17
     * @param \BfwSql\SqlConnect $sqlConnect Instance of SGBD connexion
18
     * @param string             $tableName  The table name used for query
19
     */
20
    public function __construct(SqlConnect $sqlConnect, $tableName)
21
    {
22
        parent::__construct($sqlConnect);
23
        
24
        $prefix      = $sqlConnect->getConnectionInfos()->tablePrefix;
25
        $this->table = $prefix.$tableName;
0 ignored issues
show
Bug introduced by
The property table does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
26
    }
27
    
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function assembleRequest()
32
    {
33
        $where = $this->generateWhere();
34
        
35
        $this->RequeteAssembler = 'DELETE FROM '.$this->table.$where;
0 ignored issues
show
Bug introduced by
The property RequeteAssembler does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
36
        
37
        $this->callObserver();
38
    }
39
}
40