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

IDNEncodeTrait::isIDNEncoded()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

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
1
<?php
2
/**
3
 * File containing the trait {@see \Mailcode\Traits\Commands\Validation\IDNEncodeTrait}.
4
 *
5
 * @package Mailcode
6
 * @subpackage Validation
7
 * @see \Mailcode\Traits\Commands\Validation\IDNEncodeTrait
8
 */
9
10
declare(strict_types=1);
11
12
namespace Mailcode\Traits\Commands\Validation;
13
14
use Mailcode\Interfaces\Commands\Validation\IDNEncodeInterface;
15
use Mailcode\Mailcode_Commands_Keywords;
16
use Mailcode\Mailcode_Exception;
17
use Mailcode\Mailcode_Parser_Statement_Tokenizer_Token_Keyword;
18
19
/**
20
 * Command validation drop-in: checks for the presence
21
 * of the `idnencode:` keyword in the command statement,
22
 * and sets the IDN encode enabled flag accordingly.
23
 *
24
 * @package Mailcode
25
 * @subpackage Validation
26
 * @author Sebastian Mordziol <[email protected]>
27
 *
28
 * @see IDNEncodeInterface
29
 */
30
trait IDNEncodeTrait
31
{
32
    /**
33
     * @param bool $enabled
34
     * @return $this
35
     */
36
    public function setIDNEncodingEnabled(bool $enabled) : self
37
    {
38
        return $this->setEncodingEnabled(Mailcode_Commands_Keywords::TYPE_IDN_ENCODE, $enabled);
0 ignored issues
show
Bug introduced by
The method setEncodingEnabled() does not exist on Mailcode\Traits\Commands\Validation\IDNEncodeTrait. Did you maybe mean setIDNEncodingEnabled()? ( Ignorable by Annotation )

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

38
        return $this->/** @scrutinizer ignore-call */ setEncodingEnabled(Mailcode_Commands_Keywords::TYPE_IDN_ENCODE, $enabled);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
39
    }
40
41
    public function isIDNEncoded() : bool
42
    {
43
        return $this->getIDNEncodingToken() !== null;
44
    }
45
46
    public function getIDNEncodingToken() : ?Mailcode_Parser_Statement_Tokenizer_Token_Keyword
47
    {
48
        return $this->getEncodingToken(Mailcode_Commands_Keywords::TYPE_IDN_ENCODE);
0 ignored issues
show
Bug introduced by
The method getEncodingToken() does not exist on Mailcode\Traits\Commands\Validation\IDNEncodeTrait. Did you maybe mean getIDNEncodingToken()? ( Ignorable by Annotation )

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

48
        return $this->/** @scrutinizer ignore-call */ getEncodingToken(Mailcode_Commands_Keywords::TYPE_IDN_ENCODE);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
49
    }
50
}
51