Favorite   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A markMovieAsFavorite() 0 3 1
A getMovies() 0 3 1
A getTVShows() 0 3 1
A markTVShowAsFavorite() 0 3 1
A unmarkTVShowAsFavorite() 0 3 1
A unmarkMovieAsFavorite() 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 favorite
22
 * @package Tmdb
23
 * @author Vincent Faliès <[email protected]>
24
 * @copyright Copyright (c) 2017
25
 */
26
class Favorite extends Account
27
{
28
29
    /**
30
     * Get account favorite movies
31
     * @return \Generator|Results\Movie
32
     */
33 3
    public function getMovies() : \Generator
34
    {
35 3
        return $this->getAccountListItems('favorite', 'movies', Results\Movie::class);
36
    }
37
38
    /**
39
     * Get account favorite tvshows
40
     * @return \Generator|Results\TVShow
41
     */
42 3
    public function getTVShows() : \Generator
43
    {
44 3
        return $this->getAccountListItems('favorite', 'tv', Results\TVShow::class);
45
    }
46
47
    /**
48
     * Marl a movie as favorite
49
     * @param  int    $movie_id Movie id
50
     * @return Favorite
51
     */
52 6
    public function markMovieAsFavorite(int $movie_id) : Favorite
53
    {
54 6
        return $this->setListItem('favorite', 'movie', $movie_id, true);
55
    }
56
    /**
57
     * Unmark a movie as favorite
58
     * @param int $movie_id Movie id
59
     * @return Favorite
60
     */
61 3
    public function unmarkMovieAsFavorite(int $movie_id) : Favorite
62
    {
63 3
        return $this->setListItem('favorite', 'movie', $movie_id, false);
64
    }
65
66
    /**
67
     * Mark a TV show as favorkite
68
     * @param  int $tvshow_id TV show id
69
     * @return Favorite
70
     */
71 3
    public function markTVShowAsFavorite(int $tvshow_id) : Favorite
72
    {
73 3
        return $this->setListItem('favorite', 'tv', $tvshow_id, true);
74
    }
75
76
    /**
77
     * Unmark a TV show as favorite
78
     * @param  int $tvshow_id TV Show id
79
     * @return Favorite
80
     */
81 3
    public function unmarkTVShowAsFavorite(int $tvshow_id) : Favorite
82
    {
83 3
        return $this->setListItem('favorite', 'tv', $tvshow_id, false);
84
    }
85
}
86