Skip to content

Commit c178f40

Browse files
committed
Update Telegram.php
1 parent 723a4a2 commit c178f40

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Telegram.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,25 @@ public function __construct(Builder $phpci, Build $build, array $options = array
4040
{
4141
$this->phpci = $phpci;
4242
$this->build = $build;
43-
if (isset($options['api_key'])) {
44-
$this->api_key = $options['api_key'];
45-
} else {
43+
if (empty($options['api_key'])) {
4644
throw new \Exception("Not setting telegram api_key");
4745
}
46+
if (empty($options['recipients'])) {
47+
throw new \Exception("Not setting recipients");
48+
}
49+
$this->api_key = $options['api_key'];
4850
if (isset($options['message'])) {
4951
$this->message = $options['message'];
5052
} else {
5153
$this->message = '[%ICON_BUILD%] [%PROJECT_TITLE%](%PROJECT_URI%) - [Build #%BUILD%](%BUILD_URI%) has finished ' .
5254
'for commit [%SHORT_COMMIT% (%COMMIT_EMAIL%)](%COMMIT_URI%) ' .
5355
'on branch [%BRANCH%](%BRANCH_URI%)';
5456
}
55-
$this->recipients = array();
56-
if (!empty($options['recipients'])) {
57-
if (is_string($options['recipients'])) {
58-
$this->recipients = array($options['recipients']);
59-
} elseif (is_array($options['recipients'])) {
60-
$this->recipients = $options['recipients'];
61-
}
62-
} else {
63-
throw new \Exception("Not setting recipients");
57+
$this->recipients = array();
58+
if (is_string($options['recipients'])) {
59+
$this->recipients = array($options['recipients']);
60+
} elseif (is_array($options['recipients'])) {
61+
$this->recipients = $options['recipients'];
6462
}
6563
$this->send_log = isset($options['send_log']) && ((bool) $options['send_log'] !== false);
6664
}

0 commit comments

Comments
 (0)