Passed
Branch account (ed4c74)
by vincent
02:20
created

TVItem   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 20
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPostersGeneric() 0 9 2
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\Abstracts\Items;
16
17
use VfacTmdb\Results;
18
use VfacTmdb\Abstracts\Item;
19
use VfacTmdb\Traits\ElementTrait;
20
21
/**
22
 * abstract TV item class
23
 * @package Tmdb
24
 * @author Vincent Faliès <[email protected]>
25
 * @copyright Copyright (c) 2017
26
 */
27
abstract class TVItem extends Item
28
{
29
    use ElementTrait;
30
31
    /**
32
     * Image posters
33
     * @param string $url api url
34
     * @param string $key json key
35
     * @return \Generator|Results\Image
36
     */
37 2
    public function getPostersGeneric(string $url, string $key) : \Generator
38
    {
39 2
        $data = $this->tmdb->getRequest($url, $this->params);
40
41 2
        foreach ($data->$key as $b) {
42 2
            $image = new Results\Image($this->tmdb, $this->id, $b);
43 2
            yield $image;
44
        }
45 2
    }
46
}
47