Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <?php
  2. require_once 'Video.php';
  3.  
  4. class VideoStore
  5. {
  6.  
  7.  
  8. public array $videoList;
  9.  
  10. public function addNewVideo(string $title)
  11. {
  12.  
  13. $this->videoList['title'][$title] = new Video($title);
  14.  
  15. }
  16.  
  17. public function checkOut(string $title)
  18. {
  19. foreach ($this->videoList as $list)
  20. if ($list->title == $title) {
  21. if ($video->isIn()) {
  22. $video->checkedOut();
  23. }
  24. } else {
  25. return "$title is not in store";
  26. }
  27. }
  28.  
  29. public function returnVideo(string $title)
  30. {
  31. foreach ($this->videoList as $list)
  32. if ($list == $title) {
  33. if (!$this->video->isIn()) {
  34. return $this->video->returned();
  35. }
  36. } else {
  37. return "This isn`t our video";
  38. }
  39.  
  40.  
  41.  
  42. }
  43.  
  44. public function receiveRating(string $title, int $rating)
  45. {
  46.  
  47. if (array_search($title,$this->videoList)) {
  48. return $this->video->addRating($rating);
  49. }
  50.  
  51. }
  52.  
  53. public function listVideos()
  54. {
  55. foreach ($this->videoList as $item) {
  56. return $item;
  57. }
  58. }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement