Completed
Push — master ( 85c58c...2c5e88 )
by wen
10:27
created

Image::getDefaultExtensions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Sco\Admin\Form\Elements;
4
5
class Image extends BaseFile
6
{
7
    protected $type = 'image';
8
9
    public function getValue()
10
    {
11
        $value = $this->getValueFromModel();
12
        if (empty($value) || ! $this->existsFile($value)) {
13
            return [];
14
        }
15
16
        return $this->getFileInfo($value);
17
    }
18
19
    protected function prepareValue($value)
20
    {
21
        if (empty($value) || ! is_array($value)) {
22
            return '';
23
        }
24
25
        return $value['path'];
26
    }
27
28
    protected function getDefaultExtensions()
29
    {
30
        return config('admin.upload.extensions.image');
31
    }
32
}
33