VerifyEventIsAClassTrait::verifyEventIsAClass()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3.0261

Importance

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