Issues (13)

src/Exchange/ExchangeFactory.php (1 issue)

Labels
Severity
1
<?php
2
3
4
namespace Mokka\Exchange;
5
6
use Symfony\Component\Debug\Exception\ClassNotFoundException;
0 ignored issues
show
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
/**
9
 * Class ExchangeFactory
10
 * @package Botta\Exchange
11
 */
12
class ExchangeFactory
13
{
14
15
    /**
16
     * @var string
17
     */
18
    private $class;
19
20
    /**
21
     * ExchangeFactory constructor.
22
     * @param $class
23
     */
24
    public function __construct($class)
25
    {
26
        $this->class = sprintf('\\Mokka\\Exchange\\Market\\%s', ucfirst($class));
27
    }
28
29
    /**
30
     * @param $args
31
     * @return ExchangeInterface
32
     * @throws ClassNotFoundException
33
     */
34
    public function make(array $args)
35
    {
36
        if (class_exists($this->class)) {
37
            $instance = new $this->class(...$args);
38
39
            return $instance;
40
        }
41
42
        throw new ClassNotFoundException('Market Provider Not Found', new \ErrorException());
43
    }
44
45
}