Skip to content

Commit 4f31d90

Browse files
Merge pull request #39 from BitbucketAPI/psr-18
Switch to PSR18 client implementation
2 parents a737dff + 27281db commit 4f31d90

25 files changed

+109
-155
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ Feel free to check out the [change log](CHANGELOG.md), [releases](https://github
2525

2626
This version requires [PHP](https://php.net) 7.2-7.4.
2727

28-
To get the latest version, simply require the project using [Composer](https://getcomposer.org). You will need to install any package that "provides" `php-http/client-implementation`. Pure PHP users will want something like:
28+
To get the latest version, simply require the project using [Composer](https://getcomposer.org). You will need to install any package that "provides" `psr/http-client-implementation`. Pure PHP users will want something like:
2929

3030
```bash
31-
$ composer require bitbucket/client php-http/guzzle6-adapter:^2.0
31+
$ composer require bitbucket/client guzzlehttp/guzzle:^7.0.1
3232
```
3333

3434
Laravel users will want something like:
3535

3636
```bash
37-
$ composer require graham-campbell/bitbucket php-http/guzzle6-adapter:^2.0
37+
$ composer require graham-campbell/bitbucket guzzlehttp/guzzle:^7.0.1
3838
```
3939

4040
We are decoupled from any HTTP messaging client with help by [HTTPlug](http://httplug.io). You can visit [HTTPlug for library users](https://docs.php-http.org/en/latest/httplug/users.html) to get more information about installing HTTPlug related packages. [`graham-campbell/bitbucket`](https://github.com/GrahamCampbell/Laravel-Bitbucket) is also maintained by [Graham Campbell](https://github.com/GrahamCampbell).

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111
],
1212
"require": {
1313
"php": "^7.2.5",
14-
"psr/http-message": "^1.0",
14+
"php-http/client-common": "^2.1",
15+
"php-http/cache-plugin": "^1.7",
16+
"php-http/discovery": "^1.7",
17+
"php-http/httplug": "^2.1",
18+
"php-http/multipart-stream-builder": "^1.1",
1519
"psr/cache": "^1.0",
16-
"php-http/httplug": "^1.1|^2.0",
17-
"php-http/discovery": "^1.6",
18-
"php-http/cache-plugin": "^1.6",
19-
"php-http/client-implementation": "^1.0",
20-
"php-http/client-common": "^1.9|^2.0",
21-
"php-http/multipart-stream-builder": "^1.0"
20+
"psr/http-client-implementation": "^1.0",
21+
"psr/http-message": "^1.0"
2222
},
2323
"require-dev": {
2424
"graham-campbell/analyzer": "^2.4",
2525
"phpunit/phpunit": "^8.5|^9.0",
26-
"php-http/guzzle6-adapter": "^1.1|^2.0"
26+
"php-http/guzzle6-adapter": "^2.0"
2727
},
2828
"autoload": {
2929
"psr-4": {

src/Api/AbstractApi.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
use Bitbucket\Exception\InvalidArgumentException;
1717
use Bitbucket\HttpClient\Message\ResponseMediator;
18-
use Http\Client\Common\HttpMethodsClient;
18+
use Http\Client\Common\HttpMethodsClientInterface;
1919

2020
/**
2121
* The abstract bitbucket api class.
@@ -35,7 +35,7 @@ abstract class AbstractApi implements ApiInterface
3535
/**
3636
* The http methods client.
3737
*
38-
* @var \Http\Client\Common\HttpMethodsClient
38+
* @var \Http\Client\Common\HttpMethodsClientInterface
3939
*/
4040
private $client;
4141

@@ -49,11 +49,11 @@ abstract class AbstractApi implements ApiInterface
4949
/**
5050
* Create a new api instance.
5151
*
52-
* @param \Http\Client\Common\HttpMethodsClient $client
52+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
5353
*
5454
* @return void
5555
*/
56-
public function __construct(HttpMethodsClient $client)
56+
public function __construct(HttpMethodsClientInterface $client)
5757
{
5858
$this->client = $client;
5959
}
@@ -83,7 +83,7 @@ public function setPerPage(int $perPage = null)
8383
/**
8484
* Get the http methods client.
8585
*
86-
* @return \Http\Client\Common\HttpMethodsClient
86+
* @return \Http\Client\Common\HttpMethodsClientInterface
8787
*/
8888
protected function getHttpClient()
8989
{

src/Api/Addon/Linkers/AbstractLinkersApi.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Addon\Linkers;
1515

1616
use Bitbucket\Api\Addon\AbstractAddonApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract linkers api class.
@@ -33,10 +33,10 @@ abstract class AbstractLinkersApi extends AbstractAddonApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $linker
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $linker
3838
*/
39-
public function __construct(HttpMethodsClient $client, string $linker)
39+
public function __construct(HttpMethodsClientInterface $client, string $linker)
4040
{
4141
parent::__construct($client);
4242
$this->linker = $linker;

src/Api/Addon/Users/AbstractUsersApi.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Addon\Users;
1515

1616
use Bitbucket\Api\Addon\AbstractAddonApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract users api class.
@@ -33,10 +33,10 @@ abstract class AbstractUsersApi extends AbstractAddonApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
3838
*/
39-
public function __construct(HttpMethodsClient $client, string $username)
39+
public function __construct(HttpMethodsClientInterface $client, string $username)
4040
{
4141
parent::__construct($client);
4242
$this->username = $username;

src/Api/Repositories/AbstractRepositoriesApi.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Repositories;
1515

1616
use Bitbucket\Api\AbstractApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract repository api class.
@@ -33,10 +33,10 @@ abstract class AbstractRepositoriesApi extends AbstractApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
3838
*/
39-
public function __construct(HttpMethodsClient $client, string $username)
39+
public function __construct(HttpMethodsClientInterface $client, string $username)
4040
{
4141
parent::__construct($client);
4242
$this->username = $username;

src/Api/Repositories/Users/AbstractUsersApi.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Repositories\Users;
1515

1616
use Bitbucket\Api\Repositories\AbstractRepositoriesApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract users api class.
@@ -33,11 +33,11 @@ abstract class AbstractUsersApi extends AbstractRepositoriesApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
38-
* @param string $repo
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
38+
* @param string $repo
3939
*/
40-
public function __construct(HttpMethodsClient $client, string $username, string $repo)
40+
public function __construct(HttpMethodsClientInterface $client, string $username, string $repo)
4141
{
4242
parent::__construct($client, $username);
4343
$this->repo = $repo;

src/Api/Repositories/Users/Commit/AbstractCommitApi.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Repositories\Users\Commit;
1515

1616
use Bitbucket\Api\Repositories\Users\AbstractUsersApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract commit api class.
@@ -33,12 +33,12 @@ abstract class AbstractCommitApi extends AbstractUsersApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
38-
* @param string $repo
39-
* @param string $commit
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
38+
* @param string $repo
39+
* @param string $commit
4040
*/
41-
public function __construct(HttpMethodsClient $client, string $username, string $repo, string $commit)
41+
public function __construct(HttpMethodsClientInterface $client, string $username, string $repo, string $commit)
4242
{
4343
parent::__construct($client, $username, $repo);
4444
$this->commit = $commit;

src/Api/Repositories/Users/Issues/AbstractIssuesApi.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Repositories\Users\Issues;
1515

1616
use Bitbucket\Api\Repositories\Users\AbstractUsersApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract issues api class.
@@ -33,12 +33,12 @@ abstract class AbstractIssuesApi extends AbstractUsersApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
38-
* @param string $repo
39-
* @param string $issue
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
38+
* @param string $repo
39+
* @param string $issue
4040
*/
41-
public function __construct(HttpMethodsClient $client, string $username, string $repo, string $issue)
41+
public function __construct(HttpMethodsClientInterface $client, string $username, string $repo, string $issue)
4242
{
4343
parent::__construct($client, $username, $repo);
4444
$this->issue = $issue;

src/Api/Repositories/Users/Pipelines/AbstractPipelinesApi.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Repositories\Users\Pipelines;
1515

1616
use Bitbucket\Api\Repositories\Users\AbstractUsersApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract pipelines api class.
@@ -33,12 +33,12 @@ abstract class AbstractPipelinesApi extends AbstractUsersApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
38-
* @param string $repo
39-
* @param string $pipeline
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
38+
* @param string $repo
39+
* @param string $pipeline
4040
*/
41-
public function __construct(HttpMethodsClient $client, string $username, string $repo, string $pipeline)
41+
public function __construct(HttpMethodsClientInterface $client, string $username, string $repo, string $pipeline)
4242
{
4343
parent::__construct($client, $username, $repo);
4444
$this->pipeline = $pipeline;

src/Api/Repositories/Users/PipelinesConfig/Schedules/AbstractSchedulesApi.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Repositories\Users\PipelinesConfig\Schedules;
1515

1616
use Bitbucket\Api\Repositories\Users\PipelinesConfig\AbstractPipelinesConfigApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract schedules api class.
@@ -33,12 +33,12 @@ abstract class AbstractSchedulesApi extends AbstractPipelinesConfigApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
38-
* @param string $repo
39-
* @param string $schedule
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
38+
* @param string $repo
39+
* @param string $schedule
4040
*/
41-
public function __construct(HttpMethodsClient $client, string $username, string $repo, string $schedule)
41+
public function __construct(HttpMethodsClientInterface $client, string $username, string $repo, string $schedule)
4242
{
4343
parent::__construct($client, $username, $repo);
4444
$this->schedule = $schedule;

src/Api/Repositories/Users/PullRequests/AbstractPullRequestsApi.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Repositories\Users\PullRequests;
1515

1616
use Bitbucket\Api\Repositories\Users\AbstractUsersApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract pull requests api class.
@@ -33,12 +33,12 @@ abstract class AbstractPullRequestsApi extends AbstractUsersApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
38-
* @param string $repo
39-
* @param string $pr
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
38+
* @param string $repo
39+
* @param string $pr
4040
*/
41-
public function __construct(HttpMethodsClient $client, string $username, string $repo, string $pr)
41+
public function __construct(HttpMethodsClientInterface $client, string $username, string $repo, string $pr)
4242
{
4343
parent::__construct($client, $username, $repo);
4444
$this->pr = $pr;

src/Api/Snippets/AbstractSnippetsApi.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Snippets;
1515

1616
use Bitbucket\Api\AbstractApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract snippets api class.
@@ -33,10 +33,10 @@ abstract class AbstractSnippetsApi extends AbstractApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
3838
*/
39-
public function __construct(HttpMethodsClient $client, string $username)
39+
public function __construct(HttpMethodsClientInterface $client, string $username)
4040
{
4141
parent::__construct($client);
4242
$this->username = $username;

src/Api/Snippets/Users/AbstractUsersApi.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Bitbucket\Api\Snippets\Users;
1515

1616
use Bitbucket\Api\Snippets\AbstractSnippetsApi;
17-
use Http\Client\Common\HttpMethodsClient;
17+
use Http\Client\Common\HttpMethodsClientInterface;
1818

1919
/**
2020
* The abstract users api class.
@@ -33,11 +33,11 @@ abstract class AbstractUsersApi extends AbstractSnippetsApi
3333
/**
3434
* Create a new api instance.
3535
*
36-
* @param \Http\Client\Common\HttpMethodsClient $client
37-
* @param string $username
38-
* @param string $snippet
36+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
37+
* @param string $username
38+
* @param string $snippet
3939
*/
40-
public function __construct(HttpMethodsClient $client, string $username, string $snippet)
40+
public function __construct(HttpMethodsClientInterface $client, string $username, string $snippet)
4141
{
4242
parent::__construct($client, $username);
4343
$this->snippet = $snippet;

src/Api/Teams.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Bitbucket\Api\Teams\PipelinesConfig;
2222
use Bitbucket\Api\Teams\Projects;
2323
use Bitbucket\Api\Teams\Repositories as TeamsRepositories;
24-
use Http\Client\Common\HttpMethodsClient;
24+
use Http\Client\Common\HttpMethodsClientInterface;
2525

2626
/**
2727
* The teams api class.
@@ -40,10 +40,10 @@ class Teams extends AbstractApi
4040
/**
4141
* Create a new teams api instance.
4242
*
43-
* @param \Http\Client\Common\HttpMethodsClient $client
44-
* @param string $username
43+
* @param \Http\Client\Common\HttpMethodsClientInterface $client
44+
* @param string $username
4545
*/
46-
public function __construct(HttpMethodsClient $client, string $username)
46+
public function __construct(HttpMethodsClientInterface $client, string $username)
4747
{
4848
parent::__construct($client);
4949
$this->username = $username;

0 commit comments

Comments
 (0)