Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| MydbRepository | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| getDatabaseIdentifier | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getDatabase | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * This file is part of the sshilko/php-sql-mydb package. |
| 4 | * |
| 5 | * (c) Sergei Shilko <contact@sshilko.com> |
| 6 | * |
| 7 | * MIT License |
| 8 | * |
| 9 | * For the full copyright and license information, please view the LICENSE |
| 10 | * file that was distributed with this source code. |
| 11 | * @license https://opensource.org/licenses/mit-license.php MIT |
| 12 | */ |
| 13 | |
| 14 | declare(strict_types = 1); |
| 15 | |
| 16 | namespace sql; |
| 17 | |
| 18 | abstract class MydbRepository implements MydbRepositoryInterface |
| 19 | { |
| 20 | |
| 21 | abstract public function getDatabaseIdentifier(): string; |
| 22 | |
| 23 | public function __construct(private MydbRegistry $registry) |
| 24 | { |
| 25 | } |
| 26 | |
| 27 | public function getDatabase(): MydbInterface |
| 28 | { |
| 29 | return $this->registry[$this->getDatabaseIdentifier()]; |
| 30 | } |
| 31 | } |