Catalog::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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;
16
17
use VfacTmdb\Catalogs\Genres;
18
use VfacTmdb\Catalogs\Jobs;
19
use VfacTmdb\Interfaces\TmdbInterface;
20
21
/**
22
 * Catalog class
23
 * @package Tmdb
24
 * @author Vincent Faliès <[email protected]>
25
 * @copyright Copyright (c) 2017
26
 */
27
class Catalog
28
{
29
    /**
30
     * Tmdb object
31
     * @var TmdbInterface
32
     */
33
    private $tmdb = null;
34
    /**
35
     * Logger
36
     * @var \Psr\Log\LoggerInterface
37
     */
38
    private $logger = null;
39
40
    /**
41
     * Constructor
42
     * @param TmdbInterface $tmdb
43
     */
44 21
    public function __construct(TmdbInterface $tmdb)
45
    {
46 21
        $this->tmdb   = $tmdb;
47 21
        $this->logger = $tmdb->getLogger();
48 21
    }
49
50
    /**
51
     * Get movie genres list
52
     * @param array $options
53
     * @return \Generator
54
     */
55 9
    public function getMovieGenres(array $options = array()) : \Generator
56
    {
57 9
        $this->logger->debug('Starting getting movie genres', array('options' => $options));
58 9
        $catalog = new Genres($this->tmdb);
59 9
        return $catalog->getMovieList($options);
60
    }
61
62
    /**
63
     * Get TVShow genres list
64
     * @param array $options
65
     * @return \Generator
66
     */
67 6
    public function getTVShowGenres(array $options = array()) : \Generator
68
    {
69 6
        $this->logger->debug('Starting getting tv show genres', array('options' => $options));
70 6
        $catalog = new Genres($this->tmdb);
71 6
        return $catalog->getTVList($options);
72
    }
73
74
    /**
75
     * Get Job list
76
     * @param array $options
77
     * @return \Generator|\stdClass
78
     */
79 6
    public function getJobsList(array $options = array()) : \Generator
80
    {
81 6
        $this->logger->debug('Starting getting jobs list', array('options' => $options));
82 6
        $catalog = new Jobs($this->tmdb);
83 6
        return $catalog->getList();
84
    }
85
}
86