Imdb\Title::genres PHP Method

genres() public method

Get all genres the movie is registered for
See also: IMDB page / (TitlePage)
public genres ( ) : array
return array genres (array[0..n] of strings)
    public function genres()
    {
        if (empty($this->moviegenres)) {
            $this->getPage("Title");
            if (preg_match_all('!<a href="/genre/[^?][^>]+?>(.*?)\\</a>!', $this->page["Title"], $matches)) {
                $this->moviegenres = $matches[1];
            } elseif (preg_match('!<div class="infobar">(.*?)</div>!ims', $this->page['Title'], $match)) {
                if (preg_match_all('!href="/genre/.*?"\\s*>(.*?)<!ims', $match[1], $matches)) {
                    $this->moviegenres = $matches[1];
                }
            }
        }
        foreach ($this->moviegenres as $i => $val) {
            $this->moviegenres[$i] = trim(strip_tags($this->moviegenres[$i]));
        }
        $this->moviegenres = array_merge(array_unique($this->moviegenres));
        return $this->moviegenres;
    }