DashboardMetricRequest::metric()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 2
nc 1
nop 0
1
<?php
2
3
namespace AlexBowers\MultipleDashboard\Http\Requests;
4
5
use Laravel\Nova\Nova;
0 ignored issues
show
Bug introduced by
The type Laravel\Nova\Nova was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Laravel\Nova\Metrics\Metric;
0 ignored issues
show
Bug introduced by
The type Laravel\Nova\Metrics\Metric was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Laravel\Nova\Http\Requests\DashboardMetricRequest as CoreDashboardMetricRequest;
0 ignored issues
show
Bug introduced by
The type Laravel\Nova\Http\Requests\DashboardMetricRequest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use AlexBowers\MultipleDashboard\DashboardNova;
9
10
class DashboardMetricRequest extends CoreDashboardMetricRequest
11
{
12
    /**
13
     * Get the metric instance for the given request.
14
     *
15
     * @return \Laravel\Nova\Metrics\Metric
16
     */
17
    public function metric()
18
    {
19
        return $this->availableMetrics()->first(function ($metric) {
20
            return $this->metric === $metric->uriKey();
21
        }) ?: abort(404);
0 ignored issues
show
Bug introduced by
The function abort was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

21
        }) ?: /** @scrutinizer ignore-call */ abort(404);
Loading history...
22
    }
23
24
    /**
25
     * Get all of the possible metrics for the request.
26
     *
27
     * @return \Illuminate\Support\Collection
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Collection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
     */
29
    public function availableMetrics()
30
    {
31
        return DashboardNova::allAvailableDashboardCards($this)->whereInstanceOf(Metric::class);
32
    }
33
}
34