Completed
Push — master ( e12415...37db2b )
by David
02:39
created

VerifyEventIsAClassTrait::verifyEventIsAClass()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3.0263

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 12
ccs 6
cts 7
cp 0.8571
rs 9.4286
cc 3
eloc 7
nc 3
nop 1
crap 3.0263
1
<?php
2
3
namespace Rawkode\Eidetic\EventStore;
4
5
use Rawkode\Eidetic\EventStore\InvalidEventException;
6
7
trait VerifyEventIsAClassTrait
8
{
9
    /**
10
     * @param object $event
11
     *
12
     * @throws InvalidArgumentException
13
     */
14 8
    private function verifyEventIsAClass($event)
15
    {
16
        try {
17 8
            $class = get_class($event);
18 8
        } catch (\Exception $exception) {
19 4
            throw new InvalidEventException();
20
        }
21
22 8
        if ($class === false) {
23
            throw new InvalidEventException();
24
        }
25 8
    }
26
}
27