Version 2.0
Version 2.0 contains many breaking changes to make the library more robust and allowing you to safely hack together new features.
The main change is that everything has an interface now, meaning you can swap out any class for a version of your own.
- Tracks no longer have public properties, their attributes must be accessed using getters.
- Speakers/Controllers no longer have public properties, their attributes must be accessed using getIp(), getName(), and getRoom().
Stream::getName()
has been replaced withStream::getTitle()
.Network::getRadioStations()
andNetwork::getRadioShows()
methods have been replaced withNetwork::getRadio()->getFavouriteShows()
andNetwork::getRadio()->getFavouriteStations()
respectively.- All methods that deal with times (track duration/position, alarm schedule, etc) now accept/return Time instances, to avoid confusion over when to pass an integer, or a string, and whether seconds should be included or not.
- Methods that look for items on the network but don’t find them not throw a
NotFoundException
instead of returning null, this makes it much clearer what the error is.
Network Constructor
The biggest change is how you instantiate a Network
instance.
The Network
constructor no longer accepts a cache or logger instance, just a CollectionInterface.
If you want to use logging then your logger can be injected using Network::setLogger()
.
The cache is now managed by a CachedCollection and a Device Factory.
By default all Devices will use an array based cache, so it will only persist for the duration of the current php execution.
And the standard Collection class does not cache at all, this is to avoid many bugs that were seen with frequently changing groupings, etc.