Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lessmore92 committed Feb 19, 2020
1 parent 16ee84e commit 00b5bca
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
11 changes: 6 additions & 5 deletions src/EloquentMarshallServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function register()
SortParameterParser::class
);

Builder::macro('searchable', function ($inputs = null) {
Builder::/** @scrutinizer ignore-call */ macro('searchable', function ($inputs = null) {
$searchable = new Searchable();
if ($inputs === null)
{
Expand All @@ -31,14 +31,15 @@ public function register()
return $query;
});

Builder::macro('sortable', function ($sort_param_anme = null) {
Builder::/** @scrutinizer ignore-call */ macro('sortable', function ($sorts = null) {
$sortable = new Sortable();
if ($sort_param_anme === null)
if ($sorts === null)
{
$sorts = Request::get(config('eloquent_marshall.sort_param_name', 'sort'));
$sorts = Request::get(/** @scrutinizer ignore-call */ config('eloquent_marshall.sort_param_name', 'sort'));
}

$parser = resolve(SortParameterParserInterface::class);
$parser = /** @scrutinizer ignore-call */
resolve(SortParameterParserInterface::class);
$sorts = $parser->parse($sorts);

/**
Expand Down
3 changes: 2 additions & 1 deletion src/Foundation/FilterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public function make(string $name, Model $model)
$this->resolveFilter($name, $model);
if (class_exists($this->getNamespace()))
{
$filter = app($this->getNamespace());
$filter = /** @scrutinizer ignore-call */
app($this->getNamespace());
return $filter;
}
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/Foundation/SortFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public function make(string $name, Model $model)
$this->resolveSort($name, $model);
if (class_exists($this->getNamespace()))
{
$sort = app($this->getNamespace());
$sort = /** @scrutinizer ignore-call */
app($this->getNamespace());
return $sort;
}
return false;
Expand Down
4 changes: 3 additions & 1 deletion src/Foundation/SortParameterParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class SortParameterParser implements SortParameterParserInterface
public function parse($sort_parameter): array
{
$_sorts = [];
$_default_order = config('eloquent-marshall.default_sort_order', 'desc');
$_default_order = /** @scrutinizer ignore-call */
config('eloquent-marshall.default_sort_order', 'desc');
if (!$this->sort_string_is_valid($sort_parameter))
{
return $_sorts;
Expand All @@ -27,6 +28,7 @@ public function parse($sort_parameter): array
}
else
{
$sorts = array();
$sorts[] = $sort_parameter;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function applyFilters($query, $filters)
{
foreach ($filters as $filter => $value)
{
$_filter = $this->filterFactory->make($filter, $query->getModel());
$_filter = $this->filterFactory->make($filter, $query->/** @scrutinizer ignore-call */ getModel());
if ($_filter instanceof Search)
{
$query = $_filter->apply($query, $value);
Expand Down
2 changes: 1 addition & 1 deletion src/Sortable.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function applySorts($query, $sorts)
{
foreach ($sorts as $sort => $value)
{
$_sort = $this->sortFactory->make($sort, $query->getModel());
$_sort = $this->sortFactory->make($sort, $query->/** @scrutinizer ignore-call */ getModel());
if ($_sort instanceof Sort)
{
$query = $_sort->apply($query, $value);
Expand Down

0 comments on commit 00b5bca

Please sign in to comment.