1 | <?php |
||
11 | class VideoRepository |
||
12 | { |
||
13 | /** |
||
14 | * Get a single video |
||
15 | * |
||
16 | * @return void |
||
17 | */ |
||
18 | public function getVideo($id) |
||
22 | |||
23 | /** |
||
24 | * Update the number of views by one everytime a video is viewed |
||
25 | * |
||
26 | * @param Integer $id video Id |
||
27 | * @return voi |
||
28 | */ |
||
29 | public function updateViews($id) |
||
33 | |||
34 | /** |
||
35 | * Return all comments as well as the respective users |
||
36 | * |
||
37 | * @param integer $videoId Video Id |
||
38 | * @return Object Comments collection |
||
39 | */ |
||
40 | public function getAllComments($videoId) |
||
47 | |||
48 | /** |
||
49 | * Parse the Youtube Url. |
||
50 | * |
||
51 | * @param string $url Youtube Url |
||
52 | * @return string Embed link |
||
53 | */ |
||
54 | public function makeYoutubeUrl($url) |
||
58 | |||
59 | /** |
||
60 | * Return true if a user has liked a video and |
||
61 | * false if the user has not liked the vide. |
||
62 | * |
||
63 | * @param Collection $video Video collection |
||
64 | * @return boolean True or false |
||
65 | */ |
||
66 | public function getLikeStatus($video) |
||
78 | |||
79 | /** |
||
80 | * Favorite a video. |
||
81 | * |
||
82 | * @param Request $request User request |
||
83 | * @return array New favorite message |
||
84 | */ |
||
85 | public function favoriteVideo($request) |
||
93 | |||
94 | /** |
||
95 | * Unfavorite a video. |
||
96 | * |
||
97 | * @param Request $request User request |
||
98 | * @return array New unfavorite message |
||
99 | */ |
||
100 | public function unfavoriteVideo($request) |
||
118 | |||
119 | /** |
||
120 | * If the person trying to edit or delete a video is not the |
||
121 | * owner, redirect to the homepage |
||
122 | * |
||
123 | * @param Object $video Video collection |
||
124 | * @return boolean true if valid, otherwise false |
||
125 | */ |
||
126 | public function authorized($video) |
||
134 | |||
135 | /** |
||
136 | * Get the most popular videos in the followin categories |
||
137 | * Liked |
||
138 | * commented on |
||
139 | * Favorited |
||
140 | * |
||
141 | * @return array top popular videos |
||
142 | */ |
||
143 | public function getTopPopularVideos($number = 3) |
||
166 | } |
||
167 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.