WatchList   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 59
ccs 12
cts 12
cp 1
rs 10
c 3
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A addTVShow() 0 3 1
A addMovie() 0 3 1
A getTVShows() 0 3 1
A getMovies() 0 3 1
A removeMovie() 0 3 1
A removeTVShow() 0 3 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the Tmdb package.
4
 *
5
 * (c) Vincent Faliès <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author Vincent Faliès <[email protected]>
11
 * @copyright Copyright (c) 2017
12
 */
13
14
15
namespace VfacTmdb\Account;
16
17
use VfacTmdb\Results;
18
use VfacTmdb\Abstracts\Account;
19
20
/**
21
 * Class to manipulate account watchlist
22
 * @package Tmdb
23
 * @author Vincent Faliès <[email protected]>
24
 * @copyright Copyright (c) 2017
25
 */
26
class WatchList extends Account
27
{
28
29
    /**
30
     * Get movies watchlist
31
     * @return \Generator|Results\Movie
32
     */
33 3
    public function getMovies() : \Generator
34
    {
35 3
        return $this->getAccountListItems('watchlist', 'movies', Results\Movie::class);
36
    }
37
38
    /**
39
     * Get TV shows watchlist
40
     * @return \Generator|Results\TVShow
41
     */
42 3
    public function getTVShows() : \Generator
43
    {
44 3
        return $this->getAccountListItems('watchlist', 'tv', Results\TVShow::class);
45
    }
46
47
    /**
48
     * Add movie in watchlist
49
     * @param  int       $movie_id movie id
50
     * @return WatchList
51
     */
52 6
    public function addMovie(int $movie_id) : WatchList
53
    {
54 6
        return $this->setListItem('watchlist', 'movie', $movie_id, true);
55
    }
56
57
    /**
58
     * Remove movie from watchlist
59
     * @param  int       $movie_id movie id
60
     * @return WatchList
61
     */
62 3
    public function removeMovie(int $movie_id) : WatchList
63
    {
64 3
        return $this->setListItem('watchlist', 'movie', $movie_id, false);
65
    }
66
67
    /**
68
     * Add TV show in watchlist
69
     * @param  int    $tvshow_id TV show id
70
     * @return WatchList
71
     */
72 3
    public function addTVShow(int $tvshow_id) : WatchList
73
    {
74 3
        return $this->setListItem('watchlist', 'tv', $tvshow_id, true);
75
    }
76
77
    /**
78
     * Remove TV show from watchlist
79
     * @param  int    $tvshow_id TV show id
80
     * @return WatchList
81
     */
82 3
    public function removeTVShow(int $tvshow_id) : WatchList
83
    {
84 3
        return $this->setListItem('watchlist', 'tv', $tvshow_id, false);
85
    }
86
}
87