Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
24 / 24
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
12 / 12
CRAP
100.00% covered (success)
100.00%
1 / 1
Connection
100.00% covered (success)
100.00%
24 / 24
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
12 / 12
12
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 credentials
100.00% covered (success)
100.00%
2 / 2
n/a
0 / 0
n/a
0 / 0
100.00% covered (success)
100.00%
1 / 1
1
 options
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 option
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 fetch
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 placeholders
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 migrationTable
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 migrationColumns
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 migrations
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 addMigration
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 migrationNamespace
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 addSql
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Quma;
6
7/**
8 * @api
9 *
10 * @psalm-import-type SqlConfig from Config
11 * @psalm-import-type PlaceholderConfig from Config
12 */
13class Connection
14{
15    public readonly Config $config;
16
17    /** @psalm-param SqlConfig $sql */
18    public function __construct(string $dsn, string|array $sql)
19    {
20        $this->config = new Config($dsn, $sql);
21    }
22
23    public function credentials(
24        string $username,
25        #[\SensitiveParameter]
26        ?string $password = null,
27    ): static {
28        $this->config->setCredentials($username, $password);
29
30        return $this;
31    }
32
33    /** @param array<array-key, mixed> $options */
34    public function options(array $options): static
35    {
36        $this->config->setPdoOptions($options);
37
38        return $this;
39    }
40
41    public function option(int $attribute, mixed $value): static
42    {
43        $this->config->setPdoOption($attribute, $value);
44
45        return $this;
46    }
47
48    public function fetch(int $fetchMode): static
49    {
50        $this->config->setFetchMode($fetchMode);
51
52        return $this;
53    }
54
55    /** @psalm-param PlaceholderConfig $placeholders */
56    public function placeholders(Delimiters $delimiters, array $placeholders): static
57    {
58        $this->config->setPlaceholders($delimiters, $placeholders);
59
60        return $this;
61    }
62
63    public function migrationTable(string $table): static
64    {
65        $this->config->setMigrationsTable($table);
66
67        return $this;
68    }
69
70    public function migrationColumns(string $migration, string $applied = 'applied'): static
71    {
72        $this->config->setMigrationsColumnMigration($migration);
73        $this->config->setMigrationsColumnApplied($applied);
74
75        return $this;
76    }
77
78    /** @psalm-param SqlConfig $migrations */
79    public function migrations(array|string $migrations): static
80    {
81        $this->config->setMigrations($migrations);
82
83        return $this;
84    }
85
86    /** @param non-empty-string $migrations */
87    public function addMigration(string $migrations): static
88    {
89        $this->config->addMigrationDir($migrations);
90
91        return $this;
92    }
93
94    public function migrationNamespace(string $namespace, string|array $dirs): static
95    {
96        $this->config->setMigrationNamespace($namespace, $dirs);
97
98        return $this;
99    }
100
101    /** @psalm-param SqlConfig $sql */
102    public function addSql(array|string $sql): static
103    {
104        $this->config->addSqlDirs($sql);
105
106        return $this;
107    }
108}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

Connection->__construct
18    public function __construct(string $dsn, string|array $sql)
19    {
20        $this->config = new Config($dsn, $sql);
21    }
Connection->addMigration
87    public function addMigration(string $migrations): static
88    {
89        $this->config->addMigrationDir($migrations);
90
91        return $this;
92    }
Connection->addSql
102    public function addSql(array|string $sql): static
103    {
104        $this->config->addSqlDirs($sql);
105
106        return $this;
107    }
Connection->fetch
48    public function fetch(int $fetchMode): static
49    {
50        $this->config->setFetchMode($fetchMode);
51
52        return $this;
53    }
Connection->migrationColumns
70    public function migrationColumns(string $migration, string $applied = 'applied'): static
71    {
72        $this->config->setMigrationsColumnMigration($migration);
73        $this->config->setMigrationsColumnApplied($applied);
74
75        return $this;
76    }
Connection->migrationNamespace
94    public function migrationNamespace(string $namespace, string|array $dirs): static
95    {
96        $this->config->setMigrationNamespace($namespace, $dirs);
97
98        return $this;
99    }
Connection->migrationTable
63    public function migrationTable(string $table): static
64    {
65        $this->config->setMigrationsTable($table);
66
67        return $this;
68    }
Connection->migrations
79    public function migrations(array|string $migrations): static
80    {
81        $this->config->setMigrations($migrations);
82
83        return $this;
84    }
Connection->option
41    public function option(int $attribute, mixed $value): static
42    {
43        $this->config->setPdoOption($attribute, $value);
44
45        return $this;
46    }
Connection->options
34    public function options(array $options): static
35    {
36        $this->config->setPdoOptions($options);
37
38        return $this;
39    }
Connection->placeholders
56    public function placeholders(Delimiters $delimiters, array $placeholders): static
57    {
58        $this->config->setPlaceholders($delimiters, $placeholders);
59
60        return $this;
61    }