darsyn / ip

Immutable value object for IPv4 and IPv6 addresses, including helper methods and Doctrine support.
http://darsyn.github.io/ip/
MIT License
245 stars 21 forks source link

__toString #60

Closed FredDut closed 2 years ago

FredDut commented 2 years ago

Hello,

Nice work.

Is it possible to add à toString method in Multi entity ? The toString method should return $this->getProtocolAppropriateAddress(). Twig rendering and forms will be simpler with a __toString()

Regards

zanbaldwin commented 2 years ago

In the documentation it states that __toString() maps to the getBinary() method.

But then I realised that I never actually implemented that functionality. Thanks for pointing it out.

So yes, I'll add __toString() in the interface and then implement it with the most appropriate method in each of the version classes. Hopefully will have this done in the next couple of days.

zanbaldwin commented 2 years ago

Sorry it took me so long to get round to this, getting PHPUnit working for both 5.6 and 8.0 wasn't as easy as I thought it was going to be so I left it for a while and completely forgot to finish it until now.

Version 4.0.1 has been released which includes string casting.