Completed
Pull Request — master (#41)
by David
11:45
created

VerifyEventIsAClassTrait   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 20
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
    protected function verifyEventIsAClass($event)
13
    {
14
        try {
15
            $class = get_class($event);
16
        } catch (\Exception $exception) {
17
            throw new InvalidEventException();
18
        }
19
20
        if ($class === false) {
21
            throw new InvalidEventException();
22
        }
23
    }
24
}
25