Total Complexity | 5 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 38.46% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class PostgresqlFunctionRepository implements SqlFunctionRepository |
||
11 | { |
||
12 | /** |
||
13 | * @param string|null $connection |
||
14 | * @param string|null $select |
||
15 | */ |
||
16 | 1 | public function __construct( |
|
17 | public ?string $connection = null, |
||
18 | public ?string $select = null, |
||
19 | ) { |
||
20 | 1 | if (is_null($this->connection)) { |
|
21 | 1 | $this->connection = config('sql-function-repository.connection', DB::getDefaultConnection()); |
|
22 | } |
||
23 | |||
24 | 1 | if (is_null($this->select)) { |
|
25 | 1 | $this->select = config('sql-function-repository.select', 'select * from '); |
|
26 | } |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Execute the database function. |
||
31 | * |
||
32 | * @param string $name |
||
33 | * @param array $parameters |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | public function runDatabaseFunction(string $name, array $parameters = []): array |
||
42 | ); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param string $name |
||
47 | * @param array $parameters |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | protected function buildSqlFunction(string $name, array $parameters): string |
||
59 |