Completed
Push — master ( 3cd148...6fd5a8 )
by Freek
01:45 queued 14s
created

CouldNotCreateSnapshot   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 12
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A projectorDidNotWriteAnythingToSnapshot() 0 4 1
A projectorThrewExceptionDuringWritingToSnapshot() 0 4 1
1
<?php
2
3
namespace Spatie\EventProjector\Exceptions;
4
5
use Exception;
6
use Spatie\EventProjector\Projectors\Projector;
7
8
class CouldNotCreateSnapshot extends Exception
9
{
10
    public static function projectorDidNotWriteAnythingToSnapshot(Projector $projector)
11
    {
12
        return new static("The projector named {$projector->getName()} didn't write to the snapshot. When snapshotting a projector should write it's state to the snapshot.");
13
    }
14
15
    public static function projectorThrewExceptionDuringWritingToSnapshot(Projector $projector, Exception $exception)
16
    {
17
        return new static("The projector named {$projector->getName()} threw an exception while writing to a snapshot", 0, $exception);
18
    }
19
}