InvalidArgumentException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 11
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromValidTypes() 0 8 2
1
<?php
2
declare(strict_types=1);
3
4
namespace AcMailer\Exception;
5
6
/**
7
 * Exception produced when an argument provided for an AcMailer method is not valid
8
 * @author Alejandro Celaya Alastrué
9
 * @link http://www.alejandrocelaya.com
10
 */
11
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
12
{
13
    public static function fromValidTypes(array $types, $value): self
14
    {
15
        return new self(\sprintf(
16
            'Provided email is not valid. Expected one of ["%s"], but "%s" was provided',
17
            \implode('", "', $types),
18
            \is_object($value) ? \get_class($value) : \gettype($value)
19
        ));
20
    }
21
}
22