Skip to content

Commit de6de6d

Browse files
authored
Merge pull request #82 from foxted/master
Public access to flush method
2 parents 1790701 + 32a48b7 commit de6de6d

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/LaunchDarkly/EventProcessor.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct($sdkKey, $options = array()) {
1717
$this->_capacity = $options['capacity'];
1818
$this->_timeout = $options['timeout'];
1919

20-
$this->_queue = array();
20+
$this->_queue = array();
2121
}
2222

2323
public function __destruct() {
@@ -38,7 +38,11 @@ public function enqueue($event) {
3838
return true;
3939
}
4040

41-
protected function flush() {
41+
/**
42+
* Publish events to LaunchDarkly
43+
* @return bool Whether the events were successfully published
44+
*/
45+
public function flush() {
4246
if (empty($this->_queue)) {
4347
return null;
4448
}

src/LaunchDarkly/LDClient.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function __construct($sdkKey, $options = array()) {
9595

9696
$this->_featureRequester = $this->getFeatureRequester($sdkKey, $options);
9797
}
98-
98+
9999
/**
100100
* @param string $sdkKey
101101
* @param mixed[] $options
@@ -106,7 +106,7 @@ private function getFeatureRequester($sdkKey, array $options)
106106
if (isset($options['feature_requester']) && $options['feature_requester'] instanceof FeatureRequester) {
107107
return $options['feature_requester'];
108108
}
109-
109+
110110
if (isset($options['feature_requester_class'])) {
111111
$featureRequesterClass = $options['feature_requester_class'];
112112
} else {
@@ -279,6 +279,15 @@ public function secureModeHash($user) {
279279
return hash_hmac("sha256", $user->getKey(), $this->_sdkKey, false);
280280
}
281281

282+
/**
283+
* Publish events to LaunchDarkly
284+
* @return bool Whether the events were successfully published
285+
*/
286+
public function flush()
287+
{
288+
return $this->_eventProcessor->flush();
289+
}
290+
282291
/**
283292
* @param $key string
284293
* @param $user LDUser

0 commit comments

Comments
 (0)