Completed
Pull Request — master (#30)
by vincent
03:53
created

WatchList::removeMovie()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 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 View Code Duplication
class WatchList extends Account
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
{
28
29
    /**
30
     * Get movies watchlist
31
     * @return \Generator|Results\Movie
32
     */
33 1
    public function getMovies() : \Generator
34
    {
35 1
        return $this->getAccountListItems('watchlist', 'movies', Results\Movie::class);
36
    }
37
38
    /**
39
     * Get TV shows watchlist
40
     * @return \Generator|Results\TVShow
41
     */
42 1
    public function getTVShows() : \Generator
43
    {
44 1
        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 2
    public function addMovie(int $movie_id) : WatchList
53
    {
54 2
        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 1
    public function removeMovie(int $movie_id) : WatchList
63
    {
64 1
        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 1
    public function addTVShow(int $tvshow_id) : WatchList
73
    {
74 1
        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 1
    public function removeTVShow(int $tvshow_id) : WatchList
83
    {
84 1
        return $this->setListItem('watchlist', 'tv', $tvshow_id, false);
85
    }
86
}
87