Completed
Push — 3.x ( e5eb1c...76cecd )
by Paul
9s
created

Update   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 2
cbo 2
dl 0
loc 99
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 5 1
A orAbort() 0 5 1
A orFail() 0 5 1
A orIgnore() 0 5 1
A orReplace() 0 5 1
A orRollback() 0 5 1
A orderBy() 0 4 1
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\SqlQuery\Sqlite;
10
11
use Aura\SqlQuery\Common;
12
13
/**
14
 *
15
 * An object for Sqlite UPDATE queries.
16
 *
17
 * @package Aura.SqlQuery
18
 *
19
 */
20
class Update extends Common\Update implements Common\OrderByInterface, Common\LimitOffsetInterface
21
{
22
    use Common\LimitOffsetTrait;
23
24 8
    protected function build()
25
    {
26 8
        return parent::build()
27 8
            . $this->builder->buildLimitOffset($this->getLimit(), $this->offset);
0 ignored issues
show
Bug introduced by
The property builder 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...
28
    }
29
30
    /**
31
     *
32
     * Adds or removes OR ABORT flag.
33
     *
34
     * @param bool $enable Set or unset flag (default true).
35
     *
36
     * @return $this
37
     *
38
     */
39 1
    public function orAbort($enable = true)
40
    {
41 1
        $this->setFlag('OR ABORT', $enable);
42 1
        return $this;
43
    }
44
45
    /**
46
     *
47
     * Adds or removes OR FAIL flag.
48
     *
49
     * @param bool $enable Set or unset flag (default true).
50
     *
51
     * @return $this
52
     *
53
     */
54 1
    public function orFail($enable = true)
55
    {
56 1
        $this->setFlag('OR FAIL', $enable);
57 1
        return $this;
58
    }
59
60
    /**
61
     *
62
     * Adds or removes OR IGNORE flag.
63
     *
64
     * @param bool $enable Set or unset flag (default true).
65
     *
66
     * @return $this
67
     *
68
     */
69 1
    public function orIgnore($enable = true)
70
    {
71 1
        $this->setFlag('OR IGNORE', $enable);
72 1
        return $this;
73
    }
74
75
    /**
76
     *
77
     * Adds or removes OR REPLACE flag.
78
     *
79
     * @param bool $enable Set or unset flag (default true).
80
     *
81
     * @return $this
82
     *
83
     */
84 1
    public function orReplace($enable = true)
85
    {
86 1
        $this->setFlag('OR REPLACE', $enable);
87 1
        return $this;
88
    }
89
90
    /**
91
     *
92
     * Adds or removes OR ROLLBACK flag.
93
     *
94
     * @param bool $enable Set or unset flag (default true).
95
     *
96
     * @return $this
97
     *
98
     */
99 1
    public function orRollback($enable = true)
100
    {
101 1
        $this->setFlag('OR ROLLBACK', $enable);
102 1
        return $this;
103
    }
104
105
    /**
106
     *
107
     * Adds a column order to the query.
108
     *
109
     * @param array $spec The columns and direction to order by.
110
     *
111
     * @return $this
112
     *
113
     */
114 1
    public function orderBy(array $spec)
115
    {
116 1
        return $this->addOrderBy($spec);
117
    }
118
}
119