forked from comyo-media/shipcloud-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShipcloud.php
More file actions
33 lines (26 loc) · 707 Bytes
/
Copy pathShipcloud.php
File metadata and controls
33 lines (26 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace ComyoMedia\Shipcloud;
class Shipcloud
{
private $apiKey;
public function __construct($apiKey = null)
{
$this->apiKey = $apiKey;
}
public static function make($apiKey = null)
{
return new static($apiKey);
}
public function __call($method, array $parameters = [])
{
return $this->getApiInstance($method);
}
protected function getApiInstance($method)
{
$class = "\\ComyoMedia\\Shipcloud\\Api\\".ucwords($method);
if (class_exists($class)) {
return new $class($this->apiKey);
}
throw new \BadMethodCallException("Undefined method [{$method}] called.");
}
}