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

Maskable   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 34
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A mask() 0 7 1
A getMaskPattern() 0 4 1
A getMaskPlaceholder() 0 4 1
A isMaskable() 0 4 2
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