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

dg / dibi / 22284472534

22 Feb 2026 08:11PM UTC coverage: 76.31% (-0.2%) from 76.552%
22284472534

push

github

dg
phpstan

56 of 106 new or added lines in 23 files covered. (52.83%)

82 existing lines in 8 files now uncovered.

1762 of 2309 relevant lines covered (76.31%)

0.76 hits per line

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

84.62
/src/Dibi/Reflection/Result.php
1
<?php declare(strict_types=1);
2

3
/**
4
 * This file is part of the Dibi, smart database abstraction layer (https://dibi.nette.org)
5
 * Copyright (c) 2005 David Grudl (https://davidgrudl.com)
6
 */
7

8
namespace Dibi\Reflection;
9

10
use Dibi;
11

12

13
/**
14
 * Reflection metadata class for a result set.
15
 *
16
 * @property-read list<Column> $columns
17
 * @property-read list<string> $columnNames
18
 */
19
class Result
20
{
21
        /** @var list<Column> */
22
        private array $columns;
23

24
        /** @var array<Column> */
25
        private array $names;
26

27

28
        public function __construct(
1✔
29
                private readonly Dibi\ResultDriver $driver,
30
        ) {
31
        }
1✔
32

33

34
        /** @return Column[] */
35
        public function getColumns(): array
36
        {
37
                $this->initColumns();
1✔
38
                return $this->columns;
1✔
39
        }
40

41

42
        /** @return string[] */
43
        public function getColumnNames(bool $fullNames = false): array
1✔
44
        {
45
                $this->initColumns();
1✔
46
                $res = [];
1✔
47
                foreach ($this->columns as $column) {
1✔
48
                        $res[] = $fullNames ? $column->getFullName() : $column->getName();
1✔
49
                }
50

51
                return $res;
1✔
52
        }
53

54

55
        public function getColumn(string $name): Column
1✔
56
        {
57
                $this->initColumns();
1✔
58
                $l = strtolower($name);
1✔
59
                if (isset($this->names[$l])) {
1✔
60
                        return $this->names[$l];
1✔
61

62
                } else {
UNCOV
63
                        throw new Dibi\Exception("Result set has no column '$name'.");
×
64
                }
65
        }
66

67

68
        public function hasColumn(string $name): bool
69
        {
70
                $this->initColumns();
×
UNCOV
71
                return isset($this->names[strtolower($name)]);
×
72
        }
73

74

75
        protected function initColumns(): void
76
        {
77
                if (!isset($this->columns)) {
1✔
78
                        $this->columns = [];
1✔
79
                        $reflector = $this->driver instanceof Dibi\Reflector
1✔
UNCOV
80
                                ? $this->driver
×
81
                                : null;
1✔
82
                        foreach ($this->driver->getResultColumns() as $info) {
1✔
83
                                $this->columns[] = $this->names[strtolower($info['name'])] = new Column($reflector, $info);
1✔
84
                        }
85
                }
86
        }
1✔
87
}
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