VerifyEventIsAClassTrait   A
last analyzed

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 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1
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\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