NoMoreInstances::listRanOutAt()   A
last analyzed

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
nc 1
nop 1
dl 0
loc 5
rs 10
c 1
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Stratadox\Instantiator;
5
6
use InvalidArgumentException;
7
use function sprintf;
8
9
/**
10
 * Notifies the client code that the object provider ran out of instances.
11
 *
12
 * @author Stratadox
13
 */
14
final class NoMoreInstances extends InvalidArgumentException implements InstantiationFailure
15
{
16
    /**
17
     * Creates a new exception.
18
     *
19
     * @return NoMoreInstances The exception to throw.
20
     */
21
    public static function listRanOutAt(int $offset): InstantiationFailure
22
    {
23
        return new self(sprintf(
24
            'There is no instance to provide at offset %d.',
25
            $offset
26
        ));
27
    }
28
}
29