1 | <?php |
||
15 | class Service extends AbstractService |
||
16 | { |
||
17 | /** |
||
18 | * Create a new network resource. |
||
19 | * |
||
20 | * @param array $options {@see \OpenStack\Networking\v2\Api::postNetwork} |
||
21 | * |
||
22 | * @return Network |
||
23 | */ |
||
24 | 1 | public function createNetwork(array $options) |
|
28 | |||
29 | /** |
||
30 | * Create a new network resources. |
||
31 | * |
||
32 | * @param array $options {@see \OpenStack\Networking\v2\Api::postNetworks} |
||
33 | * |
||
34 | * @return array |
||
35 | */ |
||
36 | 1 | public function createNetworks(array $options) |
|
40 | |||
41 | /** |
||
42 | * Retrieve a network object without calling the remote API. Any values provided in the array will populate the |
||
43 | * empty object, allowing you greater control without the expense of network transactions. To call the remote API |
||
44 | * and have the response populate the object, call {@see Network::retrieve}. |
||
45 | * |
||
46 | * @param string $id |
||
47 | * |
||
48 | * @return Network |
||
49 | */ |
||
50 | 1 | public function getNetwork($id) |
|
54 | |||
55 | /** |
||
56 | * List networks. |
||
57 | * |
||
58 | * @param array $options {@see \OpenStack\Networking\v2\Api::getNetworks} |
||
59 | * |
||
60 | * @return \Generator |
||
61 | */ |
||
62 | 1 | public function listNetworks(array $options = []) |
|
66 | |||
67 | /** |
||
68 | * Create a new subnet resource. |
||
69 | * |
||
70 | * @param array $options {@see \OpenStack\Networking\v2\Api::postSubnet} |
||
71 | * |
||
72 | * @return Subnet |
||
73 | */ |
||
74 | 1 | public function createSubnet(array $options) |
|
78 | |||
79 | /** |
||
80 | * Create a new subnet resources. |
||
81 | * |
||
82 | * @param array $options {@see \OpenStack\Networking\v2\Api::postSubnets} |
||
83 | * |
||
84 | * @return []Subnet |
||
85 | */ |
||
86 | 1 | public function createSubnets(array $options) |
|
90 | |||
91 | /** |
||
92 | * Retrieve a subnet object without calling the remote API. Any values provided in the array will populate the |
||
93 | * empty object, allowing you greater control without the expense of network transactions. To call the remote API |
||
94 | * and have the response populate the object, call {@see Subnet::retrieve}. |
||
95 | * |
||
96 | * @param string $id |
||
97 | * |
||
98 | * @return Subnet |
||
99 | */ |
||
100 | 1 | public function getSubnet($id) |
|
104 | |||
105 | /** |
||
106 | * List subnets. |
||
107 | * |
||
108 | * @param array $options {@see \OpenStack\Networking\v2\Api::getSubnets} |
||
109 | * |
||
110 | * @return \Generator |
||
111 | */ |
||
112 | 1 | public function listSubnets(array $options = []) |
|
116 | |||
117 | /** |
||
118 | * Create a new port resource. |
||
119 | * |
||
120 | * @param array $options {@see \OpenStack\Networking\v2\Api::postPort} |
||
121 | * |
||
122 | * @return Port |
||
123 | */ |
||
124 | 1 | public function createPort(array $options) |
|
128 | |||
129 | /** |
||
130 | * Create new port resources. |
||
131 | * |
||
132 | * @param array $options {@see \OpenStack\Networking\v2\Api::postPorts} |
||
133 | * |
||
134 | * @return []Port |
||
135 | */ |
||
136 | 1 | public function createPorts(array $options) |
|
140 | |||
141 | /** |
||
142 | * Retrieve a subnet object without calling the remote API. Any values provided in the array will populate the |
||
143 | * empty object, allowing you greater control without the expense of network transactions. To call the remote API |
||
144 | * and have the response populate the object, call {@see Port::retrieve}. |
||
145 | * |
||
146 | * @param string $id |
||
147 | * |
||
148 | * @return Port |
||
149 | */ |
||
150 | 1 | public function getPort($id) |
|
154 | |||
155 | /** |
||
156 | * List ports. |
||
157 | * |
||
158 | * @param array $options {@see \OpenStack\Networking\v2\Api::getPorts} |
||
159 | * |
||
160 | * @return \Generator |
||
161 | */ |
||
162 | 1 | public function listPorts(array $options = []) |
|
166 | } |
||
167 |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the interface: