Skip to content

Commit a9d7c1c

Browse files
committed
ApiOneCollectionListener is enabled by default
1 parent 185aea0 commit a9d7c1c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Bitbucket/API/Api.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Bitbucket\API;
1212

13+
use Bitbucket\API\Http\Listener\ApiOneCollectionListener;
1314
use Bitbucket\API\Http\Listener\NormalizeArrayListener;
1415
use Buzz\Message\MessageInterface;
1516
use Bitbucket\API\Http\ClientInterface;
@@ -51,6 +52,7 @@ public function __construct(array $options = array(), ClientInterface $client =
5152
$this->httpClient = (null !== $client) ? $client : new Client($options, $client);
5253

5354
$this->httpClient->addListener(new NormalizeArrayListener());
55+
$this->httpClient->addListener(new ApiOneCollectionListener());
5456
}
5557

5658
/**

lib/Bitbucket/API/Http/Response/Pager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ private function getContent()
131131

132132
if (is_array($content) && JSON_ERROR_NONE === json_last_error()) {
133133
// replace reference inserted by `LegacyCollectionListener` with actual data.
134-
if (is_string($content['values']) && strpos($content['values'], '.') !== false) {
134+
if (array_key_exists('values', $content) &&
135+
is_string($content['values']) &&
136+
strpos($content['values'], '.') !== false) {
135137
$content['values'] = $content[str_replace('.', '', $content['values'])];
136138
}
137139
return $content;

0 commit comments

Comments
 (0)