Image   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUrl() 0 4 1
A getFilters() 0 7 1
1
<?php
2
3
namespace Chadicus\Marvel\Api\Entities;
4
5
/**
6
 * Represents a Marvel API Image Entity
7
 *
8
 * @property-read string $path The directory path of to the image.
9
 * @property-read string $extension The file extension for the image.
10
 */
11
class Image extends AbstractEntity
12
{
13
    /**
14
     * Returns the full image url.
15
     *
16
     * @param ImageVariant $variant The image variant to use in the url.
17
     *
18
     * @return string
19
     */
20
    final public function getUrl(ImageVariant $variant) : string
21
    {
22
        return "{$this->path}/{$variant}.{$this->extension}";
23
    }
24
25
    /**
26
     * @see AbstractEntity::getFilters()
27
     *
28
     * @return array
29
     */
30
    final protected function getFilters() : array
31
    {
32
        return [
33
            'path' => ['default' => null, ['string', true, 0]],
34
            'extension' => ['default' => null, ['string', true, 0]],
35
        ];
36
    }
37
}
38