Passed
Pull Request — master (#20)
by Hilmi Erdem
13:59 queued 07:56
created

GeneratorInstantiationException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createForNotInstantiableGenerator() 0 5 1
A createForMissingGenerator() 0 5 1
1
<?php
2
/*
3
 * Copyright (c) 2021. Hilmi Erdem Keren
4
 * license MIT
5
 */
6
7
namespace Erdemkeren\Otp\Exceptions;
8
9
use RuntimeException;
10
11
/**
12
 * Class GeneratorInstantiationException.
13
 */
14
class GeneratorInstantiationException extends RuntimeException
15
{
16
    public static function createForMissingGenerator(string $className): self
17
    {
18
        return new static(sprintf(
19
            'The generator [%s] could not be found.',
20
            $className,
21
        ));
22
    }
23
24
    public static function createForNotInstantiableGenerator(string $className): self
25
    {
26
        return new static(sprintf(
27
            'The generator [%s] is not instantiable.',
28
            $className,
29
        ));
30
    }
31
}
32