Asset::getUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Distilleries\Contentful\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Distilleries\Contentful\Models\Traits\Localable;
7
8
/**
9
 * @property string $contentful_id
10
 * @property string $locale
11
 * @property string $country
12
 * @property string $title
13
 * @property string $description
14
 * @property string $url
15
 * @property string $file_name
16
 * @property string $content_type
17
 * @property integer $size
18
 * @property integer $width
19
 * @property integer $height
20
 * @property \Illuminate\Support\Carbon $created_at
21
 * @property \Illuminate\Support\Carbon $updated_at
22
 */
23
class Asset extends Model
24
{
25
    use Localable;
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected $table = 'assets';
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected $fillable = [
36
        'contentful_id',
37
        'locale',
38
        'country',
39
        'title',
40
        'description',
41
        'url',
42
        'file_name',
43
        'content_type',
44
        'size',
45
        'width',
46
        'height',
47
    ];
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    protected $casts = [
53
        'size' => 'integer',
54
        'width' => 'integer',
55
        'height' => 'integer',
56
    ];
57
58
    /**
59
     * Return asset URL.
60
     *
61
     * @return string|null
62
     */
63
    public function getUrl(): ?string
64
    {
65
        return $this->url;
66
    }
67
}
68