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

Clipboard::hasClipboardButton()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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