duncan3dc\Sonos\Network::getPlaylistByName PHP Method

getPlaylistByName() public method

If no case-sensitive match is found it will return a case-insensitive match.
public getPlaylistByName ( $name ) : duncan3dc\Sonos\Playlist | null
return duncan3dc\Sonos\Playlist | null
    public function getPlaylistByName($name)
    {
        $roughMatch = false;
        $playlists = $this->getPlaylists();
        foreach ($playlists as $playlist) {
            if ($playlist->getName() === $name) {
                return $playlist;
            }
            if (strtolower($playlist->getName()) === strtolower($name)) {
                $roughMatch = $playlist;
            }
        }
        if ($roughMatch) {
            return $roughMatch;
        }
    }