IndicatorFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A make() 0 9 2
1
<?php
2
3
namespace Mokka\Strategy;
4
5
6
use Symfony\Component\Debug\Exception\ClassNotFoundException;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Debug\...\ClassNotFoundException 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 IndicatorFactory
9
{
10
11
12
    public $class;
13
14
15
    public function __construct($class)
16
    {
17
        $this->class = sprintf('\\Mokka\\Strategy\\Indicator\\%s', ucfirst($class));
18
    }
19
20
21
    public function make($args)
22
    {
23
        if (class_exists($this->class)) {
24
            $instance = new $this->class(...$args);
25
26
            return $instance;
27
        }
28
29
        throw new ClassNotFoundException('Indicator Not Found', new \ErrorException());
30
    }
31
}