Maskable::getMaskPattern()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
namespace Yaro\Jarboe\Table\Fields\Traits;
4
5
trait Maskable
6
{
7
    protected $maskPattern;
8
    protected $maskPlaceholder;
9
10 2
    public function mask(string $pattern, string $placeholder = '∗')
11
    {
12 2
        $this->maskPattern = $pattern;
13 2
        $this->maskPlaceholder = $placeholder;
14
15 2
        return $this;
16
    }
17
18
    /**
19
     * @return mixed
20
     */
21 2
    public function getMaskPattern()
22
    {
23 2
        return $this->maskPattern;
24
    }
25
26
    /**
27
     * @return mixed
28
     */
29 2
    public function getMaskPlaceholder()
30
    {
31 2
        return $this->maskPlaceholder;
32
    }
33
34 3
    public function isMaskable()
35
    {
36 3
        return $this->maskPattern && $this->maskPlaceholder;
37
    }
38
}
39