Processor   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 43
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A processSelect() 0 4 1
A processInsertGetId() 0 8 2
A processColumnListing() 0 4 1
1
<?php
2
namespace Childish\query;
3
4
/**
5
 * Processor
6
 *
7
 * @author    Pu ShaoWei <[email protected]>
8
 * @date      2017/12/7
9
 * @package   Childish
10
 * @version   1.0
11
 */
12
class Processor
13
{
14
    /**
15
     * Process the results of a "select" query.
16
     *
17
     * @param  \Childish\query\Builder  $query
18
     * @param  array  $results
19
     * @return array
20
     */
21
    public function processSelect(Builder $query, $results)
0 ignored issues
show
Unused Code introduced by
The parameter $query is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23
        return $results;
24
    }
25
26
    /**
27
     * Process an  "insert get ID" query.
28
     *
29
     * @param  \Childish\query\Builder  $query
30
     * @param  string  $sql
31
     * @param  array   $values
32
     * @param  string  $sequence
33
     * @return int
34
     */
35
    public function processInsertGetId(Builder $query, $sql, $values, $sequence = null)
36
    {
37
        $query->getConnection()->insert($sql, $values);
38
39
        $id = $query->getConnection()->getPdo()->lastInsertId($sequence);
40
41
        return is_numeric($id) ? (int) $id : $id;
42
    }
43
44
    /**
45
     * Process the results of a column listing query.
46
     *
47
     * @param  array  $results
48
     * @return array
49
     */
50
    public function processColumnListing($results)
51
    {
52
        return $results;
53
    }
54
}