Completed
Push — 2.x ( ddf3d5...9f025d )
by Paul
02:07
created

Update   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 0
Metric Value
wmc 5
c 5
b 0
f 0
lcom 1
cbo 1
dl 0
loc 73
ccs 13
cts 13
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A lowPriority() 0 5 1
A ignore() 0 5 1
A limit() 0 5 1
A getLimit() 0 4 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\Mysql;
10
11
use Aura\SqlQuery\Common;
12
13
/**
14
 *
15
 * An object for MySQL UPDATE queries.
16
 *
17
 * @package Aura.SqlQuery
18
 *
19
 */
20
class Update extends Common\Update implements Common\OrderByInterface, Common\LimitInterface
21
{
22
    /**
23
     *
24
     * Adds or removes LOW_PRIORITY flag.
25
     *
26
     * @param bool $enable Set or unset flag (default true).
27
     *
28
     * @return $this
29
     *
30
     */
31 1
    public function lowPriority($enable = true)
32
    {
33 1
        $this->setFlag('LOW_PRIORITY', $enable);
34 1
        return $this;
35
    }
36
37
    /**
38
     *
39
     * Adds or removes IGNORE flag.
40
     *
41
     * @param bool $enable Set or unset flag (default true).
42
     *
43
     * @return $this
44
     *
45
     */
46 1
    public function ignore($enable = true)
47
    {
48 1
        $this->setFlag('IGNORE', $enable);
49 1
        return $this;
50
    }
51
52
    /**
53
     *
54
     * Sets a limit count on the query.
55
     *
56
     * @param int $limit The number of rows to select.
57
     *
58
     * @return $this
59
     *
60
     */
61 4
    public function limit($limit)
62
    {
63 4
        $this->limit = (int) $limit;
64 4
        return $this;
65
    }
66
67
    /**
68
     *
69
     * Returns the LIMIT value.
70
     *
71
     * @return int
72
     *
73
     */
74 1
    public function getLimit()
75
    {
76 1
        return $this->limit;
77
    }
78
79
    /**
80
     *
81
     * Adds a column order to the query.
82
     *
83
     * @param array $spec The columns and direction to order by.
84
     *
85
     * @return $this
86
     *
87
     */
88 1
    public function orderBy(array $spec)
89
    {
90 1
        return $this->addOrderBy($spec);
91
    }
92
}
93