public function getFavouriteStation(string $name): Stream
    {
        $roughMatch = false;

        $stations = $this->getFavouriteStations();
        foreach ($stations as $station) {
            if ($station->getTitle() === $name) {
                return $station;
            }
            if (strtolower($station->getTitle()) === strtolower($name)) {
                $roughMatch = $station;
            }
        }

        if ($roughMatch) {
            return $roughMatch;
        }

        throw new NotFoundException("Unable to find a radio station by the name '{$name}'");
    }
public function getFavouriteStation(string $name): Stream
    {
        $roughMatch = false;

        $stations = $this->getFavouriteStations();
        foreach ($stations as $station) {
            if ($station->getTitle() === $name) {
                return $station;
            }
            if (strtolower($station->getTitle()) === strtolower($name)) {
                $roughMatch = $station;
            }
        }

        if ($roughMatch) {
            return $roughMatch;
        }

        throw new NotFoundException("Unable to find a radio station by the name '{$name}'");
    }
public function getFavouriteStation ( string $ name ) : Stream { $ roughMatch = false ; $ stations = $ this -> getFavouriteStations ( ) ; foreach ( $ stations as $ station ) { if ( $ station -> getTitle ( ) === $ name ) { return $ station ; } if ( strtolower ( $ station -> getTitle ( ) ) === strtolower ( $ name ) ) { $ roughMatch = $ station ; } } if ( $ roughMatch ) { return $ roughMatch ; } throw new NotFoundException ( "Unable to find a radio station by the name '{$name}'" ) ; }
Get the favourite radio station with the specified name.

If no case-sensitive match is found it will return a case-insensitive match.

@param string $name The name of the station

@return Stream
Get the favourite radio station with the specified name .