Completed
Push — master ( 51084e...d852c9 )
by Yaro
07:57
created

Clipboard   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 30
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A clipboard() 0 7 1
A hasClipboardButton() 0 4 1
A getClipboardCaption() 0 6 2
1
<?php
2
3
namespace Yaro\Jarboe\Table\Fields\Traits;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Http\UploadedFile;
7
use Illuminate\Support\Facades\Storage as IlluminateStorage;
8
9
trait Clipboard
10
{
11
    protected $clipboard = false;
12
    protected $clipboardCaption = null;
13
14
    /**
15
     * @param bool $enabled
16
     * @param string|int|null|\Closure $caption
17
     * @return $this
18
     */
19 6
    public function clipboard(bool $enabled = true, $caption = null)
20
    {
21 6
        $this->clipboard = $enabled;
22 6
        $this->clipboardCaption = $caption;
23
24 6
        return $this;
25
    }
26
27 9
    public function hasClipboardButton()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
28
    {
29 9
        return $this->clipboard;
30
    }
31
32 6
    public function getClipboardCaption($model)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
33
    {
34 6
        $value = $this->clipboardCaption;
35
36 6
        return $value instanceof \Closure ? $value($model) : $value;
37
    }
38
}
39