Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'Video.php';
- class VideoStore
- {
- public array $videoList;
- public function addNewVideo(string $title)
- {
- $this->videoList['title'][$title] = new Video($title);
- }
- public function checkOut(string $title)
- {
- foreach ($this->videoList as $list)
- if ($list->title == $title) {
- if ($video->isIn()) {
- $video->checkedOut();
- }
- } else {
- return "$title is not in store";
- }
- }
- public function returnVideo(string $title)
- {
- foreach ($this->videoList as $list)
- if ($list == $title) {
- if (!$this->video->isIn()) {
- return $this->video->returned();
- }
- } else {
- return "This isn`t our video";
- }
- }
- public function receiveRating(string $title, int $rating)
- {
- if (array_search($title,$this->videoList)) {
- return $this->video->addRating($rating);
- }
- }
- public function listVideos()
- {
- foreach ($this->videoList as $item) {
- return $item;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement