Test Failed
Push — master ( 9ff364...742ef2 )
by Sebastian
03:58
created

Mailcode_Traits_Commands_Validation_URLDecode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getURLDecodeToken() 0 3 1
A isURLDecoded() 0 3 1
A setURLDecoding() 0 3 1
1
<?php
2
/**
3
 * File containing the {@see \Mailcode\Mailcode_Traits_Commands_Validation_URLDecode} trait.
4
 *
5
 * @package Mailcode
6
 * @subpackage Validation
7
 * @see \Mailcode\Mailcode_Traits_Commands_Validation_URLDecode
8
 */
9
10
declare(strict_types=1);
11
12
namespace Mailcode;
13
14
use Mailcode\Commands\ParamsException;
15
16
/**
17
 * Command validation drop-in: checks for the presence
18
 * of a "urldecode:" keyword.
19
 *
20
 * @package Mailcode
21
 * @subpackage Validation
22
 * @author Sebastian Mordziol <[email protected]>
23
 *
24
 * @see Mailcode_Interfaces_Commands_Validation_URLDecode
25
 */
26
trait Mailcode_Traits_Commands_Validation_URLDecode
27
{
28
    public function getURLDecodeToken() : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword
29
    {
30
        return $this->getEncodingToken(Mailcode_Commands_Keywords::TYPE_URLDECODE);
0 ignored issues
show
Bug introduced by
It seems like getEncodingToken() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        return $this->/** @scrutinizer ignore-call */ getEncodingToken(Mailcode_Commands_Keywords::TYPE_URLDECODE);
Loading history...
31
    }
32
33
    /**
34
     * @param bool $decode
35
     * @return $this
36
     * @throws Mailcode_Exception
37
     */
38
    public function setURLDecoding(bool $decode=true) : self
39
    {
40
        return $this->setEncodingEnabled(Mailcode_Commands_Keywords::TYPE_URLDECODE, $decode);
0 ignored issues
show
Bug introduced by
It seems like setEncodingEnabled() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
        return $this->/** @scrutinizer ignore-call */ setEncodingEnabled(Mailcode_Commands_Keywords::TYPE_URLDECODE, $decode);
Loading history...
41
    }
42
43
    public function isURLDecoded() : bool
44
    {
45
        return $this->getURLDecodeToken() !== null;
46
    }
47
}
48