1 | <?php |
||
28 | class Vultr |
||
29 | { |
||
30 | use Support\Str; |
||
31 | |||
32 | /** |
||
33 | * @var AdapterInterface |
||
34 | */ |
||
35 | protected $adapter; |
||
36 | |||
37 | /** |
||
38 | * Create a new Vultr API instance. |
||
39 | * |
||
40 | * This is the entry point to the api resource |
||
41 | * |
||
42 | * @param AdapterInterface $adapter |
||
43 | */ |
||
44 | public function __construct($token, AdapterInterface $adapter = null) |
||
48 | |||
49 | /** |
||
50 | * Call API resources as though the were Vultr::class properties. |
||
51 | * |
||
52 | * @param mixed $resource |
||
53 | * |
||
54 | * @return mixed Api Resource if it exists |
||
55 | **/ |
||
56 | public function __get($resource) |
||
60 | |||
61 | /** |
||
62 | * Create resource instance. |
||
63 | * |
||
64 | * @return mixed |
||
65 | **/ |
||
66 | protected function getClass($class) |
||
75 | |||
76 | /** |
||
77 | * Set the default client adapter. |
||
78 | * |
||
79 | * @param \Http\Adapter\AdapterInterface $adapter |
||
80 | **/ |
||
81 | public function setClient(AdapterInterface $adapter) |
||
85 | |||
86 | /** |
||
87 | * Set up the Guzzle adapter. |
||
88 | * |
||
89 | * @param string $token Api Token |
||
90 | **/ |
||
91 | protected function createGuzzleAdapter($token) |
||
102 | |||
103 | /** |
||
104 | * Create a client adapter. |
||
105 | * |
||
106 | * @param Http\Adapter\AdapterInterface|null $adapter |
||
107 | * @param string|null $token API Token |
||
108 | **/ |
||
109 | protected function createAdapter($adapter, $token = null) |
||
117 | } |
||
118 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.