FilmAwareTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A setFilm() 0 12 3
1
<?php
2
namespace FilmTools\Films;
3
4
trait FilmAwareTrait
5
{
6
    use FilmProviderTrait;
7
8
    /**
9
     * @param FilmInterface|FilmProviderInterface $film
10
     */
11 16
    public function setFilm( $film )
12
    {
13 16
        if ($film instanceOf FilmProviderInterface):
14 4
            $this->film = $film->getFilm();
15 13
        elseif ($film instanceOf FilmInterface):
16 4
            $this->film = $film;
17 1
        else:
18 8
            throw new \InvalidArgumentException("Instance of FilmInterface or FilmProviderInterface expected.");
19
        endif;
20
21 8
        return $this;
22
    }
23
}
24