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

VerifyEventIsAClassTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 85.71%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
c 1
b 1
f 0
lcom 0
cbo 1
dl 0
loc 20
ccs 6
cts 7
cp 0.8571
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A verifyEventIsAClass() 0 12 3
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