Completed
Push — master ( fd0133...375486 )
by Beniamin
02:35
created

DeleteBuilder::getDeleteClauses()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of Phuria SQL Builder package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\SQLBuilder\QueryBuilder;
13
14
use Phuria\SQLBuilder\Table\AbstractTable;
15
16
/**
17
 * @author Beniamin Jonatan Šimko <[email protected]>
18
 */
19
class DeleteBuilder extends AbstractBuilder implements
20
    Clause\LimitClauseInterface,
21
    Clause\OrderByClauseInterface,
22
    Clause\WhereClauseInterface,
23
    Component\JoinComponentInterface,
24
    Component\TableComponentInterface
25
{
26
    use Clause\LimitClauseTrait;
27
    use Clause\OrderByClauseTrait;
28
    use Clause\WhereClauseTrait;
29
    use Component\JoinComponentTrait;
30
    use Component\ParameterComponentTrait;
31
    use Component\TableComponentTrait;
32
33
    /**
34
     * @var array $deleteClauses
35
     */
36
    private $deleteClauses = [];
37
38
    /**
39
     * @return $this
40
     */
41
    public function addDelete()
42
    {
43
        foreach (func_get_args() as $clause) {
44
            $this->doAddDelete($clause);
45
        }
46
47
        return $this;
48
    }
49
50
    /**
51
     * @param mixed $clause
52
     */
53
    private function doAddDelete($clause)
54
    {
55
        $this->deleteClauses[] = $clause;
56
    }
57
58
    /**
59
     * @return array
60
     */
61
    public function getDeleteClauses()
62
    {
63
        return $this->deleteClauses;
64
    }
65
66
    /**
67
     * @param mixed  $table
68
     * @param string $alias
0 ignored issues
show
Documentation introduced by
Should the type for parameter $alias not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
69
     *
70
     * @return AbstractTable
71
     */
72
    public function from($table, $alias = null)
73
    {
74
        return $this->addFrom($table, $alias);
75
    }
76
77
    /**
78
     * @param mixed  $table
79
     * @param string $alias
0 ignored issues
show
Documentation introduced by
Should the type for parameter $alias not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
80
     *
81
     * @return AbstractTable
82
     */
83
    public function addFrom($table, $alias = null)
84
    {
85
        return $this->addRootTable($table, $alias);
86
    }
87
}