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

tempestphp / tempest-framework / 14049246919

24 Mar 2025 09:42PM UTC coverage: 79.353% (-0.04%) from 79.391%
14049246919

push

github

web-flow
feat(support): support array parameters in string manipulations (#1073)

48 of 48 new or added lines in 2 files covered. (100.0%)

735 existing lines in 126 files now uncovered.

10492 of 13222 relevant lines covered (79.35%)

90.78 hits per line

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

88.0
/src/Tempest/Database/src/Query.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Database;
6

7
use function Tempest\get;
8

9
final class Query
10
{
11
    public function __construct(
658✔
12
        public string $sql,
13
        public array $bindings = [],
14
    ) {}
658✔
15

16
    public function execute(mixed ...$bindings): Id
658✔
17
    {
18
        $this->bindings = [...$this->bindings, ...$bindings];
658✔
19

20
        $database = $this->getDatabase();
658✔
21

22
        $query = $this->withBindings($bindings);
658✔
23

24
        $database->execute($query);
658✔
25

26
        return isset($query->bindings['id'])
658✔
27
            ? new Id($query->bindings['id'])
15✔
28
            : $database->getLastInsertId();
658✔
29
    }
30

31
    public function fetch(mixed ...$bindings): array
658✔
32
    {
33
        return $this->getDatabase()->fetch($this->withBindings($bindings));
658✔
34
    }
35

36
    public function fetchFirst(mixed ...$bindings): ?array
1✔
37
    {
38
        return $this->getDatabase()->fetchFirst($this->withBindings($bindings));
1✔
39
    }
40

41
    public function getSql(): string
658✔
42
    {
43
        return $this->sql;
658✔
44
    }
45

UNCOV
46
    public function append(string $append): self
×
47
    {
UNCOV
48
        $this->sql .= PHP_EOL . $append;
×
49

UNCOV
50
        return $this;
×
51
    }
52

53
    public function withBindings(array $bindings): self
658✔
54
    {
55
        $clone = clone $this;
658✔
56

57
        $clone->bindings = [...$clone->bindings, ...$bindings];
658✔
58

59
        return $clone;
658✔
60
    }
61

62
    private function getDatabase(): Database
658✔
63
    {
64
        return get(Database::class);
658✔
65
    }
66
}
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