Completed
Push — master ( 33591a...530541 )
by Freek
09:49
created

newEventsStoredDuringSnapshotCreation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Spatie\EventProjector\Exceptions;
4
5
use Exception;
6
use Illuminate\Support\Collection;
7
use Spatie\EventProjector\Projectors\Projector;
8
use Spatie\EventProjector\Snapshots\Snapshot;
9
10
class CouldNotCreateSnapshot extends Exception
11
{
12
    public static function projectorDidNotWriteAnythingToSnapshot(Projector $projector)
13
    {
14
        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.");
15
    }
16
17
    public static function projectorThrewExceptionDuringWritingToSnapshot(Projector $projector, Exception $exception)
18
    {
19
        return new static("The projector named {$projector->getName()} threw an exception while writing to a snapshot", 0, $exception);
20
    }
21
22
    public static function newEventsStoredDuringSnapshotCreation(Snapshot $snapshot, Collection $newEventsHandledByProjectorOfSnapshot)
0 ignored issues
show
Unused Code introduced by
The parameter $newEventsHandledByProjectorOfSnapshot is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24
        return new static("While creating a snapshot for projector `{$snapshot->name()}` new events were stored where the projector listens for. The validity of the snapshot could not be guarantied so it was deleted. Try creating the snapshot again.");
25
    }
26
}
27