Code Duplication    Length = 10-10 lines in 6 locations

src/VfacTmdb/Account/WatchList.php 2 locations

@@ 36-45 (lines=10) @@
33
     * Get movies watchlist
34
     * @return \Generator|Results\Movie
35
     */
36
    public function getMovies() : \Generator
37
    {
38
        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/watchlist/movies', $this->options);
39
40
        $this->page          = (int) $response->page;
41
        $this->total_pages   = (int) $response->total_pages;
42
        $this->total_results = (int) $response->total_results;
43
44
        return $this->searchItemGenerator($response->results, Results\Movie::class);
45
    }
46
47
    /**
48
     * Get TV shows watchlist
@@ 51-60 (lines=10) @@
48
     * Get TV shows watchlist
49
     * @return \Generator|Results\TVShow
50
     */
51
    public function getTVShows() : \Generator
52
    {
53
        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/watchlist/tv', $this->options);
54
55
        $this->page          = (int) $response->page;
56
        $this->total_pages   = (int) $response->total_pages;
57
        $this->total_results = (int) $response->total_results;
58
59
        return $this->searchItemGenerator($response->results, Results\TVShow::class);
60
    }
61
62
    /**
63
     * Add / remove in watchlist items

src/VfacTmdb/Account/Favorite.php 1 location

@@ 119-128 (lines=10) @@
116
     * @param  string $result_class class for the results
117
     * @return \Generator
118
     */
119
    private function getAccountItems(string $item, string $result_class) : \Generator
120
    {
121
        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/favorite/'.$item, $this->options);
122
123
        $this->page          = (int) $response->page;
124
        $this->total_pages   = (int) $response->total_pages;
125
        $this->total_results = (int) $response->total_results;
126
127
        return $this->searchItemGenerator($response->results, $result_class);
128
    }
129
}
130

src/VfacTmdb/Account/Rated.php 3 locations

@@ 36-45 (lines=10) @@
33
     * Get movies rated
34
     * @return \Generator|Results\Movie
35
     */
36
    public function getMovies() : \Generator
37
    {
38
        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/rated/movies', $this->options);
39
40
        $this->page          = (int) $response->page;
41
        $this->total_pages   = (int) $response->total_pages;
42
        $this->total_results = (int) $response->total_results;
43
44
        return $this->searchItemGenerator($response->results, Results\Movie::class);
45
    }
46
47
    /**
48
     * Get TV shows rated
@@ 51-60 (lines=10) @@
48
     * Get TV shows rated
49
     * @return \Generator|Results\TVShow
50
     */
51
    public function getTVShows() : \Generator
52
    {
53
        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/rated/tv', $this->options);
54
55
        $this->page          = (int) $response->page;
56
        $this->total_pages   = (int) $response->total_pages;
57
        $this->total_results = (int) $response->total_results;
58
59
        return $this->searchItemGenerator($response->results, Results\TVShow::class);
60
    }
61
62
    /**
63
     * Get TV episodes rated
@@ 66-75 (lines=10) @@
63
     * Get TV episodes rated
64
     * @return \Generator|Results\TVEpisode
65
     */
66
    public function getTVEpisodes() : \Generator
67
    {
68
        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/rated/tv/episodes', $this->options);
69
70
        $this->page          = (int) $response->page;
71
        $this->total_pages   = (int) $response->total_pages;
72
        $this->total_results = (int) $response->total_results;
73
74
        return $this->searchItemGenerator($response->results, Results\TVEpisode::class);
75
    }
76
77
    /**
78
     * Add movie rate