Completed
Pull Request — master (#1984)
by Maciej
19:41
created

DocumentNotFoundException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 3
crap 2.032
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ODM\MongoDB;
6
7
use function json_encode;
8
use function sprintf;
9
10
/**
11
 * Class for exception when encountering proxy object that has
12
 * an identifier that does not exist in the database.
13
 */
14
final class DocumentNotFoundException extends MongoDBException
15
{
16 8
    public static function documentNotFound(string $className, $identifier) : self
17
    {
18 8
        return new self(sprintf(
19 8
            'The "%s" document with identifier %s could not be found.',
20 8
            $className,
21 8
            json_encode($identifier)
22
        ));
23
    }
24
}
25