FrequencyDistributionExpressionFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 10
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A make() 0 11 4
1
<?php
2
3
namespace Insenseanalytics\NovaBarMetrics;
4
5
use InvalidArgumentException;
6
use Illuminate\Database\Eloquent\Builder;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\Builder 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
8
class FrequencyDistributionExpressionFactory
9
{
10
	/**
11
	 * Create a new trend expression instance.
12
	 *
13
	 * @param \Illuminate\Database\Eloquent\Builder $query
14
	 * @param string                                $column
15
	 * @param int                                   $stepSize
16
	 *
17
	 * @return \Laravel\Nova\Metrics\FrequencyDistributionExpression
0 ignored issues
show
Bug introduced by
The type Laravel\Nova\Metrics\Fre...yDistributionExpression 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...
18
	 */
19
	public static function make(Builder $query, $column, $stepSize)
20
	{
21
		switch ($query->getConnection()->getDriverName()) {
22
			case 'sqlite':
23
				return new SqliteFrequencyDistributionExpression($query, $column, $stepSize);
0 ignored issues
show
Bug Best Practice introduced by
The expression return new Insenseanalyt...ry, $column, $stepSize) returns the type Insenseanalytics\NovaBar...yDistributionExpression which is incompatible with the documented return type Laravel\Nova\Metrics\Fre...yDistributionExpression.
Loading history...
24
			case 'mysql':
25
				return new MySqlFrequencyDistributionExpression($query, $column, $stepSize);
0 ignored issues
show
Bug Best Practice introduced by
The expression return new Insenseanalyt...ry, $column, $stepSize) returns the type Insenseanalytics\NovaBar...yDistributionExpression which is incompatible with the documented return type Laravel\Nova\Metrics\Fre...yDistributionExpression.
Loading history...
26
			case 'pgsql':
27
				return new PostgresFrequencyDistributionExpression($query, $column, $stepSize);
0 ignored issues
show
Bug Best Practice introduced by
The expression return new Insenseanalyt...ry, $column, $stepSize) returns the type Insenseanalytics\NovaBar...yDistributionExpression which is incompatible with the documented return type Laravel\Nova\Metrics\Fre...yDistributionExpression.
Loading history...
28
			default:
29
				throw new InvalidArgumentException('Bar chart metric helpers are not supported for this database.');
30
		}
31
	}
32
}
33