Completed
Push — 2.0 ( dbcf6f...affe05 )
by Nicolas
16:41
created

MediaMultipleDirective::extractArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 6
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Modules\Media\Blade;
4
5 View Code Duplication
class MediaMultipleDirective
6
{
7
    /**
8
     * @var string
9
     */
10
    private $zone;
11
    /**
12
     * @var
13
     */
14
    private $entity;
15
    /**
16
     * @var string|null
17
     */
18
    private $view;
19
20
    public function show($arguments)
21
    {
22
        $this->extractArguments($arguments);
23
24
        $view = $this->view ?: 'media::admin.fields.new-file-link-multiple';
25
        $zone = $this->zone;
26
27
        if ($this->entity !== null) {
28
            $media = $this->entity->filesByZone($this->zone)->get();
29
        }
30
31
        return view($view, compact('media', 'zone'));
32
    }
33
34
    /**
35
     * Extract the possible arguments as class properties
36
     * @param array $arguments
37
     */
38
    private function extractArguments(array $arguments)
39
    {
40
        $this->zone = array_get($arguments, 0);
41
        $this->entity = array_get($arguments, 1);
42
        $this->view = array_get($arguments, 2);
43
    }
44
}
45