Completed
Pull Request — master (#1984)
by Maciej
22:01
created

DocumentNotFoundException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 11
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A documentNotFound() 0 8 1
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