Imdb\Title::rate_vote PHP Method

rate_vote() protected method

Setup votes
protected rate_vote ( )
    protected function rate_vote()
    {
        $page = $this->getPage("Title");
        if (preg_match('!itemprop="ratingValue">(\\d{1,2}[\\.,]\\d)!i', $page, $match)) {
            $rating = str_replace(',', '.', $match[1]);
            $this->main_rating = $rating;
        } else {
            $this->main_rating = 0;
        }
        if (preg_match('!itemprop="ratingCount">([\\d\\.,]+)</span!i', $page, $match)) {
            $votes = str_replace(array('.', ','), '', $match[1]);
            $this->main_votes = (int) $votes;
        } else {
            $this->main_votes = 0;
        }
    }