GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — merge-dev-to-master ( fdc6fe )
by
unknown
11:18
created

DisplayDatatablesAsyncAlterPaginate   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 25
c 1
b 0
f 0
dl 0
loc 58
rs 10
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A renderAsync() 0 23 3
A registerRoutes() 0 15 3
1
<?php
2
3
namespace SleepingOwl\Admin\Display;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Routing\Router;
7
use SleepingOwl\Admin\Contracts\WithRoutesInterface;
8
9
class DisplayDatatablesAsyncAlterPaginate extends DisplayDatatablesAsync implements WithRoutesInterface
10
{
11
    /**
12
     * Register display routes.
13
     *
14
     * @param Router $router
15
     *
16
     * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
17
     */
18
    public static function registerRoutes(Router $router)
19
    {
20
        $routeName = 'admin.display.async.alter_paginate';
21
        if (! $router->has($routeName)) {
22
            $router->get('{adminModel}/async/alter_paginate/{adminDisplayName?}', [
23
                'as' => $routeName,
24
                'uses' => 'SleepingOwl\Admin\Http\Controllers\AlterPaginateDisplayController@async',
0 ignored issues
show
Bug introduced by
The controller App\Http\Controllers\Sle...ginateDisplayController does not seem to exist.

If there is a route defined but the controller class cannot be found there are two options: 1. the controller class needs to be implemented or 2. the route is outdated and can be removed.

If ?FooController? was found and ?BarController? is missing for the following example, either the controller should be implemented or the route should be removed:

$app->group(['as' => 'foo', 'prefix' => 'foo', 'namespace' => 'Foo'], function($app) {
    $app->group(['as' => 'foo', 'prefix' => 'foo'], function($app) {
        $app->get('/all/{from}/{to}', ['as' => 'all', 'uses' => 'FooController@getFoo']);
        $app->get('/all/{from}/{to}', ['as' => 'all', 'uses' => 'BarController@getBar']);
    });
});
Loading history...
25
            ]);
26
        }
27
28
        $routeName = 'admin.display.async.inlineEdit';
29
        if (! $router->has($routeName)) {
30
            $router->post('{adminModel}/async/{adminDisplayName?}', [
31
                'as' => $routeName,
32
                'uses' => 'SleepingOwl\Admin\Http\Controllers\AdminController@inlineEdit',
0 ignored issues
show
Bug introduced by
The controller App\Http\Controllers\Sle...rollers\AdminController does not seem to exist.

If there is a route defined but the controller class cannot be found there are two options: 1. the controller class needs to be implemented or 2. the route is outdated and can be removed.

If ?FooController? was found and ?BarController? is missing for the following example, either the controller should be implemented or the route should be removed:

$app->group(['as' => 'foo', 'prefix' => 'foo', 'namespace' => 'Foo'], function($app) {
    $app->group(['as' => 'foo', 'prefix' => 'foo'], function($app) {
        $app->get('/all/{from}/{to}', ['as' => 'all', 'uses' => 'FooController@getFoo']);
        $app->get('/all/{from}/{to}', ['as' => 'all', 'uses' => 'BarController@getBar']);
    });
});
Loading history...
33
            ]);
34
        }
35
    }
36
37
    /**
38
     * Render async request.
39
     *
40
     * @param \Illuminate\Http\Request $request
41
     *
42
     * @return array
43
     */
44
    public function renderAsync(Request $request)
45
    {
46
        $query = $this->getRepository()->getQuery();
47
        $totalCount = 0;
48
        $filteredCount = 0;
49
50
        if (! is_null($this->distinct)) {
51
            $filteredCount = $query->distinct()->count($this->getDistinct());
52
        }
53
54
        $this->modifyQuery($query);
55
        $this->applySearch($query, $request);
56
57
        if (is_null($this->distinct)) {
58
            $countQuery = clone $query;
59
            $countQuery->getQuery()->orders = null;
60
            $filteredCount = 500;
61
        }
62
63
        $this->applyOffset($query, $request);
0 ignored issues
show
Bug introduced by
$query of type Illuminate\Database\Eloquent\Builder is incompatible with the type Illuminate\Database\Query\Builder expected by parameter $query of SleepingOwl\Admin\Displa...lesAsync::applyOffset(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

63
        $this->applyOffset(/** @scrutinizer ignore-type */ $query, $request);
Loading history...
64
        $collection = $query->get();
65
66
        return $this->prepareDatatablesStructure($request, $collection, $totalCount, $filteredCount);
67
    }
68
}
69