本文整理汇总了PHP中Movie::populateFromIMDB方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::populateFromIMDB方法的具体用法?PHP Movie::populateFromIMDB怎么用?PHP Movie::populateFromIMDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::populateFromIMDB方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createMovieFromDbRow
public static function createMovieFromDbRow($row)
{
$matchNetflix = array();
preg_match('/^"(.*?)"/', $row['netflixJSON'], $matchNetflix);
$netflixId = $matchNetflix[1];
$imdbJSON = utf8_encode($row['imdbJSON']);
$imdbJSON = Utils::fixJSON($imdbJSON);
$movie = new Movie($row['name'], $row['rNetflix'], $netflixId, $row['year'], $row['imageURL']);
$movie->populateFromIMDB(json_decode($imdbJSON, true));
if ($DEGUB) {
Utils::checkJSONError($movie->mName);
}
$rottenJSON = Utils::fixJSON($row['rottenJSON']);
$rottenJSON = json_decode($rottenJSON, true);
$similarLink = $rottenJSON['links']['similar'];
$movie->populateFromRottenTomatoes($similarLink, $row['rRotTomCritic'], $row['rRotTomViewer'], $rottenJSON['id']);
return $movie;
}
示例2: getMovies
//.........这里部分代码省略.........
\t\t\t"ratings":{
\t\t\t\t"critics_rating": "Certified Fresh",
\t\t\t \t"critics_score": 97,
"audience_rating": "Upright",
\t\t\t \t"audience_score": 88
\t\t\t},
\t\t\t"similarTitles":{
\t\t\t\t"Forest Fire":3434412,
\t\t\t\t"Gump and Gumper":341
\t\t\t}
\t\t}
\t},
\t"2":{
\t\t"args":["Forrest Gump", 9, 12345, 1994],
\t\t"data":{"Title":"Forrest Gump","Year":"1994","Rated":"PG-13","Released":"06 Jul 1994","Runtime":"142 min","Genre":"Drama, Romance","Director":"Robert Zemeckis","Writer":"Winston Groom (novel), Eric Roth (screenplay)","Actors":"Tom Hanks, Rebecca Williams, Sally Field, Michael Conner Humphreys","Plot":"Forrest Gump, while not intelligent, has accidentally been present at many historic moments, but his true love, Jenny Curran, eludes him.","Language":"English","Country":"USA","Awards":"Won 6 Oscars. Another 42 wins & 53 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTQwMTA5MzI1MF5BMl5BanBnXkFtZTcwMzY5Mzg3OA@@._V1_SX300.jpg","Metascore":"82","imdbRating":"8.8","imdbVotes":"875,526","imdbID":"tt0109830","Type":"movie","Response":"True"
\t\t},
\t\t"rotten":{
\t\t\t"ratings":{
\t\t\t\t"critics_rating": "Certified Fresh",
\t\t\t \t"critics_score": 97,
"audience_rating": "Upright",
\t\t\t \t"audience_score": 88
\t\t\t},
\t\t\t"similarTitles":{
\t\t\t}
\t\t}
\t},
\t"3":{
\t\t"args":["Forrest Gump", 9, 12345, 1994],
\t\t"data":{"Title":"Forrest Gump","Year":"1994","Rated":"PG-13","Released":"06 Jul 1994","Runtime":"142 min","Genre":"Drama, Romance","Director":"Robert Zemeckis","Writer":"Winston Groom (novel), Eric Roth (screenplay)","Actors":"Tom Hanks, Rebecca Williams, Sally Field, Michael Conner Humphreys","Plot":"Forrest Gump, while not intelligent, has accidentally been present at many historic moments, but his true love, Jenny Curran, eludes him.","Language":"English","Country":"USA","Awards":"Won 6 Oscars. Another 42 wins & 53 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTQwMTA5MzI1MF5BMl5BanBnXkFtZTcwMzY5Mzg3OA@@._V1_SX300.jpg","Metascore":"82","imdbRating":"8.8","imdbVotes":"875,526","imdbID":"tt0109830","Type":"movie","Response":"True"
\t\t},
\t\t"rotten":null
\t},
\t"4":{
\t\t"args":["Sleepless in Seattle", 5, 4352, 1993],
\t\t"data":{"Title":"Sleepless in Seattle","Year":"1993","Rated":"PG","Released":"25 Jun 1993","Runtime":"105 min","Genre":"Comedy, Drama, Romance","Director":"Nora Ephron","Writer":"Jeff Arch (story), Nora Ephron (screenplay), David S. Ward (screenplay), Jeff Arch (screenplay)","Actors":"Tom Hanks, Ross Malinger, Rita Wilson, Victor Garber","Plot":"A recently widowed man's son calls a radio talk-show in an attempt to find his father a partner.","Language":"English","Country":"USA","Awards":"Nominated for 2 Oscars. Another 4 wins & 10 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BNzc0MDkwNjI0NF5BMl5BanBnXkFtZTgwMTY1MjEyMDE@._V1_SX300.jpg","Metascore":"72","imdbRating":"6.8","imdbVotes":"102,376","imdbID":"tt0108160","Type":"movie","Response":"True"
\t\t},
\t\t"rotten":{
\t\t\t"ratings":{
\t\t\t\t"critics_rating": "Certified Fresh",
\t\t\t \t"critics_score": 97,
"audience_rating": "Upright",
\t\t\t \t"audience_score": 88
\t\t\t},
\t\t\t"similarTitles":{
\t\t\t}
\t\t}
\t},
\t"5":{
\t\t"args":["Sleepless in Seattle", 5, 4352, 1973],
\t\t"data":{"Title":"Sleepless in Seattle","Year":"1973","Rated":"PG","Released":"25 Jun 1973","Runtime":"105 min","Genre":"Comedy, Drama, Romance","Director":"Nora Ephron","Writer":"Jeff Arch (story), Nora Ephron (screenplay), David S. Ward (screenplay), Jeff Arch (screenplay)","Actors":"Tom Hanks, Ross Malinger, Rita Wilson, Victor Garber","Plot":"A recently widowed man's son calls a radio talk-show in an attempt to find his father a partner.","Language":"English","Country":"USA","Awards":"Nominated for 2 Oscars. Another 4 wins & 10 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BNzc0MDkwNjI0NF5BMl5BanBnXkFtZTgwMTY1MjEyMDE@._V1_SX300.jpg","Metascore":"72","imdbRating":"6.4","imdbVotes":"52,376","imdbID":"tt0108160","Type":"movie","Response":"True"
\t\t },
\t\t"rotten":{
\t\t\t"ratings":{
\t\t\t\t"critics_rating": "Certified Fresh",
\t\t\t\t"critics_score": 76,
\t\t\t\t"audience_rating": "Upright",
\t\t\t\t"audience_score": 65
\t\t\t},
\t\t\t"similarTitles":{
\t\t\t}
\t\t}
\t},
\t"6":{
\t\t"args":["Sleepless in Seattle", 5, 4352, 1956],
\t\t"data":{"Title":"Sleepless in Seattle","Year":"1956","Rated":"PG","Released":"25 Jun 1956","Runtime":"105 min","Genre":"Comedy, Drama, Romance","Director":"Nora Ephron","Writer":"Jeff Arch (story), Nora Ephron (screenplay), David S. Ward (screenplay), Jeff Arch (screenplay)","Actors":"Tom Hanks, Ross Malinger, Rita Wilson, Victor Garber","Plot":"A recently widowed man's son calls a radio talk-show in an attempt to find his father a partner.","Language":"English","Country":"USA","Awards":"Nominated for 2 Oscars. Another 4 wins & 10 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BNzc0MDkwNjI0NF5BMl5BanBnXkFtZTgwMTY1MjEyMDE@._V1_SX300.jpg","Metascore":"72","imdbRating":"4.8","imdbVotes":"12,376","imdbID":"tt0108160","Type":"movie","Response":"True"
\t\t },
\t\t"rotten":{
\t\t\t"ratings":{
\t\t\t\t"critics_rating": "Yuck",
\t\t\t\t"critics_score": 32,
\t\t\t\t"audience_rating": "Rotten",
\t\t\t\t"audience_score": 56
\t\t\t},
\t\t\t"similarTitles":{
\t\t\t}
\t\t}
\t}
}
EOT;
# echo "TOY DATA IS BEING USED\n";
$movies = array();
$dat = json_decode($data, true);
foreach ($dat as $id => $entry) {
$args = $entry["args"];
$mov = new Movie($args[0], $args[1], $args[2], $args[3]);
$imdb = $entry["data"];
$rotten = $entry["rotten"];
if (isset($imdb)) {
$mov->populateFromIMDB($imdb);
}
if (isset($rotten)) {
$mov->populateFromRottenTomatoes($rotten["ratings"]);
$mov->addSimilarTitles($rotten["similarTitles"]);
}
array_push($movies, $mov);
}
# print_r(getMovies());
return $movies;
}
示例3: dirname
<?php
/*
This file does some tests on the movie functionality.
*/
require_once dirname(__FILE__) . "/../movie.php";
$exampleJsonData = '{"Title":"Forrest Gump","Year":"1994","Rated":"PG-13","Released":"06 Jul 1994","Runtime":"142 min","Genre":"Drama, Romance","Director":"Robert Zemeckis","Writer":"Winston Groom (novel), Eric Roth (screenplay)","Actors":"Tom Hanks, Rebecca Williams, Sally Field, Michael Conner Humphreys","Plot":"Forrest Gump, while not intelligent, has accidentally been present at many historic moments, but his true love, Jenny Curran, eludes him.","Language":"English","Country":"USA","Awards":"Won 6 Oscars. Another 42 wins & 53 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTQwMTA5MzI1MF5BMl5BanBnXkFtZTcwMzY5Mzg3OA@@._V1_SX300.jpg","Metascore":"82","imdbRating":"8.8","imdbVotes":"875,526","imdbID":"tt0109830","Type":"movie","Response":"True"}';
$movie = new Movie("Forrest Gump", 'rat=4', 'id=12345', '1994', null);
$movie->populateFromIMDB($exampleJsonData);
if ($movie->rating['imdb'] != 8.800000000000001 || $movie->mtype !== "movie") {
trigger_error("There must be an issue with parsing imdb data", E_USER_ERROR);
}
var_dump($movie);