Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
PdoBuilder
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 dsn
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 username
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 password
100.00% covered (success)
100.00%
2 / 2
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
1
 build
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Dynart\Micro\Entities;
4
5use PDO;
6
7class PdoBuilder {
8
9    protected string $dsn = '';
10    protected string $username = '';
11    protected string $password = '';
12    protected array $options = [];
13
14    public function dsn(string $value): static {
15        $this->dsn = $value;
16        return $this;
17    }
18
19    public function username(string $value): static {
20        $this->username = $value;
21        return $this;
22    }
23
24    public function password(string $value): static {
25        $this->password = $value;
26        return $this;
27    }
28
29    public function options(array $value): static {
30        $this->options = $value;
31        return $this;
32    }
33
34    public function build(): PDO {
35        return new PDO($this->dsn, $this->username, $this->password, $this->options);
36    }
37}