UpdateTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A increment() 0 4 1
A decrement() 0 4 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Query
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Query\Traits\Clause;
16
17
use Phossa2\Query\Interfaces\Clause\UpdateInterface;
18
19
/**
20
 * UpdateTrait
21
 *
22
 * @package Phossa2\Query
23
 * @author  Hong Zhang <[email protected]>
24
 * @see     UpdateInterface
25
 * @version 2.0.0
26
 * @since   2.0.0 added
27
 */
28
trait UpdateTrait
29
{
30
    use SetTrait;
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    public function increment(/*# string */ $col, /*# int */ $step = 1)
36
    {
37
        return $this->setTpl($col, '%s + ?', $col, [$step]);
38
    }
39
40
    /**
41
     * {@inheritDoc}
42
     */
43
    public function decrement(/*# string */ $col, /*# int */ $step = 1)
44
    {
45
        return $this->setTpl($col, '%s - ?', $col, [$step]);
46
    }
47
}
48