Skip to content

Commit 3daa334

Browse files
committed
bug fix
1 parent 8b04c91 commit 3daa334

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/JsonBuilder/CreateRulesJsonBuilder.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ public function toString() {
88
public function addRule(string $role_name, ?string $host, ?string $url, $group_id): self {
99
$rule = [];
1010
$rule['RuleName'] = $role_name;
11+
if (! isset($host) && ! isset($url)) {
12+
throw new \Swango\Aliyun\Slb\Exception\SLBException('invalid rule');
13+
}
1114
if (isset($host)) {
1215
$rule['Domain'] = $host;
1316
}
1417
if (isset($url)) {
1518
$rule['Url'] = $url;
16-
} else {
17-
throw new \Swango\Aliyun\Slb\Exception\SLBException('invalid rule');
1819
}
1920
$rule['VServerGroupId'] = $group_id;
2021
$this->array[] = $rule;

0 commit comments

Comments
 (0)