InsertQuery::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Rougin\Windstorm\Doctrine\Builder;
4
5
/**
6
 * Insert Query
7
 *
8
 * @package Windstorm
9
 * @author  Rougin Gutib <[email protected]>
10
 */
11
class InsertQuery extends AbstractQuery
12
{
13
    /**
14
     * Returns the compiled SQL.
15
     *
16
     * @return string
17
     */
18 6
    public function get()
19
    {
20 6
        $values = (array) $this->parts['values'];
21
22 6
        $keys = ' (' . implode(', ', array_keys($values)) . ')';
23
24 6
        $values = ' VALUES (' . implode(', ', $values) . ')';
25
26 6
        return 'INSERT INTO ' . $this->table() . $keys . $values;
27
    }
28
}
29