Question: i need this Databases; / / PHP class declaration and logic class ShowsLibrary { public function displayEpisodes ( $showNumber ) { $showRepo = new ShowRepository
i need this Databases";
PHP class declaration and logic
class ShowsLibrary
public function displayEpisodes$showNumber
$showRepo new ShowRepository;
$rows $showRepofindAll$showNumber;
if count$rows
$response TvAPI::episodes$showNumber;
$shows Show::fromAPIResponse$response;
foreach $shows as $s
$showRepocreate$s $showNumber;
else
$shows Show::fromTableRows$rows;
Display episodes
foreach $shows as $show
echo "Name: $showname Season: $showseason Episode: $showepisode Summary: $showsummary;
added to name $name;
$thisimage $image;
$thisseason $season;
$thisepisode $episode;
$thissummary $summary;
$thisshowNumber $showNumber;
public static function fromTableRows$rows
return arraymapfunction$row
return new Show$rowname $rowimage $rowseason $rowepisode $rowsummary $rowshownumber';
$rows;
public static function fromAPIResponse$response
return arraymapfunction$item
return new Show$itemname $itemimage $itemseason $itemepisode $itemsummary $itemshownumber';
$response;
class ShowRepo
public $database;
public function construct
$thisdatabase new SQLiteshowsdb;
$thisdatabaseexecCREATE TABLE IF NOT EXISTS shows id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, image TEXT, season INTEGER NOT NULL, episode INTEGER NOT NULL, summary TEXT NOT NULL, shownumber INTEGER NOT NULL;
public function create$show
$sql "INSERT INTO shows name image, season, episode, summary, shownumber VALUES ;
$stmt $thisdatabaseprepare$sql;
$stmtbindValue $showname;
$stmtbindValue $showimage;
$stmtbindValue $showseason;
$stmtbindValue $showepisode;
$stmtbindValue $showsummary;
$stmtbindValue $showshowNumber;
$stmtexecute;
Add the rest of your code here...
class TvAPI
public static function show$showNumber
API call to get show details...
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
