Ejemplo n.º 1
0
 public function testRank()
 {
     $castRank = 'Director';
     $cast = new Cast();
     $cast->setRank($castRank);
     $this->assertEquals($castRank, $cast->getRank());
 }
Ejemplo n.º 2
0
 private static function parseStaff($item)
 {
     $crawler = new Crawler($item);
     $cast = new Cast();
     if (preg_match('/people\\/(.*?)\\/.*$/', $crawler->filter('a')->attr('href'), $castId)) {
         $cast->setId($castId[1]);
     }
     $cast->setName($crawler->filter('a')->eq(1)->text());
     $cast->setRank($crawler->filter('small')->last()->text());
     $imageUrl = $crawler->filter('img')->last()->attr('data-src');
     $imageUrl = preg_replace('/\\/r\\/.*?x.*?\\//', '/', $imageUrl);
     $imageUrl = preg_replace('/\\?s=.*$/', '', $imageUrl);
     $cast->setImage($imageUrl);
     return $cast;
 }