FrequencyDistributionExpressionFactory::make()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 11
rs 9.9666
c 0
b 0
f 0
cc 4
nc 4
nop 3
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