Skip to content
This repository was archived by the owner on Aug 28, 2021. It is now read-only.

Commit 6dd1fa5

Browse files
committed
update: to laravel 6
1 parent d35b9cf commit 6dd1fa5

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
composer.phar
33
composer.lock
44
.DS_Store
5+
.idea/

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=5.5.0",
14-
"illuminate/support": "~5.2",
13+
"php": "^7.2",
14+
"illuminate/support": "^6|^7",
1515
"guzzlehttp/guzzle": "~6.0"
1616
},
1717
"require-dev": {
18-
"phpunit/phpunit": "4.8.*"
18+
"phpunit/phpunit": "^8.0"
1919
},
2020
"autoload": {
21-
"psr-0": {
21+
"psr-4": {
2222
"Threesquared\\LaravelWpApi\\": "src/"
2323
}
2424
},

src/Threesquared/LaravelWpApi/LaravelWpApiServiceProvider.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,11 @@ public function boot()
3131
*/
3232
public function register()
3333
{
34-
$this->app->singleton(WpApi::class, function ($app) {
35-
36-
$endpoint = $this->app['config']->get('wp-api.endpoint');
37-
$auth = $this->app['config']->get('wp-api.auth');
38-
$client = $this->app->make('GuzzleHttp\Client');
39-
40-
return new WpApi($endpoint, $client, $auth);
41-
34+
$this->app->bind(WpApi::class, function ($app) {
35+
return new WpApi(
36+
$this->app['config']->get('wp-api.endpoint'),
37+
$this->app['config']->get('wp-api.auth')
38+
);
4239
});
4340
}
4441

src/Threesquared/LaravelWpApi/WpApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ class WpApi
3131
* @param Client $client
3232
* @param string $auth
3333
*/
34-
public function __construct($endpoint, Client $client, $auth = null)
34+
public function __construct($endpoint, $auth = null)
3535
{
3636
$this->endpoint = $endpoint;
37-
$this->client = $client;
3837
$this->auth = $auth;
38+
$this->client = new Client();
3939
}
4040

4141
/**

0 commit comments

Comments
 (0)