Art-of-WiFi / UniFi-API-client

A PHP API client class to interact with Ubiquiti's UniFi Controller API
MIT License
1.13k stars 223 forks source link

Restored the old vlan functionality in create_wlan #136

Open markdegrootnl opened 2 years ago

markdegrootnl commented 2 years ago

In e7e1540df4c039b81a0a4b0aeee713c8547bc4e0 the create_wlan function was update to use networkconf_id instead of the number of the vlan. This is correct for newer controllers, however breaks the functionality for older controllers.

I've added the possibility to specify the vlan either with a vlan id for version 5 controllers or with a networkconf_id for version 6 controllers.

markdegrootnl commented 2 years ago

code-inspector says Function create_wlan is too long. Consider refactoring., not sure how to fix this.

malle-pietje commented 2 years ago

Looking into this again, apologies for the delayed response. Yeah, Code Inspector can be very strict, I'm actually surprised it allows the single class to be as long as it is:wink:

Looking at the change in parameters; if we do this it breaks other implementations that rely on the vlan_id parameter which you overwrite or am I misunderstanding your intent and changes?

markdegrootnl commented 2 years ago

I've renamed the $vlan_id parameter to $networkconf_id for clarity. In my implementation you can either use $networkconf_id for controllers version 6 or $vlan for version 5 controllers.

If you don't want to support version 5 controllers, you can ignore this PR.