Skip to content

Commit 2080eb1

Browse files
authored
Helper refactor (#6)
* Modified dependencies, added strict modes, refactored to helpers, minor cosmetic changes * Apply fixes from StyleCI (#5)
1 parent feb400e commit 2080eb1

32 files changed

+63
-14
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"license": "MIT",
99
"require": {
1010
"php": "^7.4",
11-
"illuminate/support": "^8.0",
12-
"illuminate/database": "^8.0"
11+
"laravel/framework": "^8.0"
1312
},
1413
"require-dev": {
1514
"phpunit/phpunit": "^9.0",
File renamed without changes.

src/Config/ModelConfig.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Voice\JsonQueryBuilder\Config;
46

57
use Doctrine\DBAL\DBALException;
@@ -25,12 +27,12 @@ public function __construct(Model $model)
2527

2628
public function hasConfig(): bool
2729
{
28-
return array_key_exists(get_class($this->model), Config::get('asseco-json-query-builder.model_options'));
30+
return array_key_exists(get_class($this->model), config('asseco-json-query-builder.model_options'));
2931
}
3032

3133
protected function getConfig(): array
3234
{
33-
return Config::get('asseco-json-query-builder.model_options.' . get_class($this->model));
35+
return config('asseco-json-query-builder.model_options.' . get_class($this->model));
3436
}
3537

3638
public function getReturns()

src/Config/OperatorsConfig.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Voice\JsonQueryBuilder\Config;
46

57
use Voice\JsonQueryBuilder\Exceptions\JsonQueryBuilderException;

src/Config/RequestParametersConfig.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Voice\JsonQueryBuilder\Config;
46

57
class RequestParametersConfig extends SearchConfig

src/Config/SearchConfig.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Voice\JsonQueryBuilder\Config;
46

57
use Illuminate\Support\Facades\Config;
@@ -16,7 +18,7 @@ abstract class SearchConfig
1618
*/
1719
public function __construct()
1820
{
19-
$this->config = Config::get('asseco-json-query-builder');
21+
$this->config = config('asseco-json-query-builder');
2022
$this->register();
2123
}
2224

src/Config/TypesConfig.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Voice\JsonQueryBuilder\Config;
46

57
use Voice\JsonQueryBuilder\Exceptions\JsonQueryBuilderException;

src/Exceptions/JsonQueryBuilderException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Voice\JsonQueryBuilder\Exceptions;
46

57
use Exception;

src/JsonQuery.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ class JsonQuery
1616
protected ModelConfig $modelConfig;
1717
protected array $registeredParameters;
1818

19-
/*
20-
* TODO: implement date from-to etc.
21-
*/
22-
2319
/**
2420
* JsonQuery constructor.
2521
* @param Builder $builder

src/JsonQueryServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ class JsonQueryServiceProvider extends ServiceProvider
1111
*/
1212
public function register()
1313
{
14-
$this->mergeConfigFrom(__DIR__ . '/Config/asseco-json-query-builder.php', 'asseco-json-query-builder');
14+
$this->mergeConfigFrom(__DIR__ . '/../config/asseco-json-query-builder.php', 'asseco-json-query-builder');
1515
}
1616

1717
/**
1818
* Bootstrap the application services.
1919
*/
2020
public function boot()
2121
{
22-
$this->publishes([__DIR__ . '/Config/asseco-json-query-builder.php' => config_path('asseco-json-query-builder.php')]);
22+
$this->publishes([__DIR__ . '/../config/asseco-json-query-builder.php' => config_path('asseco-json-query-builder.php')]);
2323
}
2424
}

0 commit comments

Comments
 (0)