This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | * This file is part of the Vultr PHP library. |
||
4 | * |
||
5 | * (c) Albert Leitato <[email protected]> |
||
6 | * |
||
7 | * For the full copyright and license information, please view the LICENSE |
||
8 | * file that was distributed with this source code. |
||
9 | */ |
||
10 | namespace Vultr\Api; |
||
11 | |||
12 | use Vultr\Entity\ReservedIp as ReservedIpEntity; |
||
13 | use Vultr\Exception\HttpException; |
||
14 | |||
15 | /** |
||
16 | * @author Albert Leitato <[email protected]> |
||
17 | */ |
||
18 | class ReservedIp extends AbstractApi |
||
19 | { |
||
20 | /** |
||
21 | * List all the active reserved IPs on this account. |
||
22 | * |
||
23 | * @return ReservedIpEntity[] |
||
24 | */ |
||
25 | public function list() |
||
26 | { |
||
27 | $response = $this->adapter->get(\sprintf('%s/reservedip/list', $this->endpoint)); |
||
28 | |||
29 | $ips = \json_decode($response); |
||
30 | |||
31 | $this->extractMeta($ips); |
||
0 ignored issues
–
show
|
|||
32 | |||
33 | return \array_map(function ($ip) { |
||
34 | return new ReservedIpEntity($ip); |
||
35 | }, $ips); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Create a new reserved IP. |
||
40 | * |
||
41 | * Reserved IPs can only be used within the same datacenter for which |
||
42 | * they were created. |
||
43 | * |
||
44 | * @param int $dcId |
||
45 | * @param string $ipType |
||
46 | * @param string $label |
||
47 | * |
||
48 | * @throws HttpException |
||
49 | * |
||
50 | * @return FloatingIpEntity |
||
51 | */ |
||
52 | public function create($dcId, $ipType, $label = null) |
||
53 | { |
||
54 | $content = [ |
||
55 | 'DCID' => $dcId, |
||
56 | 'ip_type' => $ipType, |
||
57 | ]; |
||
58 | if (null !== $label) { |
||
59 | $content['label'] = $label; |
||
60 | } |
||
61 | $response = $this->adapter->post(\sprintf('%s/reservedip/create', $this->endpoint), $content); |
||
62 | |||
63 | return \json_decode($response); |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * Remove a reserved IP from your account. |
||
68 | * |
||
69 | * After making this call, you will not be able to recover the IP address. |
||
70 | * |
||
71 | * @param int $ipAddressipAddress |
||
72 | * |
||
73 | * @throws HttpException |
||
74 | */ |
||
75 | public function delete($ipAddressipAddress) |
||
76 | { |
||
77 | $this->adapter->delete(\sprintf('%s/reservedip/destroy', $this->endpoint), ['ip_address' => $ipAddressipAddress]); |
||
0 ignored issues
–
show
The call to
AdapterInterface::delete() has too many arguments starting with array('ip_address' => $ipAddressipAddress) .
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. In this case you can add the ![]() |
|||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Convert an existing IP on a subscription to a reserved IP. |
||
82 | * |
||
83 | * @param int $serverId SUBID of the server that currently has the IP address |
||
0 ignored issues
–
show
There is no parameter named
$serverId . Did you maybe mean $serverIdd ?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit. Consider the following example. The parameter /**
* @param array $germany
* @param array $ireland
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was changed, but the annotation was not. ![]() |
|||
84 | * @param string $ipAddress IP address you want to convert |
||
85 | * @param string $paramname Label for this reserved IP |
||
0 ignored issues
–
show
There is no parameter named
$paramname . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not. ![]() |
|||
86 | * |
||
87 | * @throws HttpException |
||
88 | */ |
||
89 | public function convert($serverIdd, $ipAddress, $label = null) |
||
90 | { |
||
91 | $content = [ |
||
92 | 'SUBID' => $serverIdd, |
||
93 | 'ip_address' => $ipAddress, |
||
94 | ]; |
||
95 | if (null !== $label) { |
||
96 | $content['label'] = $label; |
||
97 | } |
||
98 | $this->adapter->post(\sprintf('%s/reservedip/conver', $this->endpoint), $content); |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * Attach a reserved IP to an existing subscription. |
||
103 | * |
||
104 | * @param int $ipAddress Reserved IP to attach to your account |
||
105 | * @param int $serverId Server to attach the reserved IP to |
||
106 | * |
||
107 | * @throws HttpException |
||
108 | * |
||
109 | * @return ActionEntity |
||
110 | */ |
||
111 | public function attach($ipAddress, $serverId) |
||
112 | { |
||
113 | return $this->executeAction($ipAddress, $serverId, 'attach'); |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * @param int $ipAddress |
||
118 | * @param int $serverId |
||
119 | * |
||
120 | * @throws HttpException |
||
121 | */ |
||
122 | public function detach($ipAddress, $serverId) |
||
123 | { |
||
124 | return $this->executeAction($ipAddress, $serverId, 'detach'); |
||
125 | } |
||
126 | |||
127 | /** |
||
128 | * Detach a reserved IP from an existing subscription. |
||
129 | * |
||
130 | * @param string $ipAddress |
||
131 | * @param int $serverId |
||
132 | * @param string $action |
||
133 | * |
||
134 | * @throws HttpException |
||
135 | */ |
||
136 | private function executeAction($ipAddress, $serverId, $action) |
||
137 | { |
||
138 | return $this->adapter->post(\sprintf('%s/reservedip/' . $action, $this->endpoint), ['ip_address' => $ipAddress, 'attach_SUBID' => $serverId]); |
||
139 | } |
||
140 | } |
||
141 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.