File   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 31
ccs 0
cts 6
cp 0
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A onView() 0 3 1
A onEdit() 0 3 1
A onIndex() 0 4 2
1
<?php
2
3
namespace Terranet\Administrator\Field;
4
5
use Terranet\Administrator\Scaffolding;
6
7
class File extends Field
8
{
9
    protected $visibility = [
10
        Scaffolding::PAGE_INDEX => true,
11
        Scaffolding::PAGE_EDIT => true,
12
        Scaffolding::PAGE_VIEW => true,
13
    ];
14
15
    /**
16
     * @return array
17
     */
18
    public function onEdit(): array
19
    {
20
        return $this->onIndex();
21
    }
22
23
    /**
24
     * @return array
25
     */
26
    public function onView(): array
27
    {
28
        return $this->onIndex();
29
    }
30
31
    /**
32
     * @return array
33
     */
34
    protected function onIndex(): array
35
    {
36
        return [
37
            'attachment' => $this->model ? $this->model->{$this->id} : null,
38
        ];
39
    }
40
}
41