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

createForMissingGenerator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
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