• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

valkyrjaio / valkyrja / 20156277091

12 Dec 2025 04:26AM UTC coverage: 73.416% (-0.6%) from 74.002%
20156277091

push

github

MelechMizrachi
CI: Trying to fix coveralls.

8125 of 11067 relevant lines covered (73.42%)

17.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Valkyrja/Orm/QueryBuilder/SqlInsertQueryBuilder.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Valkyrja Framework package.
7
 *
8
 * (c) Melech Mizrachi <melechmizrachi@gmail.com>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13

14
namespace Valkyrja\Orm\QueryBuilder;
15

16
use Override;
17
use Valkyrja\Orm\Constant\Statement;
18
use Valkyrja\Orm\Data\Value;
19
use Valkyrja\Orm\QueryBuilder\Contract\InsertQueryBuilder as Contract;
20

21
/**
22
 * Class SqlInsertQueryBuilder.
23
 *
24
 * @author Melech Mizrachi
25
 */
26
class SqlInsertQueryBuilder extends SqlQueryBuilder implements Contract
27
{
28
    /** @var Value[] */
29
    protected array $values = [];
30

31
    /**
32
     * @inheritDoc
33
     */
34
    #[Override]
×
35
    public function withSet(Value ...$values): static
36
    {
37
        $new = clone $this;
×
38

39
        $new->values = $values;
×
40

41
        return $new;
×
42
    }
43

44
    /**
45
     * @inheritDoc
46
     */
47
    #[Override]
×
48
    public function withAddedSet(Value ...$values): static
49
    {
50
        $new = clone $this;
×
51

52
        $new->values = array_merge($new->values, $values);
×
53

54
        return $new;
×
55
    }
56

57
    /**
58
     * @inheritDoc
59
     */
60
    public function __toString(): string
×
61
    {
62
        $query = Statement::INSERT
×
63
            . ' ' . Statement::INTO
×
64
            . " $this->from"
×
65
            . $this->getAliasQuery();
×
66

67
        $columns = [];
×
68
        $values  = [];
×
69

70
        foreach ($this->values as $value) {
×
71
            $columns[] = $value->name;
×
72
            $values[]  = (string) $value;
×
73
        }
74

75
        $columns = implode(', ', $columns);
×
76
        $values  = implode(', ', $values);
×
77

78
        return $query
×
79
            . " ($columns)"
×
80
            . ' ' . Statement::VALUES
×
81
            . " ($values)"
×
82
            . $this->getWhereQuery()
×
83
            . $this->getJoinQuery();
×
84
    }
85
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc