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\Results; |
16
|
|
|
|
17
|
|
|
use VfacTmdb\Abstracts\Results; |
18
|
|
|
use VfacTmdb\Interfaces\Results\CollectionResultsInterface; |
19
|
|
|
use VfacTmdb\Traits\ElementTrait; |
20
|
|
|
use VfacTmdb\Interfaces\TmdbInterface; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Class to manipulate a collection result |
24
|
|
|
* @package Tmdb |
25
|
|
|
* @author Vincent Faliès <[email protected]> |
26
|
|
|
* @copyright Copyright (c) 2017 |
27
|
|
|
*/ |
28
|
|
|
class Collection extends Results implements CollectionResultsInterface |
29
|
|
|
{ |
30
|
|
|
use ElementTrait; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Collection name |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
protected $name = null; |
37
|
|
|
/** |
38
|
|
|
* Image poster path |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
protected $poster_path = null; |
42
|
|
|
/** |
43
|
|
|
* Image backdrop path |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $backdrop_path = null; |
47
|
|
|
/** |
48
|
|
|
* Id |
49
|
|
|
* @var int |
50
|
|
|
*/ |
51
|
|
|
protected $id = null; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Constructor |
55
|
|
|
* @param TmdbInterface $tmdb |
56
|
|
|
* @param \stdClass $result |
57
|
|
|
*/ |
58
|
9 |
|
public function __construct(TmdbInterface $tmdb, \stdClass $result) |
59
|
|
|
{ |
60
|
9 |
|
parent::__construct($tmdb, $result); |
61
|
|
|
|
62
|
|
|
// Populate data |
63
|
9 |
|
$this->id = $this->data->id; |
64
|
9 |
|
$this->name = $this->data->name; |
65
|
9 |
|
$this->poster_path = $this->data->poster_path; |
66
|
9 |
|
$this->backdrop_path = $this->data->backdrop_path; |
67
|
|
|
|
68
|
9 |
|
$this->setElementTrait($this->data); |
69
|
9 |
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Get collection ID |
73
|
|
|
* @return int |
74
|
|
|
*/ |
75
|
3 |
|
public function getId() : int |
76
|
|
|
{ |
77
|
3 |
|
return (int) $this->id; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Get collection name |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
3 |
|
public function getName() : string |
85
|
|
|
{ |
86
|
3 |
|
return $this->name; |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|