for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace vfalies\tmdb\Items;
class Collection extends Item implements \vfalies\tmdb\Interfaces\CollectionInterface
{
// Private loaded data
protected $data = null;
protected $conf = null;
protected $id = null;
protected $tmdb = null;
/**
* Constructor
* @param \vfalies\tmdb\Tmdb $tmdb
* @throws \Exception
*/
public function __construct(\vfalies\tmdb\Tmdb $tmdb, $collection_id, array $options = array())
parent::__construct($tmdb, $collection_id, $options, 'collection');
}
* Get collection ID
* @return int
public function getId(): int
return $this->id;
* Get collection name
* @return string
public function getName(): string
if (isset($this->data->name))
return $this->data->name;
throw new \Exception('Collection name can not be found');
* Get collection parts
* @return Generator|SearchMovieResult
public function getParts(): \Generator
if (!empty($this->data->parts))
foreach ($this->data->parts as $part)
$movie = new \vfalies\tmdb\Results\Movie($this->tmdb, $part);
yield $movie;