Completed
Push — master ( fd0133...375486 )
by Beniamin
02:35
created

InsertValuesComponentTrait::getValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of Phuria SQL Builder package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\SQLBuilder\QueryBuilder\Component;
13
14
use Phuria\SQLBuilder\Parameter\ParameterManager;
15
16
/**
17
 * @author Beniamin Jonatan Šimko <[email protected]>
18
 */
19
trait InsertValuesComponentTrait
20
{
21
    /**
22
     * @return ParameterManager
23
     */
24
    abstract public function getParameterManager();
25
26
    /**
27
     * @var array
28
     */
29
    private $values;
30
31
    /**
32
     * @param array $values
33
     *
34
     * @return $this
35
     */
36
    public function addValues(array $values)
37
    {
38
        $valueReferences = [];
39
40
        foreach ($values as $value) {
41
            $valueReferences[] = $this->getParameterManager()->createReference($value);
42
        }
43
44
        $this->values[] = $valueReferences;
45
46
        return $this;
47
    }
48
49
    /**
50
     * @return array
51
     */
52
    public function getValues()
53
    {
54
        return $this->values;
55
    }
56
}