This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
38
{
39
$type = $this->addressingKey->type;
40
if (empty($type) || !is_string($type)) {
41
throw new \InvalidArgumentException('type should be a string');
42
}
43
44
$typeList = [
45
'CPF',
46
'CNPJ',
47
'EMAIL',
48
'PHONE',
49
'EVP',
50
];
51
if (!in_array($this->addressingKey->type, $typeList)) {
52
throw new \InvalidArgumentException('this key type is not valid');
53
}
54
}
55
56
/**
57
* This validates a key value
58
*
59
* @return void
60
* @throws InvalidArgumentException
61
*/
62
private function validateValue()
63
{
64
$value = $this->addressingKey->value;
65
if (empty($value) || !is_string($value)) {
66
throw new \InvalidArgumentException('value should be a string');
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.