Skip to content

Commit

Permalink
Applied fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhincodon authored and StyleCIBot committed Nov 20, 2016
1 parent 7f988f1 commit 560371b
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 18 deletions.
5 changes: 3 additions & 2 deletions src/Commands/FillSheet.php
Expand Up @@ -38,8 +38,9 @@ public function handle()
{
$modelType = $this->argument('modelType');

if (empty(config('laravel-eloquent-spreadsheets')["sync_models"][$modelType])) {
if (empty(config('laravel-eloquent-spreadsheets')['sync_models'][$modelType])) {
$this->warn('Model not registered in config');

return;
}

Expand All @@ -50,6 +51,6 @@ public function handle()
$this->info("Dispatched model with ID: {$modelItem->id}");
}

$this->info("Dispatching completed");
$this->info('Dispatching completed');
}
}
10 changes: 6 additions & 4 deletions src/Commands/Sync.php
Expand Up @@ -43,8 +43,9 @@ public function handle()
{
$modelType = $this->argument('modelType');

if (empty(config('laravel-eloquent-spreadsheets')["sync_models"][$modelType])) {
if (empty(config('laravel-eloquent-spreadsheets')['sync_models'][$modelType])) {
$this->warn('Model not registered in config');

return;
}

Expand All @@ -60,12 +61,13 @@ public function handle()

if (empty($values)) {
$this->warn('Sheet is empty');

return;
}

foreach ($values as $value) {
if (
!is_array($value) ||
! is_array($value) ||
empty($value[getLettersToIdsTable($this->startColumn, $this->endColumn)[$this->idColumn]])
) {
continue;
Expand All @@ -74,7 +76,7 @@ public function handle()
$id = $value[getLettersToIdsTable($this->startColumn, $this->endColumn)[$this->idColumn]];
$modelItem = $model->whereId($id)->first();

if (!$modelItem) {
if (! $modelItem) {
continue;
}

Expand Down Expand Up @@ -107,7 +109,7 @@ private function updateModel($modelItem, $value)

private function prepareConfig($modelType)
{
$this->config = config('laravel-eloquent-spreadsheets')["sync_models"][$modelType];
$this->config = config('laravel-eloquent-spreadsheets')['sync_models'][$modelType];

asort($this->config['sync_attributes']);
$this->startColumn = array_first($this->config['sync_attributes']);
Expand Down
6 changes: 3 additions & 3 deletions src/EloquentSpreadsheetsServiceProvider.php
Expand Up @@ -14,7 +14,7 @@ class EloquentSpreadsheetsServiceProvider extends ServiceProvider
public function boot()
{
$this->publishes([
__DIR__ . '/../config/laravel-eloquent-spreadsheets.php' => config_path('laravel-eloquent-spreadsheets.php'),
__DIR__.'/../config/laravel-eloquent-spreadsheets.php' => config_path('laravel-eloquent-spreadsheets.php'),
], 'config');

$this->bootObservers();
Expand All @@ -26,10 +26,10 @@ public function boot()
public function register()
{
$this->mergeConfigFrom(
__DIR__ . '/../config/laravel-eloquent-spreadsheets.php', 'laravel-eloquent-spreadsheets'
__DIR__.'/../config/laravel-eloquent-spreadsheets.php', 'laravel-eloquent-spreadsheets'
);

$this->app->singleton(SpreadsheetService::class, function() {
$this->app->singleton(SpreadsheetService::class, function () {
$client = (new SpreadsheetClient(config('laravel-eloquent-spreadsheets.credentials_path')))->client();

return new SpreadsheetService($client);
Expand Down
4 changes: 2 additions & 2 deletions src/Jobs/Traits/Saveable.php
Expand Up @@ -33,7 +33,7 @@ public function getModelSyncedData()
}

foreach (range(0, count(range($this->startColumn, $this->endColumn)) - 1) as $key) {
if (!empty($result[$key])) {
if (! empty($result[$key])) {
continue;
}

Expand Down Expand Up @@ -64,4 +64,4 @@ public function insertModelToSheet($rowToInsert)
$batch
);
}
}
}
1 change: 1 addition & 0 deletions src/Jobs/UpdateModelInSpreadsheet.php
Expand Up @@ -46,6 +46,7 @@ public function handle()

if ($rowToInsert === false) {
dispatch(new CreateModelInSpreadsheet($this->model, $this->config));

return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ModelObserver.php
Expand Up @@ -35,6 +35,6 @@ public function deleted($model)
*/
public function getConfig($model)
{
return config('laravel-eloquent-spreadsheets')["sync_models"][get_class($model)];
return config('laravel-eloquent-spreadsheets')['sync_models'][get_class($model)];
}
}
}
6 changes: 3 additions & 3 deletions src/SpreadsheetClient.php
Expand Up @@ -28,11 +28,11 @@ public function __construct($credentialsPath)
}

/**
* Init Client
* Init Client.
*/
private function initClient()
{
putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $this->credentialsPath);
putenv('GOOGLE_APPLICATION_CREDENTIALS='.$this->credentialsPath);
$this->client = new Google_Client();
$this->client->useApplicationDefaultCredentials();
$this->client->addScope(Google_Service_Sheets::SPREADSHEETS);
Expand All @@ -45,4 +45,4 @@ public function client()
{
return $this->client;
}
}
}
2 changes: 1 addition & 1 deletion src/SpreadsheetService.php
Expand Up @@ -34,4 +34,4 @@ public function service()
{
return $this->service;
}
}
}
2 changes: 1 addition & 1 deletion src/helpers.php
@@ -1,6 +1,6 @@
<?php

if (!function_exists('getLettersToIdsTable')) {
if (! function_exists('getLettersToIdsTable')) {
/**
* @param $startColumn
* @param $endColumn
Expand Down

0 comments on commit 560371b

Please sign in to comment.