1 | <?php |
||||
2 | declare(strict_types=1); |
||||
3 | |||||
4 | namespace GeodisBundle\Service; |
||||
5 | |||||
6 | use Doctrine\ORM\EntityManagerInterface; |
||||
7 | use PHPUnit\Util\Exception; |
||||
8 | use GeodisBundle\Service\DAO\Connection; |
||||
9 | use GeodisBundle\Service\DAO\Exception\ApiException; |
||||
10 | |||||
11 | abstract class GeodisManager |
||||
12 | { |
||||
13 | protected $list = []; |
||||
14 | protected $model; |
||||
15 | protected $config; |
||||
16 | protected $em; |
||||
17 | |||||
18 | public function __construct(EntityManagerInterface $em) |
||||
19 | { |
||||
20 | $this->em = $em; |
||||
21 | } |
||||
22 | |||||
23 | public function setConfig($config) |
||||
24 | { |
||||
25 | $this->config = $config; |
||||
26 | } |
||||
27 | |||||
28 | public function init() |
||||
29 | { |
||||
30 | try { |
||||
31 | Connection::setConfig($this->config, $this->em); |
||||
32 | } catch (ApiException $e) { |
||||
33 | throw new Exception("Can't initiate connection: ", $e->getCode()); |
||||
0 ignored issues
–
show
|
|||||
34 | } |
||||
35 | } |
||||
36 | |||||
37 | /** |
||||
38 | * @return object |
||||
39 | */ |
||||
40 | public function getModel($name) |
||||
41 | { |
||||
42 | try { |
||||
43 | $classname = $cname = 'GeodisBundle\\Model\\'.$name; |
||||
0 ignored issues
–
show
|
|||||
44 | |||||
45 | $this->model = new $classname(); |
||||
46 | |||||
47 | return $this; |
||||
48 | } catch (ApiException $e) { |
||||
49 | throw new Exception("Model doesn't existe : ", $e->getCode()); |
||||
0 ignored issues
–
show
The call to
PHPUnit\Util\Exception::__construct() has too many arguments starting with 'Model doesn't existe : ' .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
50 | } |
||||
51 | } |
||||
52 | } |
||||
53 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.