Beispiel #1
0
 /**
  * Gets titles actor is know for.
  * 
  * @return array.
  */
 public function getKnownFor()
 {
     if (!$this->knownFor) {
         //grab all the titles actor is know for
         $known = $this->crawler->filter('div#knownfor > div');
         //extract id, title, poster for each one and make multidim array from it
         foreach ($known as $k => $v) {
             $crawler = new crawler($v);
             $imdbid = $this->id($crawler->filter('a')->extract('href'));
             $title = head($crawler->filter('a > img')->extract('title'));
             $poster = $this->image($crawler->filter('a > img')->extract('src'), $imdbid);
             $year = Helpers::extractYear(head($crawler->filter('a')->eq(1)->extract('_text')));
             $this->knownFor[] = array('imdb_id' => $imdbid, 'title' => $title, 'poster' => $poster, 'year' => $year);
         }
     }
     $this->images->saveMultiple($this->imgUrls, null, 'imdb/posters/');
     return $this->knownFor;
 }