|
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-2021 |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
namespace VfacTmdb\Items; |
|
16
|
|
|
|
|
17
|
|
|
use VfacTmdb\Abstracts\Items\ItemChanges; |
|
18
|
|
|
use VfacTmdb\Exceptions\TmdbException; |
|
19
|
|
|
use VfacTmdb\Interfaces\TmdbInterface; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* TV Item Changes class |
|
23
|
|
|
* @package Tmdb |
|
24
|
|
|
* @author Steve Richter <[email protected]> |
|
25
|
|
|
* @copyright Copyright (c) 2021 |
|
26
|
|
|
*/ |
|
27
|
|
|
class TVShowItemChanges extends ItemChanges |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* Constructor |
|
31
|
|
|
* @param TmdbInterface $tmdb |
|
32
|
|
|
* @param int $movie_id |
|
33
|
|
|
* @param array $options |
|
34
|
|
|
*/ |
|
35
|
21 |
|
public function __construct(TmdbInterface $tmdb, int $movie_id, array $options = array()) |
|
36
|
|
|
{ |
|
37
|
|
|
try { |
|
38
|
21 |
|
parent::__construct($tmdb, 'tv', $movie_id, $options); |
|
39
|
3 |
|
} catch (TmdbException $ex) { |
|
40
|
3 |
|
throw $ex; |
|
41
|
|
|
} |
|
42
|
18 |
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Get TV Season Item Changes for this TV Show |
|
46
|
|
|
* @return \AppendIterator|VfacTmdb\Results\ItemChange |
|
|
|
|
|
|
47
|
|
|
*/ |
|
48
|
12 |
|
public function getSeasonChanges() : \AppendIterator |
|
49
|
|
|
{ |
|
50
|
12 |
|
$seasonChanges = new \AppendIterator(); |
|
51
|
12 |
|
foreach ($this->getChangesByKey('season') as $change) { |
|
52
|
12 |
|
if (null !== $change->getValueByKey('season_id')) { |
|
53
|
12 |
|
$seasonChanges->append( |
|
54
|
12 |
|
(new TVSeasonItemChanges($this->tmdb, $change->getValueByKey('season_id'), $this->params)) |
|
|
|
|
|
|
55
|
12 |
|
->getChanges() |
|
56
|
|
|
); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
12 |
|
return $seasonChanges; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Get TV Episode Item Changes for this TV Show |
|
65
|
|
|
* @return \AppendIterator|VfacTmdb\Results\ItemChange |
|
66
|
|
|
*/ |
|
67
|
6 |
|
public function getEpisodeChanges() : \AppendIterator |
|
68
|
|
|
{ |
|
69
|
6 |
|
$episodeChanges = new \AppendIterator(); |
|
70
|
6 |
|
foreach ($this->getSeasonChanges() as $seasonChange) { |
|
71
|
6 |
|
if (null !== $seasonChange->getValueByKey('episode_id')) { |
|
72
|
6 |
|
$episodeChanges->append( |
|
73
|
6 |
|
(new TVEpisodeItemChanges($this->tmdb, $seasonChange->getValueByKey('episode_id'), $this->params)) |
|
74
|
6 |
|
->getChanges() |
|
75
|
|
|
); |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
6 |
|
return $episodeChanges; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|