1 | <?php |
||
29 | class Emarsys |
||
30 | { |
||
31 | /** |
||
32 | * @var PluginClient |
||
33 | */ |
||
34 | private $httpClient; |
||
35 | |||
36 | /** |
||
37 | * @var Builder |
||
38 | */ |
||
39 | private $httpBuilder; |
||
40 | |||
41 | /** |
||
42 | * @var MessageFactory |
||
43 | */ |
||
44 | private $requestFactory; |
||
45 | |||
46 | 6 | public function __construct($username, $secret) |
|
53 | |||
54 | 3 | public function __call($name, $arguments) |
|
55 | { |
||
56 | 3 | $class = sprintf('\Emarsys\Api\%s', ucfirst($name)); |
|
57 | |||
58 | 3 | if (false === class_exists($class)) { |
|
59 | 1 | throw new NotFoundException($class); |
|
60 | } |
||
61 | |||
62 | 2 | if ($class instanceof ApiInterface) { |
|
63 | throw new LogicException(sprintf('%s must be extend Emarsys\Api\ApiInterface')); |
||
64 | } |
||
65 | |||
66 | 2 | $this->initialize(); |
|
67 | |||
68 | 2 | $class = new $class( |
|
69 | 2 | $this->httpClient, |
|
70 | 2 | $this->requestFactory |
|
71 | 2 | ); |
|
72 | |||
73 | 2 | return $class; |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * @param $httpBuilder |
||
78 | */ |
||
79 | 2 | public function setHttpBuilder($httpBuilder) |
|
83 | |||
84 | 2 | private function initialize() |
|
99 | } |
||
100 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.