Skip to content

Commit

Permalink
Merge pull request #6 from schulzefelix/laravel-6-support
Browse files Browse the repository at this point in the history
Laravel 6 support
  • Loading branch information
schulzefelix authored Sep 15, 2019
2 parents 5bea414 + eafc3e6 commit ccceccb
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ checks:
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true

tools:
external_code_coverage:
timeout: 120
runs: 4
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: php
php:
- 7.0
- 7.1
- 7.2
- 7.3

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

All Notable changes to `laravel-bigquery` will be documented in this file.
## [1.2.0] - 2019-09-15
- add support for Laravel 6
- use Symfony's PSR-16 cache adapter
- drop Support for Lumen
- drop support for Laravel <6

## [1.1.2] - 2019-09-15
- Add Compatibility With Laravel 5.8
- dropped support for anything lower than Laravel 5.5
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
}
],
"require": {
"php": ">=7.0.0",
"php": "^7.2",
"google/cloud-bigquery": "^1.0.0",
"illuminate/support": "~5.5.0|~5.6.0|~5.7.0|~5.8.0",
"madewithlove/illuminate-psr-cache-bridge": "^1.0"
"illuminate/support": "^6.0",
"symfony/cache": "^4.3"
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/testbench": "~3.5.0|~3.6.0",
"phpunit/phpunit" : "^6.2|^7.0"
"orchestra/testbench": "^4.0",
"phpunit/phpunit": "^8.0"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 6 additions & 4 deletions src/BigQueryClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace SchulzeFelix\BigQuery;

use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Cache;
use Google\Cloud\BigQuery\BigQueryClient;
use Madewithlove\IlluminatePsrCacheBridge\Laravel\CacheItemPool;
use Symfony\Component\Cache\Adapter\Psr16Adapter;

class BigQueryClientFactory
{
Expand All @@ -13,16 +15,16 @@ public static function createForConfig(array $bigQueryConfig): BigQueryClient
'projectId' => $bigQueryConfig['project_id'],
'keyFilePath' => $bigQueryConfig['application_credentials'],
'authCache' => self::configureCache($bigQueryConfig['auth_cache_store']),
], array_get($bigQueryConfig, 'client_options', []));
], Arr::get($bigQueryConfig, 'client_options', []));

return new BigQueryClient($clientConfig);
}

protected static function configureCache($cacheStore)
{
$store = \Cache::store($cacheStore);
$store = Cache::store($cacheStore);

$cache = new CacheItemPool($store);
$cache = new Psr16Adapter($store);

return $cache;
}
Expand Down
19 changes: 3 additions & 16 deletions src/BigQueryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

use Illuminate\Support\ServiceProvider;
use Google\Cloud\BigQuery\BigQueryClient;
use Laravel\Lumen\Application as LumenApplication;
use SchulzeFelix\BigQuery\Exceptions\InvalidConfiguration;
use Illuminate\Foundation\Application as LaravelApplication;

class BigQueryServiceProvider extends ServiceProvider
{
Expand All @@ -17,7 +15,9 @@ class BigQueryServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->setupConfig();
$this->publishes([
__DIR__.'/config/bigquery.php' => config_path('bigquery.php'),
]);
}

/**
Expand Down Expand Up @@ -46,17 +46,4 @@ protected function guardAgainstInvalidConfiguration(array $bigQueryConfig = null
throw InvalidConfiguration::credentialsJsonDoesNotExist($bigQueryConfig['application_credentials']);
}
}

protected function setupConfig()
{
$source = realpath(__DIR__.'/config/bigquery.php');

if ($this->app instanceof LaravelApplication) {
$this->publishes([$source => config_path('bigquery.php')]);
} elseif ($this->app instanceof LumenApplication) {
$this->app->configure('bigquery');
}

$this->mergeConfigFrom($source, 'bigquery');
}
}
2 changes: 1 addition & 1 deletion tests/Integration/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

abstract class TestCase extends Orchestra
{
public function setUp()
public function setUp(): void
{
parent::setUp();
}
Expand Down

0 comments on commit ccceccb

Please sign in to comment.