|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright 2024 SURFnet bv |
|
5
|
|
|
* |
|
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
|
|
* you may not use this file except in compliance with the License. |
|
8
|
|
|
* You may obtain a copy of the License at |
|
9
|
|
|
* |
|
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11
|
|
|
* |
|
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15
|
|
|
* See the License for the specific language governing permissions and |
|
16
|
|
|
* limitations under the License. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
declare(strict_types=1); |
|
20
|
|
|
|
|
21
|
|
|
namespace Surfnet\Stepup\MigrationsFactory; |
|
22
|
|
|
|
|
23
|
|
|
use Surfnet\Stepup\Exception\RuntimeException; |
|
24
|
|
|
|
|
25
|
|
|
trait ConfigurationAwareMigrationTrait |
|
26
|
|
|
{ |
|
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
private string $gatewaySchema; |
|
29
|
|
|
private string $middlewareSchema; |
|
30
|
|
|
private string $middlewareUser; |
|
31
|
|
|
|
|
32
|
|
|
public function setConfiguration(string $gatewaySchema, string $middlewareSchema, string $middlewareUser): void |
|
33
|
|
|
{ |
|
34
|
|
|
$this->gatewaySchema = $gatewaySchema; |
|
35
|
|
|
$this->middlewareSchema = $middlewareSchema; |
|
36
|
|
|
$this->middlewareUser = $middlewareUser; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function getGatewaySchema(): string |
|
40
|
|
|
{ |
|
41
|
|
|
if (empty($this->gatewaySchema)) { |
|
42
|
|
|
throw new RuntimeException("Gateway schema must be set"); |
|
43
|
|
|
} |
|
44
|
|
|
return $this->gatewaySchema; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function getMiddlewareSchema(): string |
|
48
|
|
|
{ |
|
49
|
|
|
if (empty($this->middlewareSchema)) { |
|
50
|
|
|
throw new RuntimeException("Middleware schema must be set"); |
|
51
|
|
|
} |
|
52
|
|
|
return $this->middlewareSchema; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function getMiddlewareUser(): string |
|
56
|
|
|
{ |
|
57
|
|
|
if (empty($this->middlewareUser)) { |
|
58
|
|
|
throw new RuntimeException("Middleware user must be set"); |
|
59
|
|
|
} |
|
60
|
|
|
return $this->middlewareUser; |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|