Image::getUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 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