public function getGenre($id)
    {
        foreach ($this->data as $genre) {
            if ($id === $genre->getId()) {
                return $genre;
            }
        }

        return null;
    }
public function getGenre($id)
    {
        foreach ($this->data as $genre) {
            if ($id === $genre->getId()) {
                return $genre;
            }
        }

        return null;
    }
public function getGenre ( $ id ) { foreach ( $ this -> data as $ genre ) { if ( $ id === $ genre -> getId ( ) ) { return $ genre ; } } return null ; }
Retrieve a genre from the collection

@param $id
@return Genre|null
Retrieve a genre from the collection